Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -rc5586e0292b8e988e89a7304f63be32afcad1466 -ra06e2c94a2c49609972b28f7ccd0647baabdb9b1 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision c5586e0292b8e988e89a7304f63be32afcad1466) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision a06e2c94a2c49609972b28f7ccd0647baabdb9b1) @@ -150,7 +150,7 @@ CONCENTRATE_PUMP_DATA_T data; U08 const fpgaConcentratePumpsFault = getFPGAConcentratePumpsFault(); - if ( 0 != (U32)fpgaConcentratePumpsFault ) + if ( 0 != fpgaConcentratePumpsFault ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_CONCENTRATE_PUMP_FAULT, fpgaConcentratePumpsFault ); } Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -rda3fb953ff72fc65fc6c8c6b91fd833114cb7cbf -ra06e2c94a2c49609972b28f7ccd0647baabdb9b1 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision da3fb953ff72fc65fc6c8c6b91fd833114cb7cbf) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision a06e2c94a2c49609972b28f7ccd0647baabdb9b1) @@ -129,10 +129,13 @@ static U32 heatersOnWithNoFlowTimer; ///< Heaters are on but there is no sufficient flow. static TEMPERATURE_SENSORS_T primaryHeatersFeedbackTempSensor = TEMPSENSORS_OUTLET_PRIMARY_HEATER; ///< Primary heaters feedback temperature sensors. static TEMPERATURE_SENSORS_T trimmerHeaterFeedbackTempSensor = TEMPSENSORS_OUTLET_REDUNDANT; ///< Trimmer heater feedback temperature sensors. + +#ifndef IGNORE_HEATERS_MONITOR static U32 primaryHeatersInternalTempOutTimer = 0; ///< Primary heaters internal temperature out of range timer. static U32 trimmerHeaterInternalTempOutTimer = 0; ///< Trimmer heater internal temperature out of range timer. static BOOL isPrimaryHeatersTempOutOfRange = FALSE; ///< Boolean flag to indicate if the primary heaters internal temperature out of range. static BOOL isTrimmerHeaterTempOutOfRange = FALSE; ///< Boolean flag to indicate if the trimmer heater internal temperature out of range. +#endif static BOOL isFlowBelowMin = FALSE; ///< Boolean flag to indicate if the flow is below the minimum. // ********** private function prototypes ********** @@ -177,10 +180,13 @@ selfTestElapsedTime = 0; primaryHeatersFeedbackTempSensor = TEMPSENSORS_OUTLET_PRIMARY_HEATER; trimmerHeaterFeedbackTempSensor = TEMPSENSORS_OUTLET_REDUNDANT; + +#ifndef IGNORE_HEATERS_MONITOR primaryHeatersInternalTempOutTimer = 0; trimmerHeaterInternalTempOutTimer = 0; isPrimaryHeatersTempOutOfRange = FALSE; isTrimmerHeaterTempOutOfRange = FALSE; +#endif isFlowBelowMin = FALSE; // Initialize the PI controller for the primary heaters Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r28b5f2e7f757647145a82a39aca0a5f3652c68a1 -ra06e2c94a2c49609972b28f7ccd0647baabdb9b1 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 28b5f2e7f757647145a82a39aca0a5f3652c68a1) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision a06e2c94a2c49609972b28f7ccd0647baabdb9b1) @@ -153,7 +153,7 @@ * @details Inputs: roControlTimerCounter,roPumpOpenLoopTargetDutyCycle, * roPumpFlowRateRunningSum, roPumpPressureRunningSum, measuredFlowReadingsSum, * flowFilterCounter, flowVerificationCounter, roPumpState, roPumpControlMode - * roPumpDataPublicationTimerCounter, roPumpControlModeSet + * roPumpDataPublicationTimerCounter * @details Outputs: none * @return none *************************************************************************/ @@ -516,8 +516,7 @@ * @brief * The handleROPumpControlToTargetFlowState function handles the control to * target flow state of the RO pump controller state machine. - * @details Inputs: roPumpPWMDutyCyclePctSet, roControlTimerCounter, - * roPumpControlModeSet + * @details Inputs: roPumpPWMDutyCyclePctSet, roControlTimerCounter * @details Outputs: roPumpPWMDutyCyclePctSet, roControlTimerCounter * @return next state of the controller state machine *************************************************************************/ @@ -554,8 +553,7 @@ * @brief * The handleROPumpControlToMaxPressureState function handles the control * to max pressure state of the RO pump controller state machine. - * @details Inputs: roPumpPWMDutyCyclePctSet, roControlTimerCounter, - * roPumpControlModeSet + * @details Inputs: roPumpPWMDutyCyclePctSet, roControlTimerCounter * @details Outputs: roPumpPWMDutyCyclePctSet, roControlTimerCounter * @return next state of the controller state machine *************************************************************************/ Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r9c3746ecf75ef64d6fc0e0e9510af9d84763cb18 -ra06e2c94a2c49609972b28f7ccd0647baabdb9b1 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 9c3746ecf75ef64d6fc0e0e9510af9d84763cb18) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision a06e2c94a2c49609972b28f7ccd0647baabdb9b1) @@ -83,6 +83,7 @@ static DG_FILL_MODE_STATE_T handleAcidPumpCheckState( void ); static DG_FILL_MODE_STATE_T handleDialysateProductionState( void ); static DG_FILL_MODE_STATE_T handleDeliverDialysateState( void ); +static DG_FILL_MODE_STATE_T handlePausedState( void ); static void handleDialysateMixing( void ); @@ -183,6 +184,10 @@ fillState = handleDeliverDialysateState(); break; + case DG_FILL_MODE_STATE_PAUSED: + fillState = handlePausedState(); + break; + default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_FILL_MODE_INVALID_EXEC_STATE, fillState ) fillState = DG_FILL_MODE_STATE_START; @@ -363,7 +368,7 @@ * @brief * The handleDialysateProductionState function executes the dialysate production * state of the fill mode state machine. - * @details Inputs: none + * @details Inputs: Dialysate conditions * @details Outputs: none * @return the next state *************************************************************************/ @@ -381,14 +386,47 @@ result = DG_FILL_MODE_STATE_DELIVER_DIALYSATE; } + if ( checkDialysateConductivity() != TRUE ) + { + if ( ( TRUE == isAlarmActive( ALARM_ID_ACID_CONDUCTIVITY_OUT_OF_RANGE ) ) || + ( TRUE == isAlarmActive( ALARM_ID_DIALYSATE_CONDUCTIVITY_OUT_OF_RANGE ) ) ) + { + result = DG_FILL_MODE_STATE_PAUSED; + } + } + return result; } /*********************************************************************//** * @brief + * The handlePausedState function executes the paused state of the fill + * mode state machine. + * @details Inputs: Dialysate conditions + * @details Outputs: none + * @return the next state + *************************************************************************/ +static DG_FILL_MODE_STATE_T handlePausedState( void ) +{ + DG_FILL_MODE_STATE_T result = DG_FILL_MODE_STATE_PAUSED; + + if ( TRUE == checkDialysateConductivity() ) + { + if ( ( isAlarmActive( ALARM_ID_ACID_CONDUCTIVITY_OUT_OF_RANGE ) != TRUE ) && + ( isAlarmActive( ALARM_ID_DIALYSATE_CONDUCTIVITY_OUT_OF_RANGE ) ) != TRUE ) + { + result = DG_FILL_MODE_STATE_CHECK_INLET_WATER; + } + } + + return result; +} + +/*********************************************************************//** + * @brief * The handleDeliverDialysateState function executes the deliver dialysate * state of the fill mode state machine. - * @details Inputs: none + * @details Inputs: Dialysate conditions * @details Outputs: Deliver dialysate * @return the next state *************************************************************************/ @@ -412,7 +450,7 @@ #endif } - if ( getReservoirWeight( inactiveReservoir ) >= ONE_LITER_WEIGHT_GRAMS ) + if ( ( getReservoirWeight( inactiveReservoir ) - reservoirBaseWeight ) >= ONE_LITER_WEIGHT_GRAMS ) { avgDialysateConductivity = dialysateConductivityTotal / dialysateConductivitySampleCount;