Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -recd204503f9f4837800080a58c07dac8a2e8d602 -r9ac050d6099effbdd62070173d14dd5e225d5310 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision ecd204503f9f4837800080a58c07dac8a2e8d602) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 9ac050d6099effbdd62070173d14dd5e225d5310) @@ -22,6 +22,7 @@ #include "DryBiCart.h" #include "FpgaDD.h" #include "Heaters.h" +#include "Level.h" #include "ModeGenDialysate.h" #include "ModeStandby.h" #include "Messaging.h" @@ -105,7 +106,7 @@ static BOOL isBalChamberSwitchingOffRequested; ///< Flag indicating that a request was made to deactivate balancing chamber switching. //TODO: remove later once level sensor working -static U32 bicarbChamberPeriodicFillCounter; +static U32 bicarbChamberPeriodicFillCounter; // ********** private function prototypes ********** @@ -254,6 +255,8 @@ *************************************************************************/ U32 execBalancingChamberControl( void ) { + LVL_STATE_T bicarbChamberLevel = getBicarbChamberLevelStatus(); + updateBalChamberSwitchingPeriod(); // Increment counter indicating fill is in progress. @@ -262,6 +265,20 @@ if ( ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == TRUE ) && ( balChamberExecState > BAL_CHAMBER_STATE_IDLE ) ) { +#ifdef CONDUCTIVE_LEVEL_SENSOR_ENABLED + if ( LVL_STATE_LOW == bicarbChamberLevel ) + { + if ( getCurrentBalancingChamberExecState() > BAL_CHAMBER_STATE_IDLE ) + { + if ( FALSE == setBicarbChamberFillRequested() ) + { + // TODO + //drybicart state machines are combined and so this is not an issue in future + //set alarm ? + } + } + } +#else // time based chamber F fill // Increment counter for dry bicarb chamber fill bicarbChamberPeriodicFillCounter += 1; // Fill bicarb chamber once every 60secs. @@ -275,6 +292,7 @@ } bicarbChamberPeriodicFillCounter = 0; } +#endif } switch ( balChamberExecState ) @@ -539,7 +557,7 @@ freshDialPressure = getFilteredPressure( D18_PRES ); spentDialPressure = getFilteredPressure( D51_PRES ); - if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) == TRUE ) + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) ) { //Set Trimmer heater Target temp every BC cycle to catch up fresh dialysate temp setHeaterTargetTemperature( D45_HEAT, getFilteredTemperatureValue( D4_TEMP ) ); @@ -845,10 +863,11 @@ acidVolume = getF32OverrideValue( &acidDoseVolume ); bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); } + freshDialPressure = getFilteredPressure( D18_PRES ); spentDialPressure = getFilteredPressure( D51_PRES ); - if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) == TRUE ) + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) ) { //Set Trimmer heater Target temp every BC cycle to catch up fresh dialysate temp setHeaterTargetTemperature( D45_HEAT, getFilteredTemperatureValue( D4_TEMP ) ); @@ -1107,7 +1126,7 @@ // Check if a request made was to activate the balancing chamber switching. if ( TRUE == isBalChamberSwitchingOnRequested ) { - //Clear the request flag to indicate that the request was processed. + //Clear request was processed. isBalChamberSwitchingOnRequested = FALSE; // Set flag to indicate that balancing chamber switching is active @@ -1268,6 +1287,7 @@ d48SpeedPostRangeCheck = RANGE( spentDialPumpSpeed, minD48Speed, maxD48Speed ); + // Do not turn on the pump if the switching only is enabled in the standby mode. if ( FALSE == getBalChamberSwitchingOnlyStatus() ) {