Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r231a5fce9136a603a9316ead3df7951068b5f65f -r0798ef0a54e4ddaa551ced7b2bd9b032aa458095 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 231a5fce9136a603a9316ead3df7951068b5f65f) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 0798ef0a54e4ddaa551ced7b2bd9b032aa458095) @@ -112,13 +112,16 @@ #define FLOW_SIG_STRGTH_ALARM_PERSIST ( 5 * MS_PER_SECOND ) #define MIN_FLOW_SIG_STRENGTH 0.9 ///< Minimum flow sensor signal strength (90%). -/// Dialysate flow read timeout alarm persistence. +/// Dialysate flow fast read timeout alarm persistence. #define DIALYSATE_FLOW_FAST_READ_TO_PERSIST 100 +/// Dialysate flow slow read timeout alarm persistence. #define DIALYSATE_FLOW_SLOW_READ_TO_PERSIST ( MS_PER_SECOND * 3 ) #define DFM_SENSOR_CONNECTED_STATUS 0x02 ///< Dialysate flow meter connected status. #define DFM_SENSOR_PARAM_CORRUPT_STATUS 0x07 ///< Dialysate flow meter NVM parameter corrupt status. +#define PUMP_DIR_ERROR_COUNT_MASK 0x3F ///< Bit mask for pump direction error counter. + /// Enumeration of dialysate inlet pump states. typedef enum DialInPump_States { @@ -196,6 +199,7 @@ static U08 lastDialysateFlowFastPacketReadCtr = 0; ///< Previous read counter for the dialysate flow fast packets static U08 lastDialysateFlowSlowPacketReadCtr = 0; ///< Previous read counter for the dialysate flow slow packets +static U08 lastDialInPumpDirectionCount = 0; ///< Previous pump direction error count reported by FPGA // ********** private function prototypes ********** @@ -1016,7 +1020,15 @@ if ( DIAL_IN_PUMP_CONTROL_TO_TARGET_STATE == dialInPumpState ) { MOTOR_DIR_T dipMCDir, dipDir; + U08 dirErrorCnt = getFPGADialInPumpHallSensorStatus() & PUMP_DIR_ERROR_COUNT_MASK; + // Check pump direction error count + if ( lastDialInPumpDirectionCount != dirErrorCnt ) + { + lastDialInPumpDirectionCount = dirErrorCnt; + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, (U32)HD_PUMP_DIALYSATE_INLET_PUMP ) + } + dipMCDir = ( getMeasuredDialInPumpMCSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); dipDir = ( getMeasuredDialInPumpSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE );