Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r563f516a81cb41290008f93b33e7cf5e121717db -rc05775820109b5e83596c58a3b4248ac6cdb1d65 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 563f516a81cb41290008f93b33e7cf5e121717db) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision c05775820109b5e83596c58a3b4248ac6cdb1d65) @@ -114,6 +114,8 @@ #define BLOOD_FLOW_FAST_READ_TO_PERSIST 100 /// Blood flow slow read timeout alarm persistence. #define BLOOD_FLOW_SLOW_READ_TO_PERSIST ( MS_PER_SECOND * 3 ) +/// Blood flow comm error persistence. +#define BLOOD_FLOW_COMM_ERROR_PERSIST MS_PER_SECOND #define BFM_SENSOR_CONNECTED_STATUS 0x00 ///< Blood flow meter connected status. #define BFM_SENSOR_PARAM_CORRUPT_STATUS 0x07 ///< Blood flow meter NVM parameter status. @@ -191,16 +193,17 @@ static U32 errorBloodPumpDirectionPersistTimerCtr = 0; ///< Persistence timer counter for pump direction error condition. static U32 errorBloodPumpRotorTooFastPersistTimerCtr = 0; ///< Persistence timer counter for pump rotor too fast error condition. -static F32 flowReadings[ SIZE_OF_ROLLING_AVG ]; ///< Holds flow samples for a rolling average -static U32 flowReadingsIdx = 0; ///< Index for next sample in rolling average array -static F32 flowReadingsTotal = 0.0; ///< Rolling total - used to calc average -static U32 flowReadingsCount = 0; ///< Number of samples in flow rolling average buffer +static F32 flowReadings[ SIZE_OF_ROLLING_AVG ]; ///< Holds flow samples for a rolling average. +static U32 flowReadingsIdx = 0; ///< Index for next sample in rolling average array. +static F32 flowReadingsTotal = 0.0; ///< Rolling total - used to calc average. +static U32 flowReadingsCount = 0; ///< Number of samples in flow rolling average buffer. -static U32 bpCurrErrorDurationCtr = 0; ///< Used for tracking persistence of bp current errors +static U32 bpCurrErrorDurationCtr = 0; ///< Used for tracking persistence of bp current errors. -static U08 lastBloodFlowFastPacketReadCtr = 0; ///< Previous read counter for the blood flow fast packets -static U08 lastBloodFlowSlowPacketReadCtr = 0; ///< Previous read counter for the blood flow slow packets -static U08 lastBloodPumpDirectionCount = 0; ///< Previous pump direction error count reported by FPGA +static U08 lastBloodFlowFastPacketReadCtr = 0; ///< Previous read counter for the blood flow fast packets. +static U08 lastBloodFlowSlowPacketReadCtr = 0; ///< Previous read counter for the blood flow slow packets. +static U08 lastBloodPumpDirectionCount = 0; ///< Previous pump direction error count reported by FPGA. +static U08 lastBloodFlowCommErrorCount = 0; ///< Previous BP flow sensor comm error count. // ********** private function prototypes ********** @@ -257,6 +260,7 @@ initPersistentAlarm( ALARM_ID_BLOOD_FLOW_SIGNAL_STRENGTH_TOO_LOW, FLOW_SIG_STRGTH_ALARM_PERSIST, FLOW_SIG_STRGTH_ALARM_PERSIST ); initPersistentAlarm( ALARM_ID_HD_BP_FLOW_READ_TIMEOUT_ERROR, 0, BLOOD_FLOW_FAST_READ_TO_PERSIST ); initPersistentAlarm( ALARM_ID_HD_BP_FLOW_SLOW_READ_TIMEOUT_ERROR, 0, BLOOD_FLOW_SLOW_READ_TO_PERSIST ); + initPersistentAlarm( ALARM_ID_HD_BP_FLOW_SENSOR_ERROR, 0, BLOOD_FLOW_COMM_ERROR_PERSIST ); } /*********************************************************************//** @@ -451,10 +455,15 @@ U08 flowStatus = getFPGABloodFlowMeterStatus(); #ifndef DISABLE_PUMP_FLOW_CHECKS + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_BP_FLOW_SENSOR_ERROR, ( flowErrorCtr != lastBloodFlowCommErrorCount ) ) ) + { + activateAlarmNoData( ALARM_ID_HD_BP_FLOW_SENSOR_ERROR ); + } if ( flowStatus != BFM_SENSOR_CONNECTED_STATUS ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_BLOOD_FLOW_STATUS_SELF_TEST_FAILURE, (U32)flowStatus ); } + lastBloodFlowCommErrorCount = flowErrorCtr; #endif #ifndef DISABLE_FPGA_COUNTER_CHECKS @@ -501,7 +510,6 @@ // Publish blood flow data on interval publishBloodFlowData(); } -//ALARM_ID_HD_BP_FLOW_SENSOR_ERROR = 208, ///< HD blood flow sensor error /*********************************************************************//** * @brief