Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r6679a2cd813b21a8cb4c58b3eeb721e0eef9a10b -r313982ccc772f1bbe182877dff7e00381b04e0f4 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 6679a2cd813b21a8cb4c58b3eeb721e0eef9a10b) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 313982ccc772f1bbe182877dff7e00381b04e0f4) @@ -15,6 +15,7 @@ * ***************************************************************************/ +#include "BalancingChamber.h" #include "ConcentratePumps.h" #include "ConductivitySensors.h" #include "Heaters.h" @@ -43,6 +44,7 @@ static DD_STANDBY_MODE_STATE_T standbyState; ///< Currently active standby state. static OVERRIDE_U32_T pendingStartDDRequest; ///< Flag indicating TD has requested DD start the dialysis delivery(Overridable). +static BOOL pendingBalanceChamberSwOnlyRequest; ///< Flag indicating balancing chamber switch only request. //static BOOL pendingStartDDFlushRequest; ///< Flag indicating TD has requested DD start flush. //static BOOL pendingStartDDHeatDisinfectRequest; ///< Flag indicating TD has requested DD start heat disinfect. //static BOOL pendingStartDDHeatDisinfectActiveCoolRequest; ///< Flag indicating TD has requested DD start heat disinfect active cool. @@ -67,6 +69,7 @@ pendingStartDDRequest.ovData = FALSE; pendingStartDDRequest.ovInitData = FALSE; pendingStartDDRequest.override = OVERRIDE_RESET; + pendingBalanceChamberSwOnlyRequest = FALSE; // pendingStartDDFlushRequest = FALSE; // pendingStartDDHeatDisinfectRequest = FALSE; // pendingStartDDHeatDisinfectActiveCoolRequest = FALSE; @@ -92,8 +95,8 @@ // // Upon transition to mode standby set CD1 and CD2 calibration records to be picked to the normal // // table. If the chemical disinfect fails, the mode transitions back to mode standby. -// setCondcutivitySensorCalTable( CONDUCTIVITYSENSORS_CD1_SENSOR, CAL_DATA_CD1_COND_SENSOR ); -// setCondcutivitySensorCalTable( CONDUCTIVITYSENSORS_CD2_SENSOR, CAL_DATA_CD2_COND_SENSOR ); +// setCondcutivitySensorCalTable( D17_COND, CAL_DATA_CD1_COND_SENSOR ); +// setCondcutivitySensorCalTable( D27_COND, CAL_DATA_CD2_COND_SENSOR ); // // // Send DD usage data to TD @@ -153,8 +156,9 @@ { BOOL status = FALSE; + //TODO: testing - Comment water pressure check // Check Inlet Water Pressure - both Water inlet pressure Input, pressure Output after pressure regulator. - checkInletWaterPressure(); + // checkInletWaterPressure(); // Check any active alarms status |= isAlarmActive( ALARM_ID_DD_INLET_WATER_PRESSURE_OUT_LOW_RANGE ); @@ -183,17 +187,26 @@ { DD_STANDBY_MODE_STATE_T state = DD_STANDBY_MODE_STATE_IDLE; + //TODO : Testing - commenting solo mode for now + // go to standby solo mode if TD is turned off or stops communicating. - if ( FALSE == isTDCommunicating() ) - { // TODO if TD comm loss, do we need solo standby? - SEND_EVENT_WITH_2_U32_DATA( DD_EVENT_TD_COMMUNICATION_LOSS, 0, 0 ) - //requestNewOperationMode( DD_MODE_SOLO ); - } - else if ( TRUE == getU32OverrideValue( &pendingStartDDRequest ) ) +// if ( FALSE == isTDCommunicating() ) +// { // TODO if TD comm loss, do we need solo standby? +// SEND_EVENT_WITH_2_U32_DATA( DD_EVENT_TD_COMMUNICATION_LOSS, 0, 0 ) +// //requestNewOperationMode( DD_MODE_SOLO ); +// } +// else if ( TRUE == getU32OverrideValue( &pendingStartDDRequest ) ) + + if ( TRUE == getU32OverrideValue( &pendingStartDDRequest ) ) { pendingStartDDRequest.data = FALSE; requestNewOperationMode( DD_MODE_GEND ); } + //Test request to handle only balancing chamber switching + else if ( TRUE == pendingBalanceChamberSwOnlyRequest ) + { + execBalancingChamberControl(); + } // else if ( TRUE == pendingStartDDFlushRequest ) // { // pendingStartDDFlushRequest = FALSE; @@ -260,6 +273,42 @@ /*********************************************************************//** * @brief + * The requestBCSwitchingOnlyStart function handles Balancing chamber switching + * only start request. + * @details \b Inputs: standbyState + * @details \b Outputs: pendingBalanceChamberSwOnlyRequest + * @return TRUE if request accepted, FALSE if not. + *************************************************************************/ +BOOL requestBCSwitchingOnlyStart( void ) +{ + BOOL result = FALSE; + + if ( DD_STANDBY_MODE_STATE_IDLE == standbyState ) + { + result = TRUE; + pendingBalanceChamberSwOnlyRequest = TRUE; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The requestBCSwitchingOnlyStop function handles Balancing chamber switching + * only stop request. + * @details \b Inputs: standbyState + * @details \b Outputs: pendingBalanceChamberSwOnlyRequest + * @return none. + *************************************************************************/ +void requestBCSwitchingOnlyStop( void ) +{ + pendingBalanceChamberSwOnlyRequest = FALSE; + // Close all balancing chamber valves + valveControlForBCClosedState(); +} + +/*********************************************************************//** + * @brief * The startDDFlush function starts DD flush mode. * @details \b Inputs: standbyState * @details \b Outputs: none