diff --git a/wpilibc/athena/src/InterruptableSensorBase.cpp b/wpilibc/athena/src/InterruptableSensorBase.cpp index f5a006da7d..7545b1b84b 100644 --- a/wpilibc/athena/src/InterruptableSensorBase.cpp +++ b/wpilibc/athena/src/InterruptableSensorBase.cpp @@ -108,7 +108,13 @@ InterruptableSensorBase::WaitResult InterruptableSensorBase::WaitForInterrupt( result = HAL_WaitForInterrupt(m_interrupt, timeout, ignorePrevious, &status); wpi_setErrorWithContext(status, HAL_GetErrorMessage(status)); - return static_cast(result); + // Rising edge result is the interrupt bit set in the byte 0xFF + // Falling edge result is the interrupt bit set in the byte 0xFF00 + // Set any bit set to be true for that edge, and AND the 2 results + // together to match the existing enum for all interrupts + int32_t rising = (result & 0xFF) ? 0x1 : 0x0; + int32_t falling = ((result & 0xFF00) ? 0x0100 : 0x0); + return static_cast(falling | rising); } /** diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/InterruptableSensorBase.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/InterruptableSensorBase.java index 087229cf7b..521c98ffa6 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/InterruptableSensorBase.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/InterruptableSensorBase.java @@ -142,6 +142,14 @@ public abstract class InterruptableSensorBase extends SensorBase { } int result = InterruptJNI.waitForInterrupt(m_interrupt, timeout, ignorePrevious); + // Rising edge result is the interrupt bit set in the byte 0xFF + // Falling edge result is the interrupt bit set in the byte 0xFF00 + // Set any bit set to be true for that edge, and AND the 2 results + // together to match the existing enum for all interrupts + int rising = ((result & 0xFF) != 0) ? 0x1 : 0x0; + int falling = ((result & 0xFF00) != 0) ? 0x0100 : 0x0; + result = rising | falling; + for (WaitResult mode : WaitResult.values()) { if (mode.value == result) { return mode;