Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r8e93a6e39b2c7af5f0b47ef1272a2b53446fab0b -r3bafab778c613a1abd0c421128320408db407ef8 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 8e93a6e39b2c7af5f0b47ef1272a2b53446fab0b) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 3bafab778c613a1abd0c421128320408db407ef8) @@ -164,9 +164,13 @@ *************************************************************************/ U32 transitionToGenDialysateMode( void ) { + U32 initialD48PumpSpeed = 0U; + initGenDialysateMode(); setCurrentSubState( NO_SUB_STATE ); - calculateD48PumpSpeedForBCFill(); + //calculateD48PumpSpeedForBCFill(); + initialD48PumpSpeed = getCalculatedD48PumpSpeedForBCFill(); + setD48PumpSpeedForBCFill( initialD48PumpSpeed ); transitionToUltrafiltration(); return genDialysateState; @@ -514,8 +518,8 @@ /*********************************************************************//** * @brief * The setD48PumpSpeedForBCFill function sets the updated D48 pump speed. - * @details \b Inputs: none - * @details \b Outputs: d48PumpSpeed + * @details \b Inputs: d48PumpSpeed + * @details \b Outputs: none * @param pumpSpeed Dialysate pump speed * @return none. *************************************************************************/ @@ -585,17 +589,12 @@ * dialysate flow rate for continuous delivery of dialysate. * @details \b Inputs: Qd. * @details \b Outputs: D48 pump speed - * @return calculated initial D48 pump speed. + * @return calculated D48 pump speed. *************************************************************************/ -U32 calculateD48PumpSpeedForBCFill( void ) +U32 getCalculatedD48PumpSpeedForBCFill( void ) { - // Get the dialysate flow rate from TD - F32 dialFlowrate = getTDDialysateFlowrate(); - - // D48 Pump Speed = (1.24 * Qd ) + 30.0 - d48PumpSpeed = (U32)( ( PUMP_SPEED_SLOPE_FACTOR * dialFlowrate ) + PUMP_SPEED_INTERCEPT_FACTOR ); - - return d48PumpSpeed; + F32 dialFlowrate = getTDDialysateFlowrate(); + return (U32)( ( PUMP_SPEED_SLOPE_FACTOR * dialFlowrate ) + PUMP_SPEED_INTERCEPT_FACTOR ); } /*********************************************************************//** @@ -885,6 +884,8 @@ *************************************************************************/ void updateTreatmentSettings( void ) { + F32 initialPumpSpeed = 0.0F; + // Update any dynamic treatment parameter changes if ( TRUE == isTreatmentParamUpdated ) { @@ -904,8 +905,11 @@ signalUFRateUpdate(); //Update D48 pump speed - calculateD48PumpSpeedForBCFill(); + //calculateD48PumpSpeedForBCFill(); + initialPumpSpeed = getCalculatedD48PumpSpeedForBCFill(); + setD48PumpSpeedForBCFill( initialPumpSpeed ); + //reset the flag isTreatmentParamUpdated = FALSE; }