Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r949b386b5f58ab8bc534bd7e913ecb9f2c084c17 -r88868fb5e8f2fcc82f50a952be700863f3cbe19c --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 949b386b5f58ab8bc534bd7e913ecb9f2c084c17) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 88868fb5e8f2fcc82f50a952be700863f3cbe19c) @@ -546,13 +546,50 @@ *************************************************************************/ BOOL isAlarmActive( ALARM_ID_T alarm ) { - BOOL result = alarmIsActive[ alarm ]; + BOOL result = FALSE; + + if ( alarm < NUM_OF_ALARM_IDS ) + { + result = alarmIsActive[ alarm ]; + } + else + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_ALARM_ID_REFERENCED, (U32)alarm ); + } return result; } /*********************************************************************//** * @brief + * The isAlarmConditionDetected function determines whether a given alarm + * condition is currently detected. + * @details Inputs: alarmIsDetected[] + * @details Outputs: none + * @param alarm ID of alarm to check + * @return TRUE if given alarm is active, FALSE if not + *************************************************************************/ +BOOL isAlarmConditionDetected( ALARM_ID_T alarm ) +{ + BOOL result = FALSE; + + if ( alarm < NUM_OF_ALARM_IDS ) + { + if ( ( TRUE == alarmIsActive[ alarm ] ) && ( TRUE == alarmIsDetected[ alarm ] ) ) + { + result = TRUE; + } + } + else + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_ALARM_ID_REFERENCED, (U32)alarm ); + } + + return result; +} + +/*********************************************************************//** + * @brief * The isAnyAlarmActive function determines whether any alarm is currently * active. * @details Inputs: alarmStatus