Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r172b320a1007769c7452fe3f1cc7ac85b016f89a -ra82ca6884ef8872a6be952c595429543b1d24a21 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 172b320a1007769c7452fe3f1cc7ac85b016f89a) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision a82ca6884ef8872a6be952c595429543b1d24a21) @@ -44,7 +44,8 @@ #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 LOWEST_ALARM_SUB_RANK 999 ///< Lowest alarm sub-rank that can be set. +#define MAX_ALARM_LIST_SIZE 10 ///< Maximum number of active alarms inside alarm list. // *** This declaration will cause a compiler error if ALARM_TABLE does not have same # of alarms as the Alarm_List enumeration. U08 alarmTableSizeAssertion[ ( ( sizeof( ALARM_TABLE ) / sizeof( ALARM_T ) ) == NUM_OF_ALARM_IDS ? 1 : -1 ) ]; @@ -82,15 +83,12 @@ // ********** private data ********** -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 BOOL alarmIsActive[ NUM_OF_ALARM_IDS ]; ///< Table - current state of each alarm +static BOOL alarmIsDetected[ NUM_OF_ALARM_IDS ]; ///< Table - current state of each alarm condition (detected or cleared) +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. -/// 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 ]; /// Interval (in task intervals) at which to publish alarm information to CAN bus. static OVERRIDE_U32_T alarmInfoPublishInterval = { ALARM_INFO_PUB_INTERVAL, ALARM_INFO_PUB_INTERVAL, ALARM_INFO_PUB_INTERVAL, 0 }; #ifndef ALARM_VOLUME_DEFAULT_LOW @@ -106,15 +104,11 @@ /// Alarm backup audio current measured at ADC. static OVERRIDE_F32_T alarmBackupAudioCurrent = { 0.0, 0.0, 0.0, 0 }; -/// Record for the current composite alarm status. -static COMP_ALARM_STATUS_T alarmStatus; +static COMP_ALARM_STATUS_T alarmStatus; ///< Record for the current composite alarm status. +static ALARM_PRIORITY_RANKS_T alarmPriorityFIFO[ NUM_OF_ALARM_PRIORITIES ]; ///< FIFO - first activated or highest sub-rank alarm in each alarm priority category. -/// FIFO - first activated or highest sub-rank alarm in each alarm priority category. -static ALARM_PRIORITY_RANKS_T alarmPriorityFIFO[ NUM_OF_ALARM_PRIORITIES ]; +static BOOL alarmUserRecoveryActionEnabled[ NUMBER_OF_ALARM_USER_ACTIONS ]; ///< Alarm user recovery actions enabled flags. -/// Alarm user recovery actions enabled flags. -static BOOL alarmUserRecoveryActionEnabled[ NUMBER_OF_ALARM_USER_ACTIONS ]; - /// 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. @@ -150,7 +144,7 @@ void initAlarmMgmt( void ) { ALARM_PRIORITY_T p; - ALARM_ID_T a; + ALARM_ID_T a; // Disable backup audio CLR_BACKUP_AUDIO_ENABLE(); @@ -507,7 +501,7 @@ break; default: - // TODO - s/w fault? + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_ALARM_USER_ACTION, action ); break; } } @@ -624,6 +618,56 @@ // Send response to UI sendAlarmAudioVolumeSetResponse( accepted, rejReason ); } + +/*********************************************************************//** + * @brief +* The getNoNewTreatmentStatus function gets the persistent no new +* treatment alarm status flag. +* @details Inputs: alarmStatus.noNewTreatment +* @details Outputs: none +* @return TRUE if no new treatment allowed, otherwise FALSE +*************************************************************************/ +BOOL getNoNewTreatmentStatus( void ) +{ + return alarmStatus.noNewTreatment; +} + +/*********************************************************************//** + * @brief +* The handleActiveAlarmListRequest function processed the active alarms list +* request from UI. +* @details Inputs: alarmIsActive[] +* @details Outputs: sent active alarms list to UI +* @return none +*************************************************************************/ +void handleActiveAlarmListRequest( void ) +{ + BOOL accepted = TRUE; + REQUEST_REJECT_REASON_CODE_T rejReason = REQUEST_REJECT_REASON_NONE; + U32 activeAlarmList[ MAX_ALARM_LIST_SIZE ]; + U32 i; + ALARM_ID_T alarmID; + U32 activeAlarmListIndex = 0; + + for ( i = 0; i < MAX_ALARM_LIST_SIZE; i++ ) + { + activeAlarmList[ i ] = ALARM_ID_NO_ALARM; + } + + if ( TRUE == isAnyAlarmActive() ) + { + for ( alarmID = ALARM_ID_NO_ALARM; alarmID < NUM_OF_ALARM_IDS; alarmID++ ) + { + if ( ( TRUE == alarmIsActive[ alarmID ] ) && ( activeAlarmListIndex < MAX_ALARM_LIST_SIZE ) ) + { + activeAlarmList[ activeAlarmListIndex ] = alarmID; + activeAlarmListIndex++; + } + } + } + + sendActiveAlarmsList( accepted, rejReason, activeAlarmList, sizeof( activeAlarmList ) ); +} /*********************************************************************//** * @brief @@ -1034,8 +1078,8 @@ alarmStatus.noResume = noResume; alarmStatus.noRinseback = noRinseback; alarmStatus.noEndTreatment = noEndTreatment; - alarmStatus.noNewTreatment = noNewTreatment; - alarmStatus.usrACKRequired = usrAckReq; + alarmStatus.noNewTreatment |= noNewTreatment; + alarmStatus.usrACKRequired = usrAckReq; alarmStatus.noMinimize = noMinimize; } Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r172b320a1007769c7452fe3f1cc7ac85b016f89a -ra82ca6884ef8872a6be952c595429543b1d24a21 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 172b320a1007769c7452fe3f1cc7ac85b016f89a) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision a82ca6884ef8872a6be952c595429543b1d24a21) @@ -1762,6 +1762,18 @@ /*********************************************************************//** * @brief + * The getFPGATimerCount function gets the latest FPGA timer millisecond count. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return last FPGA timer count + *************************************************************************/ +U16 getFPGATimerCount( void ) +{ + return fpgaSensorReadings.fpgaTimerCount_ms; +} + +/*********************************************************************//** + * @brief * The getFPGAAccelAxes function gets the accelerometer axis readings. * Axis readings are in ADC counts. 0.004 g per LSB. * @details Inputs: fpgaSensorReadings Index: firmware/HD.dil =================================================================== diff -u -r172b320a1007769c7452fe3f1cc7ac85b016f89a -ra82ca6884ef8872a6be952c595429543b1d24a21 --- firmware/HD.dil (.../HD.dil) (revision 172b320a1007769c7452fe3f1cc7ac85b016f89a) +++ firmware/HD.dil (.../HD.dil) (revision a82ca6884ef8872a6be952c595429543b1d24a21) @@ -1,4 +1,4 @@ -# RM46L852PGE 06/29/21 11:26:20 +# RM46L852PGE 06/18/21 17:49:32 # ARCH=RM46L852PGE #