Index: firmware/App/Modes/FPModes/FPOperationModes.c =================================================================== diff -u -rc9486db3b5f2dceb7eb8579c1dd6317483e8feb8 -rb25a4928766392152694b1304565f876fd38b39a --- firmware/App/Modes/FPModes/FPOperationModes.c (.../FPOperationModes.c) (revision c9486db3b5f2dceb7eb8579c1dd6317483e8feb8) +++ firmware/App/Modes/FPModes/FPOperationModes.c (.../FPOperationModes.c) (revision b25a4928766392152694b1304565f876fd38b39a) @@ -7,8 +7,8 @@ * * @file FPOperationModes.c * -* @author (last) Sameer Kalliadan Poyil -* @date (last) 03-Feb-2026 +* @author (last) Raghu Kallala +* @date (last) 31-Mar-2026 * * @author (original) Michael Garthwaite * @date (original) 08-Sep-2025 @@ -49,6 +49,8 @@ static U32 current4thLevelState; ///< current 4th level state. static BOOL isDeviceDefeatured; ///< bool to determine defeatured status static BOOL isBoostInstalled; ///< bool to determine boost pump status +static U32 testRequestedSubMode; ///< Requested operation sub mode from dialin. +static BOOL testChangeSubMode; ///< Flag to determine change operation sub mode request status. /// Interval (in task intervals) at which to publish operation mode data to CAN bus. static OVERRIDE_U32_T opModePublishInterval = { BROADCAST_TD_OP_MODE_INTERVAL, BROADCAST_TD_OP_MODE_INTERVAL, BROADCAST_TD_OP_MODE_INTERVAL, 0 }; @@ -70,6 +72,8 @@ static FP_OP_MODE_T arbitrateModeRequest( void ); static void transitionToNewOperationMode( FP_OP_MODE_T newMode ); static void broadcastOperationMode( void ); +static void testRequestNewFPOperationSubMode( void ); +static BOOL testValidateSubModeChangeRequest( FP_OP_MODE_T reqMode, U32 reqSubMode ); /*********************************************************************//** * @brief @@ -97,6 +101,8 @@ broadcastModeIntervalCtr = DATA_PUBLISH_COUNTER_START_COUNT; isDeviceDefeatured = FALSE; isBoostInstalled = FALSE; + testRequestedSubMode = 0; + testChangeSubMode = FALSE; transitionToNewOperationMode( FP_MODE_INIT ); @@ -126,10 +132,15 @@ // Any new mode requests? newMode = arbitrateModeRequest(); // Will return current mode if no pending requests - newMode = MODE_TRANSITION_TABLE[ currentMode ][ newMode ]; + if ( isTestingActivated() != TRUE ) + { + // if the test configuration is not enabled check for the legality of the transition request + newMode = MODE_TRANSITION_TABLE[ currentMode ][ newMode ]; + } + // Is requested new mode valid and legal at this time? - if ( ( newMode >= FP_MODE_NLEG ) && ( isTestingActivated() != TRUE ) ) + if ( newMode >= FP_MODE_NLEG ) { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_FP_SOFTWARE_FAULT, FP_FAULT_ID_OP_MODES_ILLEGAL_MODE_TRANSITION_REQUESTED, newMode ) newMode = currentMode; @@ -144,6 +155,12 @@ currentMode = newMode; // sendOperationStatusEvent(); } + // Is sub mode change request active? + if ( TRUE == testChangeSubMode ) + { + testChangeSubMode = FALSE; + testRequestNewFPOperationSubMode(); + } // Mode specific processing to be done continuously switch ( currentMode ) @@ -630,4 +647,154 @@ return result; } +/*********************************************************************//** + * @brief + * The testSetFPOperationSubMode function will transition to a given + * sub mode if the transition is legal. + * @details \b Inputs: currentMode, currentSubMode + * @details \b Outputs: modeRequest[], testRequestedSubMode, testChangeSubMode + * @param message message from Dialin which includes the sub mode to + * transition to. + * @return TRUE if request successful, FALSE if not + *************************************************************************/ +BOOL testSetFPOperationSubMode( MESSAGE_T *message ) +{ + OP_MODE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify message payload length is valid + if ( sizeof( OP_MODE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + FP_OP_MODE_T reqMode; + U32 reqSubMode; + + memcpy( (U08*)(&payload), message->payload, sizeof( OP_MODE_PAYLOAD_T ) ); + + reqMode = (FP_OP_MODE_T)payload.opMode; + reqSubMode = payload.subMode; + + if ( reqMode < NUM_OF_FP_MODES ) + { + // verify if the requested submode transition is possible + result = testValidateSubModeChangeRequest( reqMode, reqSubMode ); + + // send the sub mode change request only if the requested transition is valid + if ( TRUE == result ) + { + // request new operation mode and sub mode if the requested operation mode is not current mode + if ( currentMode != reqMode ) + { + requestNewFPOperationMode( reqMode ); + testRequestedSubMode = reqSubMode; + testChangeSubMode = TRUE; + } + // request submode change only as the requested operation mode is current mode and requested sub mode is not current sub mode + else if ( currentSubMode != reqSubMode ) + { + testRequestedSubMode = reqSubMode; + testChangeSubMode = TRUE; + } + } + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testValidateSubModeChangeRequest function validates the + * requested sub mode change is acceptable or not. + * operation sub mode. + * @details \b Inputs: none + * @details \b Outputs: none + * @param reqMode FP operation mode enumeration + * @param reqSubMode operation sub mode requested + * @return TRUE if request is legal, FALSE if not. + *************************************************************************/ +static BOOL testValidateSubModeChangeRequest( FP_OP_MODE_T reqMode, U32 reqSubMode ) +{ + BOOL result = FALSE; + + switch ( reqMode ) + { + case FP_MODE_PGEN: + result = testValidatePreGenPChangeReq( reqSubMode ); + break; + + case FP_MODE_GENP: + result = testValidateGenPermeateChangeReq( reqSubMode ); + break; + + case FP_MODE_DPGP: + result = testValidatePreGenPDefeaturedChangeReq( reqSubMode ); + break; + + case FP_MODE_DEGP: + result = testValidateGenPDefeaturedChangeReq( reqSubMode ); + break; + + case FP_MODE_FAUL: + result = testValidateFaultChangeReq( reqSubMode ); + break; + + case FP_MODE_STAN: + result = testValidateStandbyChangeReq( reqSubMode ); + break; + + // No need to validate the request for the following modes as it is not supported + case FP_MODE_SERV: + case FP_MODE_INIT: + default: + // result is already FALSE. Do nothing for modes that do not support jump to sub-mode + break; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testRequestNewFPOperationSubMode function requests transition to a new + * operation sub mode. + * @details \b Inputs: currentMode, testRequestedSubMode + * @details \b Outputs: none + * @return none + *************************************************************************/ +static void testRequestNewFPOperationSubMode( void ) +{ + switch ( currentMode ) + { + case FP_MODE_PGEN: + testSignalNewPreGenPSubMode( testRequestedSubMode ); + break; + + case FP_MODE_GENP: + testSignalNewGenPermeateSubMode( testRequestedSubMode ); + break; + + case FP_MODE_DPGP: + testSignalNewPreGenPDefeaturedSubMode( testRequestedSubMode ); + break; + + case FP_MODE_DEGP: + testSignalNewGenPDefeaturedSubMode( testRequestedSubMode ); + break; + + case FP_MODE_FAUL: + testSignalNewFaultSubMode( testRequestedSubMode ); + break; + + case FP_MODE_STAN: + testSignalNewStandbySubMode( testRequestedSubMode ); + break; + + case FP_MODE_SERV: + case FP_MODE_INIT: + default: + // do nothing for modes that do not support jump to sub-mode + break; + } +} + /**@}*/ Index: firmware/App/Modes/FPModes/FPOperationModes.h =================================================================== diff -u -r0629bf55079c4ad0fa3b44091d5f3618e51b7a2b -rb25a4928766392152694b1304565f876fd38b39a --- firmware/App/Modes/FPModes/FPOperationModes.h (.../FPOperationModes.h) (revision 0629bf55079c4ad0fa3b44091d5f3618e51b7a2b) +++ firmware/App/Modes/FPModes/FPOperationModes.h (.../FPOperationModes.h) (revision b25a4928766392152694b1304565f876fd38b39a) @@ -7,8 +7,8 @@ * * @file FPOperationModes.h * -* @author (last) “rkallala” -* @date (last) 15-Jan-2026 +* @author (last) Raghu Kallala +* @date (last) 30-Mar-2026 * * @author (original) Michael Garthwaite * @date (original) 08-Sep-2025 @@ -58,7 +58,7 @@ // ********** public function prototypes ********** void initFPOperationModes( void ); // Initialize this unit -void execFPOperationModes( void ); +void execFPOperationModes( void ); // Execute the FP operation mode state machine (scheduled periodic call) void requestNewFPOperationMode( FP_OP_MODE_T newMode ); // Request a transition to a new operation mode FP_OP_MODE_T getCurrentFPOperationMode( void ); // Get the current operation mode @@ -76,6 +76,7 @@ BOOL testSetGeneratePermeateSignal( MESSAGE_T *message ); // Set start stop generate permeate. BOOL testGetFPDefeaturedStatus( MESSAGE_T *message ); // Send a response message with FP defeatured status payload BOOL testGetFPBoostPumpInstallStatus( MESSAGE_T *message ); // Send a response message with FP boost pump installation status payload +BOOL testSetFPOperationSubMode( MESSAGE_T *message ); // Set operation sub mode override /**@}*/ Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r0629bf55079c4ad0fa3b44091d5f3618e51b7a2b -rb25a4928766392152694b1304565f876fd38b39a --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 0629bf55079c4ad0fa3b44091d5f3618e51b7a2b) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision b25a4928766392152694b1304565f876fd38b39a) @@ -7,8 +7,8 @@ * * @file Messaging.c * -* @author (last) Sameer Kalliadan Poyil -* @date (last) 06-Mar-2026 +* @author (last) Vinayakam Mani +* @date (last) 06-Apr-2026 * * @author (original) Vinayakam Mani * @date (original) 07-Aug-2024 @@ -284,6 +284,7 @@ { MSG_ID_FP_DEF_PRE_GEN_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testPreGenPermeateDefDataPublishIntervalOverride}, { MSG_ID_FP_DEF_GEN_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testGenPermeateDefDataPublishIntervalOverride}, { MSG_ID_FP_DEF_STATUS_REQUEST, &testGetFPDefeaturedStatus }, + { MSG_ID_FP_SET_OPERATION_SUB_MODE_REQUEST, &testSetFPOperationSubMode }, { MSG_ID_FP_BOOST_PUMP_INSTALL_STATUS_REQUEST, &testGetFPBoostPumpInstallStatus }, }; @@ -577,7 +578,7 @@ * @param alarm ID of alarm triggered * @param almData1 1st data associated with alarm * @param almData2 2nd data associated with alarm - * @return TRUE if msg successfully queued for transmit, FALSE if not + * @return TRUE if msg successfully queued for transmit, FALSE if not. *************************************************************************/ BOOL broadcastAlarmTriggered( U32 alarm, ALARM_DATA_T almData1, ALARM_DATA_T almData2, ALARM_SOURCE_T almSource ) {