Index: firmware/App/Modes/FPModes/ModePreGenPermeate.c =================================================================== diff -u -rf7553872983e440277cae7f84b386ff195d7c394 -r886964fa2bf6a5bb61b33b8b5547f3d0c585b360 --- firmware/App/Modes/FPModes/ModePreGenPermeate.c (.../ModePreGenPermeate.c) (revision f7553872983e440277cae7f84b386ff195d7c394) +++ firmware/App/Modes/FPModes/ModePreGenPermeate.c (.../ModePreGenPermeate.c) (revision 886964fa2bf6a5bb61b33b8b5547f3d0c585b360) @@ -448,67 +448,6 @@ /*********************************************************************//** * @brief - * The validatePreGenPChangeReq function validate whether requested - * sub mode change is legal or not. - * @details \b Inputs: none - * @details \b Outputs: none - * @return TRUE if request is legal, FALSE if not. - *************************************************************************/ -BOOL validatePreGenPChangeReq( U32 newSubMode ) -{ - BOOL result = FALSE; - LEVEL_STATE_T level = getLevelStatus( P25_LEVL ); - - // TODO add validation logic - result = TRUE; - - return result; -} - -/*********************************************************************//** - * @brief - * The signalNewPreGenPSubMode function requests transition to a new - * PreGen Permeate sub mode. - * @details \b Inputs: none - * @details \b Outputs: none - * @return none - *************************************************************************/ -void signalNewPreGenPSubMode( U32 newSubMode ) -{ - FP_PRE_GENP_MODE_STATE_T reqSubMode = (FP_PRE_GENP_MODE_STATE_T)newSubMode; - - if ( reqSubMode < NUM_OF_FP_PRE_GENW_MODE_STATES ) - { - preGenPState = reqSubMode; - // handle the prerequisite if any - switch ( reqSubMode ) - { - case FP_PRE_GENP_INLET_PRESSURE_CHECK: - break; - - case FP_PRE_GENP_FILTER_FLUSH: - break; - - case FP_PRE_GENP_PERMEATE_FLUSH: - break; - - case FP_PRE_GENP_CONCENTRATE_FLUSH: - // jump to concentrate flush sub mode only if the permeate tank is full - break; - - case FP_PRE_GENP_VERIFY_WATER: - break; - - case FP_PRE_GENP_PAUSED: - default: - break; - } - setModePreGenPTransition( reqSubMode ); - } -} - -/*********************************************************************//** - * @brief * The getPreGenWDataPublishInterval function gets the pre generate water * mode data publish interval. * @details \b Inputs: genWaterDataPublishInterval @@ -612,4 +551,71 @@ return result; } +/*********************************************************************//** + * @brief + * The testValidatePreGenPChangeReq function validate whether requested + * sub mode change 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 testValidatePreGenPChangeReq( U32 newSubMode ) +{ + BOOL result = FALSE; + LEVEL_STATE_T level = getLevelStatus( P25_LEVL ); + + if ( newSubMode < NUM_OF_FP_PRE_GENW_MODE_STATES ) + { + switch ( newSubMode ) + { + case FP_PRE_GENP_CONCENTRATE_FLUSH: + result = (( LEVEL_STATE_HIGH == level ) ? TRUE : FALSE); + break; + + case FP_PRE_GENP_INLET_PRESSURE_CHECK: + case FP_PRE_GENP_FILTER_FLUSH: + case FP_PRE_GENP_PERMEATE_FLUSH: + case FP_PRE_GENP_VERIFY_WATER: + case FP_PRE_GENP_PAUSED: + default: + result = TRUE; + break; + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testSignalNewPreGenPSubMode function requests transition to a new + * PreGen Permeate sub mode. + * @details \b Inputs: none + * @details \b Outputs: none + * @param newSubMode the enumerated sub state of the mode. + * @return none + *************************************************************************/ +void testSignalNewPreGenPSubMode( U32 newSubMode ) +{ + if ( newSubMode < NUM_OF_FP_PRE_GENW_MODE_STATES ) + { + preGenPState = (FP_PRE_GENP_MODE_STATE_T)newSubMode; + // handle the prerequisite if any + switch ( newSubMode ) + { + // Require no special handling for now (update the comment if required in future) + case FP_PRE_GENP_INLET_PRESSURE_CHECK: + case FP_PRE_GENP_FILTER_FLUSH: + case FP_PRE_GENP_PERMEATE_FLUSH: + case FP_PRE_GENP_CONCENTRATE_FLUSH: + case FP_PRE_GENP_VERIFY_WATER: + case FP_PRE_GENP_PAUSED: + default: + break; + } + setModePreGenPTransition( preGenPState ); + } +} + /**@}*/