Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -rd7c545dff2f13dd75ebab0af997c45047c844f7a -rfd21f03d28eec499fb5c01bf595c57893db94406 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision d7c545dff2f13dd75ebab0af997c45047c844f7a) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision fd21f03d28eec499fb5c01bf595c57893db94406) @@ -7,8 +7,8 @@ * * @file Valves.c * -* @author (last) Jashwant Gantyada -* @date (last) 30-Mar-2026 +* @author (last) Michael Garthwaite +* @date (last) 15-Apr-2026 * * @author (original) Vinayakam Mani * @date (original) 26-Aug-2024 @@ -67,6 +67,7 @@ static OVERRIDE_U32_T valveSensedStates[ DD_NUM_OF_VALVES ]; ///< Valve sensed states override. static OVERRIDE_U32_T valvesStatesPublishInterval; ///< Interval (in ms/task interval) at which to publish valves state to CAN bus. static OVERRIDE_U32_T fpValveStatesPublishInterval; ///< Interval (in ms/task interval) at which to publish valves state to CAN bus. +static RECOVERY_STATE_T recoveryState; // ********** private function prototypes ********** @@ -97,6 +98,7 @@ fpValveStatesPublishInterval.ovData = VALVES_STATE_PUB_INTERVAL; fpValveStatesPublishInterval.ovInitData = 0; fpValveStatesPublishInterval.override = OVERRIDE_RESET; + recoveryState = MAX_RECOVERY; // Initialize commanded valve states for ( i = 0; i < DD_NUM_OF_VALVES; i++ ) @@ -556,17 +558,42 @@ /*********************************************************************//** * @brief - * The setRecoveryValvesConfig function sets all recovery valves per + * The getRecoveryValvesConfig function gets * recovery configuration from institutional record. + * @details \b Inputs: recoveryState + * @details \b Outputs: none + * @return recoveryState. + *************************************************************************/ +RECOVERY_STATE_T getRecoveryStatesConfig( void ) +{ + return recoveryState; +} + +/*********************************************************************//** + * @brief + * The setRecoveryStatesConfig function gets + * recovery configuration from institutional record. * @details \b Inputs: none + * @details \b Outputs: recoveryState + * @param recovery state to set valve config. + * @return none. + *************************************************************************/ +void setRecoveryStatesConfig( RECOVERY_STATE_T recovery ) +{ + recoveryState = recovery; +} +/*********************************************************************//** + * @brief + * The setRecoveryValvesConfig function sets all recovery valves per + * recovery configuration from institutional record. + * @details \b Inputs: recoveryState * @details \b Outputs: P33, P34 and P37 recovery valve states * @return none. *************************************************************************/ void setRecoveryValvesConfig( void ) { // TODO define hdInstitutionalRecord and get the NVData when it's ready // RECOVERY_STATE_T recoveryState = (RECOVERY_STATE_T)hdInstitutionalRecord.recoveryConfig; - RECOVERY_STATE_T recoveryState = MAX_RECOVERY; // Set all P33, P34 and P37 valves per recovery configuration switch( recoveryState ) @@ -865,4 +892,39 @@ return result; } +/*********************************************************************//** + * @brief + * The testIOFPValveSensedStateOverride function overrides the value of the + * specified sensed state of an IOFP valve with a given value. + * @details \b Inputs: none + * @details \b Outputs: valveSensedStates[] + * @param message Override message from Dialin which includes an ID of + * the valve to override and the state to override the valve to. + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testIOFPSetValveRecoveryConfig( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // Verify tester has logged in with DD + if ( TRUE == isTestingActivated() ) + { + // Verify payload length is valid + if ( sizeof( U32 ) == message->hdr.payloadLen ) + { + U32 payload; + + memcpy( &payload, message->payload, sizeof(U32) ); + + if (payload < NUM_OF_RECOVERY_STATES ) + { + setRecoveryStatesConfig((RECOVERY_STATE_T)payload); + result = TRUE; + } + } + } + + return result; +} + /**@}*/