Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r4d96b3ddd98babc1214e4bbbb981797c3c2eb70a -r083b5fc400f4afeed6b1bf32f4468aeef73fed2d --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 4d96b3ddd98babc1214e4bbbb981797c3c2eb70a) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 083b5fc400f4afeed6b1bf32f4468aeef73fed2d) @@ -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. @@ -184,16 +186,24 @@ static U32 bpMotorSpeedCalcIdx = 0; ///< Index into 1 second buffer of motor speed hall sensor counts static U32 bpMotorSpeedCalcTimerCtr = 0; ///< Counter determines interval for calculating blood pump motor speed from hall sensor count. -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 errorBloodFlowVsMotorSpeedPersistTimerCtr = 0; ///< Persistence timer counter for flow vs. motor speed error condition. +static U32 errorBloodMotorOffPersistTimerCtr = 0; ///< Persistence timer counter for motor off check error condition. +static U32 errorBloodMotorSpeedPersistTimerCtr = 0; ///< Persistence timer counter for motor speed error condition. +static U32 errorBloodRotorSpeedPersistTimerCtr = 0; ///< Persistence timer counter for rotor speed error condition. +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 U32 bpCurrErrorDurationCtr = 0; ///< Used for tracking persistence of bp current errors +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 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 +267,7 @@ initPersistentAlarm( ALARM_ID_BLOOD_PUMP_MC_CURRENT_CHECK, 0, BP_MAX_CURR_ERROR_DURATION_MS ); 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 +462,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 +517,6 @@ // Publish blood flow data on interval publishBloodFlowData(); } -//ALARM_ID_HD_BP_FLOW_SENSOR_ERROR = 208, ///< HD blood flow sensor error /*********************************************************************//** * @brief