Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -rbdfb26334efee870ac91c86451d5bb47880f03a6 -rcbca82ba088d63f6d53579f97728d4ad5d668bf3 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision bdfb26334efee870ac91c86451d5bb47880f03a6) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision cbca82ba088d63f6d53579f97728d4ad5d668bf3) @@ -130,11 +130,11 @@ static BOOL alarmButtonBlockers[ NUM_OF_ALARM_BUTTON_BLOCKERS ]; ///< Flags indicating whether alarm table or state properties are blocking alarm buttons for UI. -/// Current state of the alarm audio self tests. -static ALARM_AUDIO_SELF_TEST_STATE_T alarmAudioSelfTestState; -/// Flag indicates whether alarm audio test tone should be output. -static BOOL alarmAudioTestToneRequested; +static ALARM_AUDIO_SELF_TEST_STATE_T alarmAudioSelfTestState; ///< Current state of the alarm audio self tests. +static BOOL alarmAudioTestToneRequested; ///< Flag indicates whether alarm audio test tone should be output. +static BOOL resumeBlockedByAlarmProperty; ///< Flag indicates whether treatment resumption is currently blocked by alarm property. + // ********** private function prototypes ********** static void activateAlarm( ALARM_ID_T alarm ); @@ -144,7 +144,6 @@ static void setAlarmLamp( void ); static void setAlarmAudio( void ); static void updateAlarmsSilenceStatus( void ); -static void handleAlarmEscalations( void ); static void updateAlarmsFlags( void ); static void clearAllRecoverableAlarms( void ); @@ -197,7 +196,8 @@ alarmStatus.alarmsSilenced = FALSE; alarmStatus.alarmsSilenceStart = 0; alarmStatus.alarmsSilenceExpiresIn = 0; - alarmStatus.alarmsEscalatesIn = 0; + alarmStatus.alarmsEscalatesIn = 0; + alarmStatus.alarmsToEscalate = FALSE; alarmStatus.alarmTop = ALARM_ID_NO_ALARM; alarmStatus.topAlarmConditionDetected = FALSE; alarmStatus.systemFault = FALSE; @@ -212,6 +212,7 @@ alarmStatus.ok = FALSE; alarmAudioTestToneRequested = FALSE; + resumeBlockedByAlarmProperty = FALSE; alarmAudioSelfTestState = ALARM_AUDIO_SELF_TEST_STATE_START; } @@ -227,7 +228,6 @@ void execAlarmMgmt( void ) { monitorAlarms(); - handleAlarmEscalations(); updateAlarmsState(); updateAlarmsFlags(); updateAlarmsSilenceStatus(); @@ -649,6 +649,19 @@ /*********************************************************************//** * @brief + * The doesAlarmIndicateNoResume function determines whether any currently + * active alarm has treatment resume blocked property. + * @details Inputs: resumeBlockedByAlarmProperty + * @details Outputs: none + * @return TRUE if any active alarm has no resume property, FALSE if not + *************************************************************************/ +BOOL doesAlarmIndicateNoResume( void ) +{ + return resumeBlockedByAlarmProperty; +} + +/*********************************************************************//** + * @brief * The getCurrentAlarmStatePriority function determines the current alarm * state priority (NONE, LOW, MEDIUM, or HIGH). * @details Inputs: alarmStatus @@ -1064,70 +1077,9 @@ } } } - + /*********************************************************************//** * @brief - * The handleAlarmEscalations function handles alarm escalation. - * @details Inputs: alarmIsActive[], ALARM_TABLE[] - * @details Outputs: alarm(s) escalated when appropriate - * @return none - *************************************************************************/ -static void handleAlarmEscalations( void ) -{ - U32 secsToEscalate = 0; - ALARM_ID_T nextAlarmToEscalate = ALARM_ID_NO_ALARM; - ALARM_ID_T a; - - // Update escalations - for ( a = ALARM_ID_NO_ALARM; a < NUM_OF_ALARM_IDS; a++ ) - { - if ( TRUE == alarmIsActive[ a ] ) - { - // Does active alarm escalate? - if ( ALARM_ID_NO_ALARM != ALARM_TABLE[ a ].alarmEscalatesTo ) - { - S32 msRemaining = (S32)ALARM_TABLE[ a ].alarmEscalatesAfter - (S32)calcTimeSince( getAlarmStartTime( a ) ); - S32 secsRemaining = ( msRemaining / MS_PER_SECOND ) + 1; - - // Time to escalate? - if ( msRemaining <= 0 ) - { - activateAlarmNoData( ALARM_TABLE[ a ].alarmEscalatesTo ); - clearAlarm( a ); - } - else - { // No candidates for alarm escalation yet? - if ( ALARM_ID_NO_ALARM == nextAlarmToEscalate ) - { - secsToEscalate = secsRemaining; - nextAlarmToEscalate = a; - } - // Sooner candidate for alarm escalation? - else if ( secsRemaining < secsToEscalate ) - { - secsToEscalate = secsRemaining; - nextAlarmToEscalate = a; - } - } - } // If alarm escalates - } // If alarm active - } // Alarm table loop - - // Update alarm escalation properties - if ( TRUE == alarmStatus.systemFault || ALARM_ID_NO_ALARM == nextAlarmToEscalate ) - { - alarmStatus.alarmsToEscalate = FALSE; - alarmStatus.alarmsEscalatesIn = 0; - } - else - { - alarmStatus.alarmsToEscalate = TRUE; - alarmStatus.alarmsEscalatesIn = secsToEscalate; - } -} - -/*********************************************************************//** - * @brief * The updateAlarmsFlags function updates the alarms flags of the alarms * status record. * @details Inputs: alarmStatus, alarmIsActive, ALARM_TABLE, alarmButtonBlockers @@ -1139,7 +1091,8 @@ BOOL systemFault = FALSE; BOOL stop = FALSE; BOOL noClear = FALSE; - BOOL noResume = FALSE; + BOOL noResume = FALSE; + BOOL noResumePerAlarmPropertyOnly = FALSE; BOOL noRinseback = FALSE; BOOL noEndTreatment = FALSE; BOOL usrAckReq = FALSE; @@ -1164,6 +1117,7 @@ systemFault = ( TRUE == ALARM_TABLE[ a ].alarmIsFault ? TRUE : systemFault ); stop = ( TRUE == ALARM_TABLE[ a ].alarmStops ? TRUE : stop ); noClear = ( TRUE == ALARM_TABLE[ a ].alarmNoClear ? TRUE : noClear ); + noResumePerAlarmPropertyOnly = ( ALARM_TABLE[ a ].alarmNoResume ? TRUE : noResumePerAlarmPropertyOnly ); // Set user alarm recovery actions allowed flags alarmButtonBlockers[ ALARM_BUTTON_TABLE_BLOCK_RESUME ] |= ALARM_TABLE[ a ].alarmNoResume; alarmButtonBlockers[ ALARM_BUTTON_TABLE_BLOCK_RINSEBACK ] |= ALARM_TABLE[ a ].alarmNoRinseback; @@ -1228,7 +1182,8 @@ alarmStatus.noRinseback = noRinseback; alarmStatus.noEndTreatment = noEndTreatment; alarmStatus.ok = usrAckReq; - alarmStatus.noMinimize = noMinimize; + alarmStatus.noMinimize = noMinimize; + resumeBlockedByAlarmProperty = noResumePerAlarmPropertyOnly; } /*********************************************************************//**