Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r111fe0afb67db6224c7717de82fd7c1844bc6748 -rdedf0cbae7f010d314c430f06834114213e18f2c --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 111fe0afb67db6224c7717de82fd7c1844bc6748) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision dedf0cbae7f010d314c430f06834114213e18f2c) @@ -73,6 +73,8 @@ #define DATA_PUBLISH_COUNTER_START_COUNT 0 ///< Data publish counter start count. +#define ZERO_REVOLUTION_COUNT 0 ///< Revolution count reached to Zero. + #define CONCENTRATE_PUMP_FAULT_PERSISTENCE_PERIOD 500 ///< Concentrate pump fault persistence period in milliseconds. #define CONCENTRATE_PUMP_TRANS_TO_RAMP_SPEED_THRESHOLD_MLPM 20.0F ///< Concentrate pump transition to ramp to target speed threshold in mL/min. @@ -98,7 +100,6 @@ CONCENTRATE_PUMP_CONTROL_REVERSE_DIR | CONCENTRATE_PUMP_CONTROL_EIGHTH_STEP; ///< Concentrate pump control reverse. - /// Enumeration of concentrate pump states. typedef enum ConcentratePumpState { @@ -665,7 +666,7 @@ *************************************************************************/ U16 getConcPumpTargetRevolutionCount( CONCENTRATE_PUMPS_T pumpId ) { - BOOL result = FALSE; + U16 result = 0; if ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) { @@ -681,6 +682,28 @@ /*********************************************************************//** * @brief + * The IsConcentratePumpDosingCompleted function gets the concentrate pump + * dosing completion status. + * @details \b Inputs: execState + * @details \b Outputs: none + * @return true when dosing completed,otherwise false. + *************************************************************************/ +BOOL IsConcentratePumpDosingCompleted( void ) +{ + BOOL result = FALSE; + + // Check doisng completed status + if ( ( concentratePumps[D11_PUMP].execState == CONCENTRATE_PUMP_OFF_STATE ) && + ( concentratePumps[D10_PUMP].execState == CONCENTRATE_PUMP_OFF_STATE ) ) + { + result = TRUE; + } + + return result; +} + +/*********************************************************************//** + * @brief * The getConcPumpCurrentMeasuredRevolutionCount function gets the concentrate pump * current measured revolution count. * @details \b Inputs: pumpMesauredRevCnt @@ -869,7 +892,8 @@ } //Stop the pump if measured rev count reaches zero - if ( FALSE == concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested ) + if ( ( FALSE == concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested ) || + ( ZERO_REVOLUTION_COUNT == getConcPumpCurrentMeasuredRevolutionCount( pumpId ) ) ) { state = CONCENTRATE_PUMP_OFF_STATE; stopConcentratePump( pumpId ); @@ -909,7 +933,8 @@ } //Stop the pump if measured rev count reaches zero - if ( FALSE == concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested ) + if ( ( FALSE == concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested ) || + ( ZERO_REVOLUTION_COUNT == getConcPumpCurrentMeasuredRevolutionCount( pumpId ) ) ) { state = CONCENTRATE_PUMP_OFF_STATE; stopConcentratePump( pumpId ); Index: firmware/App/Controllers/ConcentratePumps.h =================================================================== diff -u -rf49295a21525d5d1b88ec52eb4fcac72e7a526b7 -rdedf0cbae7f010d314c430f06834114213e18f2c --- firmware/App/Controllers/ConcentratePumps.h (.../ConcentratePumps.h) (revision f49295a21525d5d1b88ec52eb4fcac72e7a526b7) +++ firmware/App/Controllers/ConcentratePumps.h (.../ConcentratePumps.h) (revision dedf0cbae7f010d314c430f06834114213e18f2c) @@ -90,6 +90,7 @@ U16 getConcPumpCurrentMeasuredRevolutionCount( CONCENTRATE_PUMPS_T pumpId ); BOOL handleConcentratePumpParkRequest( void ); BOOL isConcPumpParkInProgress( CONCENTRATE_PUMPS_T pumpId ); +BOOL IsConcentratePumpDosingCompleted( void ); BOOL testConcentratePumpDataPublishIntervalOverride( MESSAGE_T *message ); BOOL testConcentratePumpTargetSpeedOverride( MESSAGE_T *message ); Index: firmware/App/Drivers/BalancingChamber.c =================================================================== diff -u -r8c235d1df76e4d1ab6e6272e5bd535cfa07b513c -rdedf0cbae7f010d314c430f06834114213e18f2c --- firmware/App/Drivers/BalancingChamber.c (.../BalancingChamber.c) (revision 8c235d1df76e4d1ab6e6272e5bd535cfa07b513c) +++ firmware/App/Drivers/BalancingChamber.c (.../BalancingChamber.c) (revision dedf0cbae7f010d314c430f06834114213e18f2c) @@ -352,6 +352,16 @@ // Update fill status flag to true isBalChamberFillInProgress = TRUE; + // Deliver dosing during generate dialysate mode + if ( FALSE == getBalChamberSwitchingOnlyStatus() ) + { + // start acid and bicarb pump with the expected quantity + setConcentratePumpTargetSpeed( D11_PUMP, CONCENTRATE_PUMP_MAX_SPEED, TEST_ACID_VOLUME_ML ); + setConcentratePumpTargetSpeed( D10_PUMP, CONCENTRATE_PUMP_MAX_SPEED, TEST_BICARB_VOLUME_ML ); + requestConcentratePumpOn( D11_PUMP ); + requestConcentratePumpOn( D10_PUMP ); + } + state = BAL_CHAMBER_STATE1_BICARB_ACID_DOSING_CNTRL; } else @@ -375,26 +385,19 @@ { BAL_CHAMBER_EXEC_STATE_T state; - // Deliver dosing during generate dialysate mode - if ( FALSE == getBalChamberSwitchingOnlyStatus() ) + // On dosing completion, transition to next state based on the current switching state + if ( TRUE == IsConcentratePumpDosingCompleted() ) { - // start acid and bicarb pump with the expected quantity - setConcentratePumpTargetSpeed( D11_PUMP, CONCENTRATE_PUMP_MAX_SPEED, TEST_ACID_VOLUME_ML ); - setConcentratePumpTargetSpeed( D10_PUMP, CONCENTRATE_PUMP_MAX_SPEED, TEST_BICARB_VOLUME_ML ); - requestConcentratePumpOn( D11_PUMP ); - requestConcentratePumpOn( D10_PUMP ); + if ( BAL_CHAMBER_SW_STATE1 == balChamberSWState ) + { + state = BAL_CHAMBER_STATE1_FILL_END; + } + else + { + state = BAL_CHAMBER_STATE2_FILL_END; + } } - // On triggering of dosing, transition to next state based on the current switching state - if ( BAL_CHAMBER_SW_STATE1 == balChamberSWState ) - { - state = BAL_CHAMBER_STATE1_FILL_END; - } - else - { - state = BAL_CHAMBER_STATE2_FILL_END; - } - return state; } @@ -421,7 +424,6 @@ // ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) ) { // stabilized pressure indicating fill is complete - //TODO : due to pressure testing override, comment the code below for now isPressureStalbilizedDuringFill = TRUE; // isPressureStalbilizedDuringFill = FALSE; } @@ -432,10 +434,6 @@ { // close the state 1 opened valves valveControlForBCState1FillEnd(); - - //Stop the concentrate pumps - requestConcentratePumpOff( D11_PUMP, NO_PARK_CONC_PUMPS ); - requestConcentratePumpOff( D10_PUMP, NO_PARK_CONC_PUMPS ); } // On completion of cycle time, transition to next state @@ -493,6 +491,16 @@ // Update fill status flag to true isBalChamberFillInProgress = TRUE; + // Deliver dosing during generate dialysate mode + if ( FALSE == getBalChamberSwitchingOnlyStatus() ) + { + // start acid and bicarb pump with the expected quantity + setConcentratePumpTargetSpeed( D11_PUMP, CONCENTRATE_PUMP_MAX_SPEED, TEST_ACID_VOLUME_ML ); + setConcentratePumpTargetSpeed( D10_PUMP, CONCENTRATE_PUMP_MAX_SPEED, TEST_BICARB_VOLUME_ML ); + requestConcentratePumpOn( D11_PUMP ); + requestConcentratePumpOn( D10_PUMP ); + } + state = BAL_CHAMBER_STATE2_BICARB_ACID_DOSING_CNTRL; } else @@ -526,7 +534,6 @@ // ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) ) { // stabilized pressure indicating fill is complete - //TODO : due to pressure testing override, comment the code below for now isPressureStalbilizedDuringFill = TRUE; //isPressureStalbilizedDuringFill = FALSE; } @@ -537,10 +544,6 @@ { // close the valves valveControlForBCState2FillEnd(); - - //Stop the concentrate pumps - requestConcentratePumpOff( D11_PUMP, NO_PARK_CONC_PUMPS ); - requestConcentratePumpOff( D10_PUMP, NO_PARK_CONC_PUMPS ); } // On completion of cycle time, transition to next state