Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r94789b2f2324d5901685b6ff7b6224d4af3a0276 -r6d4aa77e6b85aa7621a234660f631e725fb1d441 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 94789b2f2324d5901685b6ff7b6224d4af3a0276) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 6d4aa77e6b85aa7621a234660f631e725fb1d441) @@ -7,8 +7,8 @@ * * @file ModeGenDialysate.c * -* @author (last) Vinayakam Mani -* @date (last) 14-Apr-2026 +* @author (last) Raghu Kallala +* @date (last) 22-Apr-2026 * * @author (original) Vinayakam Mani * @date (original) 06-Nov-2024 @@ -1302,4 +1302,84 @@ return result; } +/*********************************************************************//** + * @brief + * The testValidateDDGenDialysateChangeReq 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 testValidateDDGenDialysateChangeReq( U32 newSubMode ) +{ + BOOL result = FALSE; + + if ( newSubMode < NUM_OF_DD_GEND_MODE_STATES ) + { + switch ( newSubMode ) + { + // TODO add validate condition after checking with Vinay + case DD_GEND_STATE_START: + case DD_GEND_DIALYSATE_BYPASS_STATE: + case DD_GEND_DIALYSATE_DELIVERY_STATE: + case DD_GEND_SPENT_CHAMBER_FILL_STATE: + result = TRUE; + break; + + case DD_GEND_ISOLATED_UF_STATE: + case DD_GEND_BICARB_CHAMBER_FILL_STATE: + case DD_GEND_DIALYSATE_DELIVERY_PAUSE: + default: + break; + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testSignalNewDDGenDialysateSubMode function request transition + * to a new operation sub mode. + * @details \b Inputs: none + * @details \b Outputs: genDialysateState + * @param newSubMode the enumerated sub state of the mode + * @return none + *************************************************************************/ +void testSignalNewDDGenDialysateSubMode( U32 newSubMode ) +{ + if ( newSubMode < NUM_OF_DD_GEND_MODE_STATES ) + { + genDialysateState = (DD_GEND_MODE_STATE_T)newSubMode; + + switch ( newSubMode ) + { + // TODO add logic after checking with Vinay + // Any of these state require no special handling + + case DD_GEND_DIALYSATE_BYPASS_STATE: + isDialDeliveryInProgress.data = FALSE; + break; + + case DD_GEND_DIALYSATE_DELIVERY_STATE: + isDialDeliveryInProgress.data = TRUE; + break; + + case DD_GEND_SPENT_CHAMBER_FILL_STATE: + pendingSpentChamberFill = FALSE; + isDialDeliveryInProgress.data = FALSE; + break; + + case DD_GEND_STATE_START: + case DD_GEND_ISOLATED_UF_STATE: + case DD_GEND_BICARB_CHAMBER_FILL_STATE: + case DD_GEND_DIALYSATE_DELIVERY_PAUSE: + default: + break; + } + setModeGenDStateTransition( genDialysateState ); + } +} + /**@}*/