Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r07a5add2dff254f7be3699e4efac2b99d3554847 -r60a95cb6e1325abd179b4a01d83b8aabe20ccda5 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 07a5add2dff254f7be3699e4efac2b99d3554847) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 60a95cb6e1325abd179b4a01d83b8aabe20ccda5) @@ -1,4 +1,4 @@ -/************************************************************************** +/**********************************************************************//** * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * @@ -16,41 +16,47 @@ * **************************************************************************/ -#include "Common.h" #include "AlarmLamp.h" #include "OperationModes.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" #include "Timers.h" +/** + * @addtogroup AlarmManagement + * @{ + */ + // ********** private definitions ********** -#define ALARM_STATUS_PUBLISH_INTERVAL (500/TASK_GENERAL_INTERVAL) // 500ms / task interval +#define ALARM_STATUS_PUBLISH_INTERVAL (500/TASK_GENERAL_INTERVAL) ///< Default interval to publish alarm status data. -#define ALARM_SILENCE_EXPIRES_IN_SECS (60) +#define ALARM_SILENCE_EXPIRES_IN_SECS (60) ///< Alarm silence expiration time in seconds. -#define ALM_ESC_1_MIN (1 * SEC_PER_MIN * MS_PER_SECOND) -#define ALM_ESC_4_MIN (4 * SEC_PER_MIN * MS_PER_SECOND) -#define ALM_ESC_5_MIN (5 * SEC_PER_MIN * MS_PER_SECOND) -#define ALM_ESC_10_MIN (10 * SEC_PER_MIN * MS_PER_SECOND) +#define ALM_ESC_1_MIN (1 * SEC_PER_MIN * MS_PER_SECOND) ///< # of ms in 1 minute. +#define ALM_ESC_4_MIN (4 * SEC_PER_MIN * MS_PER_SECOND) ///< # of ms in 4 minutes. +#define ALM_ESC_5_MIN (5 * SEC_PER_MIN * MS_PER_SECOND) ///< # of ms in 5 minutes. +#define ALM_ESC_10_MIN (10 * SEC_PER_MIN * MS_PER_SECOND) ///< # of ms in 10 minutes. #pragma pack(push,1) +/// Record defining the properties of each individual alarm. typedef struct { - ALARM_PRIORITY_T alarmPriority; // priority of alarm - U32 alarmEscalatesAfter; // time (s) after start when alarm will escalate if not cleared (zero indicates no escalation) - ALARM_ID_T alarmEscalatesTo; // ID of alarm that this alarm will escalate to (ALARM_ID_NO_ALARM indicates no esclation) - BOOL alarmIsFault; // alarm is a system fault? - BOOL alarmStops; // alarm activation should cause a controlled stop - BOOL alarmNoClear; // alarm cannot be cleared (unrecoverable)? - BOOL alarmNoResume; // alarm prevents treatment resume - BOOL alarmNoRinseback; // alarm prevents rinseback - BOOL alarmNoEndTreatment; // alarm prevents ending treatment - BOOL alarmNoNewTreatment; // alarm prevents any new treatments - BOOL alarmDialyzerBypass; // alarm activation should cause dialyzer bypass until cleared + ALARM_PRIORITY_T alarmPriority; ///< priority of alarm + U32 alarmEscalatesAfter; ///< time (s) after start when alarm will escalate if not cleared (zero indicates no escalation) + ALARM_ID_T alarmEscalatesTo; ///< ID of alarm that this alarm will escalate to (ALARM_ID_NO_ALARM indicates no esclation) + BOOL alarmIsFault; ///< alarm is a system fault? + BOOL alarmStops; ///< alarm activation should cause a controlled stop + BOOL alarmNoClear; ///< alarm cannot be cleared (unrecoverable)? + BOOL alarmNoResume; ///< alarm prevents treatment resume + BOOL alarmNoRinseback; ///< alarm prevents rinseback + BOOL alarmNoEndTreatment; ///< alarm prevents ending treatment + BOOL alarmNoNewTreatment; ///< alarm prevents any new treatments + BOOL alarmDialyzerBypass; ///< alarm activation should cause dialyzer bypass until cleared } ALARM_T; #pragma pack(pop) +/// Table of alarms and their static properties. const ALARM_T alarmTable[ NUM_OF_ALARM_IDS ] = { // Priority Escalate In Escalate To Fault Stops NoClr NoRes NoRin NoEnd NoNew Bypass { ALARM_PRIORITY_NONE, 0, ALARM_ID_NO_ALARM, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, // ALARM_ID_NO_ALARM @@ -91,20 +97,21 @@ { ALARM_PRIORITY_HIGH, ALM_ESC_4_MIN, ALARM_ID_BLOOD_SITTING_WARNING, FALSE, TRUE , FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }, // ALARM_ID_VENOUS_PRESSURE_HIGH }; +/// A blank alarm data record for alarms that do not include alarm data when triggered. const ALARM_DATA_T blankAlarmData = { ALARM_DATA_TYPE_NONE, 0 }; // ********** private data ********** -// interval (in ms) at which to publish alarm status to CAN bus +/// interval (in ms) at which to publish alarm status to CAN bus DATA_DECL( U32, AlarmStatusPub, alarmStatusPublishInterval, ALARM_STATUS_PUBLISH_INTERVAL, ALARM_STATUS_PUBLISH_INTERVAL ); -static U32 alarmStatusPublicationTimerCounter = 0; // used to schedule alarm status publication to CAN bus +static U32 alarmStatusPublicationTimerCounter = 0; ///< Used to schedule alarm status publication to CAN bus. -// table - current state of each alarm +/// table - current state of each alarm DATA_ARRAY_DECL( BOOL, AlarmStates, NUM_OF_ALARM_IDS, alarmIsActive ); -// table - when alarm became active for each alarm (if active) or zero (if inactive) +/// table - when alarm became active for each alarm (if active) or zero (if inactive) DATA_ARRAY_DECL( U32, AlarmStarts, NUM_OF_ALARM_IDS, alarmStartedAt ); -static COMP_ALARM_STATUS_T alarmStatus; +static COMP_ALARM_STATUS_T alarmStatus; ///< Record for the current composite alarm status. static ALARM_ID_T alarmPriorityFIFO[ NUM_OF_ALARM_PRIORITIES ]; @@ -693,7 +700,9 @@ *************************************************************************/ DATA_GET( U32, getPublishAlarmStatusInterval, alarmStatusPublishInterval ) +/**@}*/ + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/