Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r34767560b0e6574c26f5b86628e12f6bdddbd760 -r12cb82342073207c23708afaa64b25f83f2cdfed --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 34767560b0e6574c26f5b86628e12f6bdddbd760) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 12cb82342073207c23708afaa64b25f83f2cdfed) @@ -56,12 +56,19 @@ static OVERRIDE_U32_T alarmStatusPublishInterval = { ALARM_STATUS_PUBLISH_INTERVAL, ALARM_STATUS_PUBLISH_INTERVAL, ALARM_STATUS_PUBLISH_INTERVAL, 0 }; static U32 alarmStatusPublicationTimerCounter = 0; ///< Used to schedule alarm status publication to CAN bus. + +/// Table - current state of each alarm. +static BOOL alarmIsActive[ NUM_OF_ALARM_IDS ]; +/// Table - current state of each alarm condition (detected or cleared). +static BOOL alarmIsDetected[ NUM_OF_ALARM_IDS ]; +///< Table - when alarm became active for each alarm (if active) or zero (if inactive). +static OVERRIDE_U32_T alarmStartedAt[ NUM_OF_ALARM_IDS ]; + +/// Record for the current composite alarm status. +static COMP_ALARM_STATUS_T alarmStatus; +/// FIFO - first activated alarm in each alarm priority category. +static ALARM_ID_T alarmPriorityFIFO[ NUM_OF_ALARM_PRIORITIES ]; -static BOOL alarmIsActive[ NUM_OF_ALARM_IDS ]; ///< table - current state of each alarm -static OVERRIDE_U32_T alarmStartedAt[ NUM_OF_ALARM_IDS ]; ///< table - when alarm became active for each alarm (if active) or zero (if inactive) -static COMP_ALARM_STATUS_T alarmStatus; ///< Record for the current composite alarm status. -static ALARM_ID_T alarmPriorityFIFO[ NUM_OF_ALARM_PRIORITIES ]; ///< FIFO - first activated alarm in each alarm priority category. - // ********** private function prototypes ********** static void activateAlarm( ALARM_ID_T alarm ); @@ -96,6 +103,7 @@ for ( a = ALARM_ID_NO_ALARM; a < NUM_OF_ALARM_IDS; a++ ) { alarmIsActive[ a ] = FALSE; + alarmIsDetected[ a ] = FALSE;; alarmStartedAt[ a ].data = 0; alarmStartedAt[ a ].ovData = 0; alarmStartedAt[ a ].ovInitData = 0; @@ -281,6 +289,29 @@ #endif } +/*********************************************************************//** + * @brief + * The clearAlarmCondition function clears a given alarm's condition detected + * flag. Also an alarm message is broadcast to the rest of the system. + * @details Inputs: none + * @details Outputs: alarmIsDetected[] + * @param alarm ID of alarm to clear condition for + * @return none + *************************************************************************/ +void clearAlarmCondition( ALARM_ID_T alarm ) +{ + // Verify given alarm + if ( ( alarm > ALARM_ID_NO_ALARM ) && ( alarm < NUM_OF_ALARM_IDS ) ) + { + // Clear alarm condition and broadcast alarm condition clear if not already cleared + if ( TRUE == alarmIsDetected[ alarm ] ) + { + alarmIsDetected[ alarm ] = FALSE; + broadcastAlarmConditionCleared( alarm ); + } + } +} + /*********************************************************************//** * @brief * The clearAlarm function clears a given alarm if it is recoverable. Also