Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r231a5fce9136a603a9316ead3df7951068b5f65f -r0798ef0a54e4ddaa551ced7b2bd9b032aa458095 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 231a5fce9136a603a9316ead3df7951068b5f65f) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 0798ef0a54e4ddaa551ced7b2bd9b032aa458095) @@ -110,12 +110,15 @@ #define FLOW_SIG_STRGTH_ALARM_PERSIST ( 5 * MS_PER_SECOND ) #define MIN_FLOW_SIG_STRENGTH 0.9 ///< Minimum flow sensor signal strength (90%). -/// Blood flow read timeout alarm persistence. +/// Blood flow fast read timeout alarm persistence. #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 ) #define DFM_SENSOR_CONNECTED_STATUS 0x02 ///< Blood flow meter connected status. -#define BFM_SENSOR_PARAM_CORRUPT_STATUS 0x07 ///< Blood flow meter NVM parameter status. +#define BFM_SENSOR_PARAM_CORRUPT_STATUS 0x07 ///< Blood flow meter NVM parameter status. + +#define PUMP_DIR_ERROR_COUNT_MASK 0x3F ///< Bit mask for pump direction error counter. /// Enumeration of blood pump controller states. typedef enum BloodPump_States @@ -197,6 +200,7 @@ 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 // ********** private function prototypes ********** @@ -1057,7 +1061,15 @@ if ( BLOOD_PUMP_CONTROL_TO_TARGET_STATE == bloodPumpState ) { MOTOR_DIR_T bpMCDir, bpDir; + U08 dirErrorCnt = getFPGABloodPumpHallSensorStatus() & PUMP_DIR_ERROR_COUNT_MASK; + // Check pump direction error count + if ( lastBloodPumpDirectionCount != dirErrorCnt ) + { + lastBloodPumpDirectionCount = dirErrorCnt; + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, (U32)HD_PUMP_BLOOD_PUMP ) + } + bpMCDir = ( getMeasuredBloodPumpMCSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); bpDir = ( getMeasuredBloodPumpSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); 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 ); Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r6fcdec8a308be986e5a64b4222918e718622a19d -r0798ef0a54e4ddaa551ced7b2bd9b032aa458095 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 6fcdec8a308be986e5a64b4222918e718622a19d) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 0798ef0a54e4ddaa551ced7b2bd9b032aa458095) @@ -102,6 +102,8 @@ /// Macro converts a flow rate to an estimated PWM duty cycle %. #define DOP_PWM_FROM_ML_PER_MIN(rate) ( (rate) * DOP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * DOP_GEAR_RATIO * DOP_MOTOR_RPM_TO_PWM_DC_FACTOR + DOP_PWM_ZERO_OFFSET ) +#define PUMP_DIR_ERROR_COUNT_MASK 0x3F ///< Bit mask for pump direction error counter. + /// Enumeration of dialysate outlet pump controller states. typedef enum DialOutPump_States { @@ -169,6 +171,8 @@ static DIAL_OUT_PUMP_SELF_TEST_STATE_T dialOutPumpSelfTestState = DIAL_OUT_PUMP_SELF_TEST_STATE_START; ///< Current state of the dialysate outlet pump self-test state machine. static U32 dialOutPumpSelfTestTimerCount = 0; ///< Timer counter for time reference during self-test. +static U08 lastDialOutPumpDirectionCount = 0; ///< Previous pump direction error count reported by FPGA + // ********** private function prototypes ********** static DIAL_OUT_PUMP_STATE_T handleDialOutPumpOffState( void ); @@ -790,7 +794,15 @@ if ( DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE == dialOutPumpState ) { MOTOR_DIR_T dopMCDir, dopDir; + U08 dirErrorCnt = getFPGADialOutPumpHallSensorStatus() & PUMP_DIR_ERROR_COUNT_MASK; + // Check pump direction error count + if ( lastDialOutPumpDirectionCount != dirErrorCnt ) + { + lastDialOutPumpDirectionCount = dirErrorCnt; + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, (U32)HD_PUMP_DIALYSATE_OUTLET_PUMP ) + } + dopMCDir = ( getMeasuredDialOutPumpMCSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); dopDir = ( getMeasuredDialOutPumpSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); Index: firmware/App/HDCommon.h =================================================================== diff -u -r3533955f242cec0505e8826e0e2d96f7b79ad499 -r0798ef0a54e4ddaa551ced7b2bd9b032aa458095 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 3533955f242cec0505e8826e0e2d96f7b79ad499) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 0798ef0a54e4ddaa551ced7b2bd9b032aa458095) @@ -75,6 +75,7 @@ #define SKIP_AIR_BUBBLE_CHECK 1 // Skip air bubble detector self-test. #define DISABLE_OCCLUSION_SELF_TEST 1 // Skip occlusion sensor self-test. #define DISABLE_FPGA_COUNTER_CHECKS 1 // Disable alarms associated with FPGA read/error counters +// #define ALLOW_1_MIN_TREATMENT_DURATION 1 // Allow user to change treatment duration to as low as 1 minute #include #include Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -rb5accb82ac043938255883b6c60a6f81795569b0 -r0798ef0a54e4ddaa551ced7b2bd9b032aa458095 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision b5accb82ac043938255883b6c60a6f81795569b0) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 0798ef0a54e4ddaa551ced7b2bd9b032aa458095) @@ -44,7 +44,11 @@ // ********** private definitions ********** #define MAX_TREATMENT_TIME_MINUTES ( 8 * MIN_PER_HOUR ) ///< Maximum treatment time (in minutes). +#ifndef ALLOW_1_MIN_TREATMENT_DURATION #define MIN_TREATMENT_TIME_MINUTES ( 1 * MIN_PER_HOUR ) ///< Minimum treatment time (in minutes). +#else +#define MIN_TREATMENT_TIME_MINUTES ( 1 ) ///< Minimum treatment time (in minutes). +#endif #define MAX_DIALYSATE_VOLUME_ML ( 150 * ML_PER_LITER ) ///< Maximum dialysate volume (in mL). #define USER_CONFIRM_CHANGE_TIMEOUT_MS ( 60 * MS_PER_SECOND ) ///< Require user to confirm UF volume change within this time. Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r9c0470dd725f1399b558f2eaf91f0275c5e021f1 -r0798ef0a54e4ddaa551ced7b2bd9b032aa458095 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 9c0470dd725f1399b558f2eaf91f0275c5e021f1) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 0798ef0a54e4ddaa551ced7b2bd9b032aa458095) @@ -1319,9 +1319,9 @@ * @brief * The getFPGABloodPumpHallSensorStatus function gets the latest blood pump * hall sensor status. - * Bit 0 - Derived direction of the blood pump motor (0=Fwd, 1=Rev) - * Bit 1 - A direction error was detected in the current hall sensor phase - * Bit 2 - A direction error was detected since the last read of this register + * Bit 7 - Derived direction of the blood pump motor (0=Fwd, 1=Rev) + * Bit 6 - Unused + * Bit 5-0 - Direction error count since power-up (rolls over) * @details Inputs: fpgaSensorReadings * @details Outputs: none * @return last blood pump hall sensor status reading. @@ -1351,9 +1351,9 @@ * @brief * The getFPGADialInPumpHallSensorStatus function gets the latest dialysate inlet pump * hall sensor status. - * Bit 0 - Derived direction of the dialyste inlet pump motor (0=Fwd, 1=Rev) - * Bit 1 - A direction error was detected in the current hall sensor phase - * Bit 2 - A direction error was detected since the last read of this register + * Bit 7 - Derived direction of the dialysate inlet pump motor (0=Fwd, 1=Rev) + * Bit 6 - Unused + * Bit 5-0 - Direction error count since power-up (rolls over) * @details Inputs: fpgaSensorReadings * @details Outputs: none * @return last dialysate inlet pump hall sensor status reading. @@ -1383,9 +1383,9 @@ * @brief * The getFPGADialOutPumpHallSensorStatus function gets the latest dialysate outlet pump * hall sensor status. - * Bit 0 - Derived direction of the dialysate outlet pump motor (0=Fwd, 1=Rev) - * Bit 1 - A direction error was detected in the current hall sensor phase - * Bit 2 - A direction error was detected since the last read of this register + * Bit 7 - Derived direction of the dialysate outlet pump motor (0=Fwd, 1=Rev) + * Bit 6 - Unused + * Bit 5-0 - Direction error count since power-up (rolls over) * @details Inputs: fpgaSensorReadings * @details Outputs: none * @return last dialysate outlet pump hall sensor status reading.