Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -re440fa19012fb060ae96bc91b4e1b8f60bb08723 -r1c43de0034f7347a38ca8d91acb5753a344a7133 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision e440fa19012fb060ae96bc91b4e1b8f60bb08723) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 1c43de0034f7347a38ca8d91acb5753a344a7133) @@ -169,8 +169,8 @@ { VALVE_POSITION_T commandedPosition; ///< Valve commanded position enum VALVE_POSITION_T currentPosition; ///< Valve current position enum - S16 currentPositionInCounts; ///< Valve current position in counts TODO remove - OVERRIDE_S32_T currentPositionInCounts2; ///< Valve current position in counts + //OVERRIDE_S32_T currentPositionInCounts; ///< Valve current position in counts + S16 currentPositionInCounts; ///< Valve current position in counts S16 targetPositionInCounts; ///< Valve target position in counts BOOL hasTransitionBeenRequested; ///< Valve transition request flag VALVE_STATE_T execState; ///< Valve execution state @@ -1599,12 +1599,42 @@ *************************************************************************/ BOOL testSetValvesPositionCountOverride( U32 valve, U32 count ) { + BOOL result = FALSE; + // Check if the valve is in the range of the valves available + if ( ( TRUE == isTestingActivated() ) && ( valve < NUM_OF_VALVES ) ) + { + /*S32 convert = (S32)count; + valvesStatus[ (VALVE_T)valve ].currentPositionInCounts.override = OVERRIDE_KEY; + valvesStatus[ (VALVE_T)valve ].currentPositionInCounts.ovData = (S16)convert; + valvesStatus[ (VALVE_T)valve ].currentPositionInCounts.ovInitData = valvesStatus[ (VALVE_T)valve ].currentPositionInCounts.data; + result = TRUE;*/ + } + + return result; } +/*********************************************************************//** + * @brief + * The testResetValvesPositionCountOverride function resets the override + * of the valves' position in counts. + * @details Inputs: valvesStatus + * @details Outputs: valvesStatus + * @param valve that its position count override will be reset + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ BOOL testResetValvesPositionCountOverride( U32 valve ) { + BOOL result = FALSE; + if ( ( TRUE == isTestingActivated() ) && ( valve < NUM_OF_VALVES ) ) + { + /*valvesStatus[ (VALVE_T)valve ].currentPositionInCounts.override = OVERRIDE_RESET; + valvesStatus[ (VALVE_T)valve ].currentPositionInCounts.ovData = valvesStatus[ (VALVE_T)valve ].currentPositionInCounts.ovInitData; + result = TRUE;*/ + } + + return result; } /*********************************************************************//** @@ -1623,9 +1653,10 @@ // Check if the valve is in the range of the valves available if ( ( TRUE == isTestingActivated() ) && ( valve < NUM_OF_VALVES ) ) { - valvesStatus[ (VALVE_T)valve ].current.override = OVERRIDE_RESET; + valvesStatus[ (VALVE_T)valve ].current.override = OVERRIDE_KEY; valvesStatus[ (VALVE_T)valve ].current.ovData = current; valvesStatus[ (VALVE_T)valve ].current.ovInitData = valvesStatus[ (VALVE_T)valve ].current.data; + result = TRUE; } return result; @@ -1648,6 +1679,7 @@ { valvesStatus[ (VALVE_T)valve ].current.override = OVERRIDE_RESET; valvesStatus[ (VALVE_T)valve ].current.ovData = valvesStatus[ (VALVE_T)valve ].current.ovInitData; + result = TRUE; } return result;