Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -r200dfbd12ee14a4dbe5ee1daaece7bfce9e8a104 -rae3a2d3b6952e59cdf469d48e9f4c26574564eff --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 200dfbd12ee14a4dbe5ee1daaece7bfce9e8a104) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision ae3a2d3b6952e59cdf469d48e9f4c26574564eff) @@ -1,26 +1,28 @@ /************************************************************************** * -* 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 ModeFault.c * -* @author (last) Vinayakam Mani -* @date (last) 05-Aug-2024 +* @author (last) Raghu Kallala +* @date (last) 22-Apr-2026 * * @author (original) Vinayakam Mani -* @date (original) 05-Aug-2024 +* @date (original) 07-Aug-2024 * ***************************************************************************/ +#include "BalancingChamber.h" #include "ConcentratePumps.h" #include "DialysatePumps.h" #include "Heaters.h" #include "ModeFault.h" #include "Messaging.h" #include "OperationModes.h" +#include "RinsePump.h" #include "SafetyShutdown.h" #include "Utilities.h" #include "Valves.h" @@ -74,6 +76,8 @@ { initFaultMode(); setCurrentSubState( NO_SUB_STATE ); + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); // Publish POST failure status to UI if fault triggered in Init/POST mode if ( DD_MODE_INIT == getPreviousOperationMode() ) { @@ -188,25 +192,19 @@ setValveStateDelayed( D40_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); setValveStateDelayed( D47_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); setValveStateDelayed( D3_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); - setValveStateDelayed( DD_M4_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); // De-energize Balancing chamber and Ultrafiltration valves for ( i = FIRST_BC_VALVE; i <= LAST_BC_VALVE; i++ ) { setValveStateDelayed( (DD_VALVES_T)i, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); } - // TODO: To be removed once HDD clean up is done - for ( i = FIRST_UF_VALVE; i <= FIRST_UF_VALVE; i++ ) - { - setValveStateDelayed( (DD_VALVES_T)i, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); - } - requestConcentratePumpOff( D11_PUMP, parkPumps ); requestConcentratePumpOff( D10_PUMP, parkPumps ); requestConcentratePumpOff( D76_PUMP, parkPumps ); signalDialysatePumpHardStop( D12_PUMP ); signalDialysatePumpHardStop( D48_PUMP ); + setRinsePumpState( RINSE_PUMP_STATE_OFF ); stopHeater( D5_HEAT ); stopHeater( D45_HEAT ); } @@ -223,8 +221,6 @@ *************************************************************************/ void deenergizeActuatorsWithDrainEnabled( BOOL parkPumps ) { - U32 i; - // Energize drain and spent balancing chamber valves to relieve the pressure. setValveState( D53_VALV, VALVE_STATE_OPEN ); setValveState( D23_VALV, VALVE_STATE_OPEN ); @@ -245,26 +241,19 @@ setValveStateDelayed( D40_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); setValveStateDelayed( D47_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); setValveStateDelayed( D3_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); - setValveStateDelayed( DD_M4_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); // De-energize portion of balancing chamber valves. setValveStateDelayed( D19_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); setValveStateDelayed( D20_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); setValveStateDelayed( D21_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); setValveStateDelayed( D22_VALV, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); - // TODO: To be removed once HDD clean up is done - // De-energize Ultrafiltration valves - for ( i = FIRST_UF_VALVE; i <= FIRST_UF_VALVE; i++ ) - { - setValveStateDelayed( (DD_VALVES_T)i, VALVE_STATE_CLOSED, DELAY_VALVE_MS ); - } - requestConcentratePumpOff( D11_PUMP, parkPumps ); requestConcentratePumpOff( D10_PUMP, parkPumps ); requestConcentratePumpOff( D76_PUMP, parkPumps ); signalDialysatePumpHardStop( D12_PUMP ); signalDialysatePumpHardStop( D48_PUMP ); + setRinsePumpState( RINSE_PUMP_STATE_OFF ); stopHeater( D5_HEAT ); stopHeater( D45_HEAT ); } @@ -395,4 +384,68 @@ return state; } + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/*********************************************************************//** + * @brief + * The testValidateDDFaultChangeReq function validate whether request + * operation sub mode is legal or not. + * @details \b Inputs: none + * @details \b Outputs: none + * @param newSubMode the enumerated sub state of the mode + * @return TRUE if request is legal, FALSE if not + *************************************************************************/ +BOOL testValidateDDFaultChangeReq( U32 newSubMode ) +{ + BOOL result = FALSE; + + if ( newSubMode < NUM_OF_DD_FAULT_STATES ) + { + switch ( newSubMode ) + { + case DD_FAULT_STATE_START: + case DD_FAULT_DEENERGIZED_STATE: + case DD_FAULT_ENERGIZED_STATE: + result = TRUE; + break; + + default: + break; + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testSignalNewDDFaultSubMode function request transition to a + * new operation sub mode. + * @details \b Inputs: none + * @details \b Outputs: faultState + * @param newSubMode the enumerated sub state of the mode + * @return none + *************************************************************************/ +void testSignalNewDDFaultSubMode( U32 newSubMode ) +{ + if ( newSubMode < NUM_OF_DD_FAULT_STATES ) + { + faultState = (DD_FAULT_STATE_T)newSubMode; + + switch ( newSubMode ) + { + // Any of these state require no special handling + case DD_FAULT_STATE_START: + case DD_FAULT_DEENERGIZED_STATE: + case DD_FAULT_ENERGIZED_STATE: + default: + break; + } + } +} + /**@}*/