Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 -re734f2d5dbdf3fa44a46892d1207e1f0859ed242 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision e734f2d5dbdf3fa44a46892d1207e1f0859ed242) @@ -68,6 +68,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 ********** @@ -98,7 +99,7 @@ fpValveStatesPublishInterval.ovData = VALVES_STATE_PUB_INTERVAL; fpValveStatesPublishInterval.ovInitData = 0; fpValveStatesPublishInterval.override = OVERRIDE_RESET; - recoveryState = MAX_RECOVERY; + recoveryState = MAX_RECOVERY; // Initialize commanded valve states for ( i = 0; i < DD_NUM_OF_VALVES; i++ ) @@ -527,17 +528,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( U32 recovery ) +{ + recoveryState = (RECOVERY_STATE_T)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 ) @@ -848,4 +874,38 @@ 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(payload); + result = TRUE; + } + } + } + + return result; +} + /**@}*/