Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r67731d57db9a620418b3b848d8f75ff204902c36 -reb01b53404b6d701dd413c08f2c7a54f8422732e --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 67731d57db9a620418b3b848d8f75ff204902c36) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision eb01b53404b6d701dd413c08f2c7a54f8422732e) @@ -1,30 +1,33 @@ /************************************************************************** * -* Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. +* Copyright (c) 2024-2026 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file ModeStandby.c * -* @author (last) Vinayakam Mani -* @date (last) 06-Aug-2024 +* @author (last) Sameer Kalliadan Poyil +* @date (last) 24-Feb-2026 * * @author (original) Vinayakam Mani -* @date (original) 06-Aug-2024 +* @date (original) 07-Aug-2024 * ***************************************************************************/ #include "BalancingChamber.h" #include "ConcentratePumps.h" #include "ConductivitySensors.h" +#include "FPOperationModes.h" #include "Heaters.h" #include "ModeFault.h" #include "ModeStandby.h" +#include "ModeGenDialysate.h" #include "MessageSupport.h" #include "Messaging.h" //#include "NVDataMgmt.h" #include "OperationModes.h" +#include "PermeateTank.h" #include "Pressure.h" #include "SystemCommDD.h" #include "TaskGeneral.h" @@ -44,7 +47,6 @@ static DD_STANDBY_MODE_STATE_T standbyState; ///< Currently active standby state. static BOOL pendingStartDDPreGenRequest; ///< Flag indicating TD has requested DD start the pre generation dialysate request. -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. @@ -66,7 +68,6 @@ { standbyState = DD_STANDBY_MODE_STATE_IDLE; pendingStartDDPreGenRequest = FALSE; - pendingBalanceChamberSwOnlyRequest = FALSE; // pendingStartDDFlushRequest = FALSE; // pendingStartDDHeatDisinfectRequest = FALSE; // pendingStartDDHeatDisinfectActiveCoolRequest = FALSE; @@ -90,6 +91,11 @@ deenergizeActuators( PARK_CONC_PUMPS ); + resetPermeateTank(); + + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); + // // 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( D17_COND, CAL_DATA_CD1_COND_SENSOR ); @@ -153,6 +159,7 @@ static DD_STANDBY_MODE_STATE_T handleStandbyIdleState( void ) { DD_STANDBY_MODE_STATE_T state = DD_STANDBY_MODE_STATE_IDLE; + FP_OP_MODE_T fpMode = getCurrentFPOperationMode(); //TODO : Define comm loss alarm when TD is turned off or stops communicating // if ( FALSE == isTDCommunicating() ) @@ -161,14 +168,18 @@ // } if ( TRUE == pendingStartDDPreGenRequest ) { - pendingStartDDPreGenRequest = FALSE; - requestNewOperationMode( DD_MODE_PREG ); + // wait for IOFP GENP mode and when IOFP manual control is not set + if ( ( FP_MODE_GENP == fpMode ) && ( getTestConfigStatus( TEST_CONFIG_DD_RUN_SOLO ) == FALSE ) ) + { + pendingStartDDPreGenRequest = FALSE; + requestNewOperationMode( DD_MODE_PREG ); + } + else if ( getTestConfigStatus( TEST_CONFIG_DD_RUN_SOLO ) == TRUE ) + { + pendingStartDDPreGenRequest = FALSE; + requestNewOperationMode( DD_MODE_PREG ); + } } - //Test request to handle only balancing chamber switching - else if ( TRUE == pendingBalanceChamberSwOnlyRequest ) - { - execBalancingChamberControl(); - } // else if ( TRUE == pendingStartDDFlushRequest ) // { // pendingStartDDFlushRequest = FALSE; @@ -234,7 +245,7 @@ * The requestBCSwitchingOnlyStart function handles Balancing chamber switching * only start request. * @details \b Inputs: standbyState - * @details \b Outputs: pendingBalanceChamberSwOnlyRequest + * @details \b Outputs: none * @return TRUE if request accepted, FALSE if not. *************************************************************************/ BOOL requestBCSwitchingOnlyStart( void ) @@ -244,7 +255,9 @@ if ( DD_STANDBY_MODE_STATE_IDLE == standbyState ) { result = TRUE; - pendingBalanceChamberSwOnlyRequest = TRUE; + + // Activate Balancing Chamber Switching + requestBalChamberSwitching( TRUE ); } return result; @@ -255,12 +268,14 @@ * The requestBCSwitchingOnlyStop function handles Balancing chamber switching * only stop request. * @details \b Inputs: standbyState - * @details \b Outputs: pendingBalanceChamberSwOnlyRequest + * @details \b Outputs: none * @return none. *************************************************************************/ void requestBCSwitchingOnlyStop( void ) { - pendingBalanceChamberSwOnlyRequest = FALSE; + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); + // Close all balancing chamber valves valveControlForBCClosedState(); }