Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r766708fceb0bdf1af8c7897df29d4f5036bfd3db -r6b870cd0699bb3ee22b93981d51373a6c2d56162 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 766708fceb0bdf1af8c7897df29d4f5036bfd3db) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 6b870cd0699bb3ee22b93981d51373a6c2d56162) @@ -34,10 +34,9 @@ // ********** private definitions ********** /// Interval to control lamp and audio and to publish alarm status data. -#define ALARM_STATUS_PUBLISH_INTERVAL ( ALARM_LAMP_AND_AUDIO_CONTROL_INTERVAL_MS / TASK_GENERAL_INTERVAL ) +static const U32 ALARM_STATUS_PUBLISH_INTERVAL = ( ALARM_LAMP_AND_AUDIO_CONTROL_INTERVAL_MS / TASK_GENERAL_INTERVAL ); #define ALARM_SILENCE_EXPIRES_IN_SECS (60) ///< Alarm silence expiration time in seconds. -#define ALARM_SILENCE_REQUESTED 1 ///< User cmd to request alarm silence (1=silence, 0=cancel silence). #define SUPERVISOR_ALARM_KEY 0xD2C3B4A5 ///< 32-bit key required for clear all alarms request. @@ -148,7 +147,8 @@ alarmStatus.noResume = FALSE; alarmStatus.noRinseback = FALSE; alarmStatus.noEndTreatment = FALSE; - alarmStatus.noNewTreatment = FALSE; + alarmStatus.noNewTreatment = FALSE; + alarmStatus.noDialRecirc = FALSE; alarmStatus.usrACKRequired = FALSE; } @@ -193,7 +193,12 @@ { // No need to do anything if alarm is already active if ( FALSE == alarmIsActive[ alarm ] ) - { + { + // If alarm status was that no alarms currently active, set this alarm as top alarm until status formally updated later + if ( ALARM_ID_NO_ALARM == alarmStatus.alarmTop ) + { + alarmStatus.alarmTop = alarm; + } // If alarms silenced, end silence due to new alarm alarmStatus.alarmsSilenced = FALSE; // If alarm is a fault, request transition to fault mode @@ -428,9 +433,9 @@ * @param cmd ID of user command (1=silence, 0=cancel silence) * @return none *************************************************************************/ -void signalAlarmSilence( U32 cmd ) +void signalAlarmSilence( ALARM_SILENCE_CMD_T cmd ) { - if ( ALARM_SILENCE_REQUESTED == cmd ) + if ( ALARM_SILENCE_CMD_START == cmd ) { if ( FALSE == alarmStatus.alarmsSilenced ) { @@ -528,6 +533,47 @@ /*********************************************************************//** * @brief + * The isAnyAlarmActive function determines whether any alarm is currently + * active. + * @details Inputs: alarmStatus + * @details Outputs: none + * @return TRUE if any alarm is active, FALSE if not + *************************************************************************/ +BOOL isAnyAlarmActive( void ) +{ + BOOL result = ( alarmStatus.alarmTop != ALARM_ID_NO_ALARM ? TRUE : FALSE ); + + return result; +} + +/*********************************************************************//** + * @brief + * The isDialysateRecircBlocked function determines whether any currently + * active alarm is blocking dialysate re-circulation. + * @details Inputs: alarmStatus + * @details Outputs: none + * @return TRUE if any active alarm prevents dialysate re-circulation, FALSE if not + *************************************************************************/ +BOOL isDialysateRecircBlocked( void ) +{ + return alarmStatus.noDialRecirc; +} + +/*********************************************************************//** + * @brief + * The doesAlarmStatusIndicateStop function determines whether any currently + * active alarm has stop property. + * @details Inputs: alarmStatus + * @details Outputs: none + * @return TRUE if any active alarm has stop property, FALSE if not + *************************************************************************/ +BOOL doesAlarmStatusIndicateStop( void ) +{ + return alarmStatus.stop; +} + +/*********************************************************************//** + * @brief * The getCurrentAlarmStatePriority function determines the current alarm * state priority (NONE, LOW, MEDIUM, or HIGH). * @details Inputs: alarmStatus @@ -614,7 +660,8 @@ { ALARM_PRIORITY_T highestPriority = ALARM_PRIORITY_NONE; ALARM_ID_T a; - BOOL faultsActive = FALSE; + BOOL faultsActive = FALSE; + BOOL dialysateRecircBlocked = FALSE; // Update FIFOs and sub-ranks per active alarms table - for alarm ranking purposes to determine "top" alarm for ( a = ALARM_ID_NO_ALARM; a < NUM_OF_ALARM_IDS; a++ ) @@ -652,14 +699,20 @@ if ( TRUE == ALARM_TABLE[ a ].alarmIsFault ) { faultsActive = TRUE; + } + // Track whether any active alarms prevent dialysate re-circulation so far + if ( TRUE == ALARM_TABLE[ a ].alarmNoDialysateRecirc ) + { + dialysateRecircBlocked = TRUE; } } } // Update alarm to display per highest priority FIFO alarmStatus.alarmsState = highestPriority; alarmStatus.alarmTop = alarmPriorityFIFO[ highestPriority ].alarmID; - alarmStatus.systemFault = faultsActive; + alarmStatus.systemFault = faultsActive; + alarmStatus.noDialRecirc = dialysateRecircBlocked; } /*********************************************************************//**