Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -rcf6f24182211ad8cd8aa0628cec6a30a79d7a1ef -r4932be3e8748a43a468020cf7ee3af3be8149793 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision cf6f24182211ad8cd8aa0628cec6a30a79d7a1ef) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 4932be3e8748a43a468020cf7ee3af3be8149793) @@ -41,15 +41,14 @@ /// Interval (ms/task time) at which the alarm information is published on the CAN bus. #define ALARM_INFO_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) -/// Interval (ms/task time) at which the alarm information is published on the CAN bus. +/// Interval (ms/task time) Alarms are blocked after the return of AC power. #define ALARM_BLOCKED_COUNT_AFTER_AC_RETURN ( 10*MS_PER_SECOND / TASK_GENERAL_INTERVAL ) #define ALARM_SILENCE_EXPIRES_IN_SECS (60) ///< Alarm silence expiration time in seconds. #define SUPERVISOR_ALARM_KEY 0xD2C3B4A5 ///< 32-bit key required for clear all alarms request. #define LOWEST_ALARM_SUB_RANK 999 ///< Lowest alarm sub-rank that can be set. -#define ALARM_BLOCKED_LIMIT_AC_RECOVERY 0 ///< Alarm rank limit, alarms at and above this limit are blocked by alarmStatus.alarmsBlockedTimer (all alarms blocked == 0) #define ALARM_NOT_BLOCKED 0 ///< Alarm blocked timer value that indicates no alarm block // *** This declaration will cause a compiler error if ALARM_TABLE does not have same # of alarms as the Alarm_List enumeration. @@ -115,7 +114,7 @@ static OVERRIDE_U32_T alarmStartedAt[ NUM_OF_ALARM_IDS ]; ///< Table - when alarm became active for each alarm (if active) or zero (if inactive) static U32 alarmStatusPublicationTimerCounter = 0; ///< Used to schedule alarm status publication to CAN bus. static U32 alarmInfoPublicationTimerCounter = 0; ///< Used to schedule alarm information publication to CAN bus. -static U32 alarmsBlockedTimer = 0; ///< Time used to temporarily block alarms during recovery from AC power fail +static U32 alarmsBlockedTimer = 0; ///< Countdown timer used to temporarily block new alarms from being initiated /// Interval (in task intervals) at which to publish alarm status to CAN bus. static OVERRIDE_U32_T alarmStatusPublishInterval = { ALARM_STATUS_PUBLISH_INTERVAL, ALARM_STATUS_PUBLISH_INTERVAL, ALARM_STATUS_PUBLISH_INTERVAL, 0 }; @@ -351,18 +350,18 @@ *************************************************************************/ void activateAlarm2Data( ALARM_ID_T alarm, ALARM_DATA_T alarmData1, ALARM_DATA_T alarmData2 ) { - // Verify valid alarm index - if ( ( alarm > ALARM_ID_NO_ALARM ) && ( alarm < NUM_OF_ALARM_IDS ) ) + // Block if new alarms are occur during loss of AC power + if ( ( TRUE == getCPLDACPowerLossDetected() ) ) { - // Block if new alarms are occur during loss of AC power - if ( ( TRUE == getCPLDACPowerLossDetected() ) ) - { - alarmsBlockedTimer = ALARM_BLOCKED_COUNT_AFTER_AC_RETURN; - } - // if the block timer is 0 OR we have an unblockable alarm - if ( ( ALARM_NOT_BLOCKED == alarmsBlockedTimer ) + alarmsBlockedTimer = ALARM_BLOCKED_COUNT_AFTER_AC_RETURN; + } + // if the block timer is 0 OR we have an unblockable alarm + if ( ( ALARM_NOT_BLOCKED == alarmsBlockedTimer ) || ( ALARM_ID_HD_AC_POWER_LOST == alarm ) || ( ALARM_ID_HD_AC_POWER_LOST_IN_TREATMENT == alarm ) ) + { + // Sanity check, verify valid alarm index + if ( ( alarm > ALARM_ID_NO_ALARM ) && ( alarm < NUM_OF_ALARM_IDS ) ) { // Broadcast alarm and data if alarm not already active if ( FALSE == alarmIsActive[ alarm ] )