Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -r09e6cf9de34acf18f6e1138bf56ac0edb4821186 -r0816f5b386a59ca4f4f70a7ab1a4bcbda52c0432 --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 09e6cf9de34acf18f6e1138bf56ac0edb4821186) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 0816f5b386a59ca4f4f70a7ab1a4bcbda52c0432) @@ -32,6 +32,7 @@ #define BLOOD_LEAK_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the blood leak data is published on the CAN bus. #define BLOOD_LEAK_TIMEOUT_MS 500 ///< Blood leak detector timeout for zeroing and self-test (15 ms extended edge detection) +#define BLOOD_LEAK_PERSISTENCE ( 5 * MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Persistence for blood leak detected alarm. /// Defined states for the blood leak detector state machine. typedef enum BloodLeakStates @@ -53,6 +54,8 @@ static U32 bloodLeakZeroStartTime = 0; ///< Blood leak zeroing start time. static U32 bloodLeakSelfTestStartTime = 0; ///< Blood leak self-test start time. +static U32 bloodLeakPersistenceCtr = 0; ///< Blood leak alarm persistence timer counter. + /// Interval (in ms) at which to publish blood leak data to CAN bus. static OVERRIDE_U32_T bloodLeakDataPublishInterval = { BLOOD_LEAK_PUB_INTERVAL, BLOOD_LEAK_PUB_INTERVAL, 0, 0 }; static U32 bloodLeakDataPublicationTimerCounter = 0; ///< Timer counter used to schedule blood leak data publication to CAN bus. @@ -256,19 +259,30 @@ // Check status reading and act upon if ( BLOOD_LEAK_DETECTED == getBloodLeakStatus() ) { - if ( getCurrentOperationMode() == MODE_TREA ) + if ( ++bloodLeakPersistenceCtr > BLOOD_LEAK_PERSISTENCE ) { - activateAlarmNoData( ALARM_ID_HD_BLOOD_LEAK_DETECTED ); + bloodLeakPersistenceCtr = BLOOD_LEAK_PERSISTENCE; + if ( getCurrentOperationMode() == MODE_TREA ) + { + activateAlarmNoData( ALARM_ID_HD_BLOOD_LEAK_DETECTED ); + } + else + { + activateAlarmNoData( ALARM_ID_HD_BLOOD_LEAK_FAULT ); + } } + } + else // Blood leak not detected + { + if ( bloodLeakPersistenceCtr > 0 ) + { + bloodLeakPersistenceCtr--; + } else { - activateAlarmNoData( ALARM_ID_HD_BLOOD_LEAK_FAULT ); + clearAlarmCondition( ALARM_ID_HD_BLOOD_LEAK_DETECTED ); } } - else // Blood leak not detected - { - clearAlarmCondition( ALARM_ID_HD_BLOOD_LEAK_DETECTED ); - } if ( TRUE == bloodLeakZeroRequested ) {