Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r660a411129a92b9519b0cd34d41dba79953616e5 -red5ca124f43111316fce2a5fb18cf54c72629d6a --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 660a411129a92b9519b0cd34d41dba79953616e5) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision ed5ca124f43111316fce2a5fb18cf54c72629d6a) @@ -87,6 +87,7 @@ static VALVE_STATUS_T currentValveStates[ NUM_OF_VALVES ]; ///< Current status of each valve. static U32 valvesDataPublicationTimerCounter; ///< Valves data broadcast timer counter. static OVERRIDE_U32_T valvesDataPublishInterval; ///< Valves data broadcast interval (in ms). +static VALVE_POSITION_T pendingValvePositionChange[ NUM_OF_VALVES ]; ///< Pending position request for each valve // ********** private function prototypes ********** @@ -131,6 +132,8 @@ currentValveStates[ valve ].homingOperationActive = FALSE; currentValveStates[ valve ].controlState = VALVE_STATE_WAIT_FOR_POST; currentValveStates[ valve ].valveOpsStartTime = 0; + + pendingValvePositionChange[ valve ] = VALVE_POSITION_NOT_IN_POSITION; } @@ -203,11 +206,9 @@ if ( ( valve < NUM_OF_VALVES ) && ( position > VALVE_POSITION_NOT_IN_POSITION ) && ( position < NUM_OF_VALVE_POSITIONS ) ) { if ( ( TRUE == currentValveStates[ valve ].hasValveBeenHomed ) && - ( FALSE == isPinchValveBusy( valve ) ) && - ( FALSE == currentValveStates[ valve ].hasTransitionBeenRequested ) && ( FALSE == currentValveStates[ valve ].homingOperationActive ) ) { - currentValveStates[ valve ].pendingCommandedPosition = position; + pendingValvePositionChange[ valve ] = position; currentValveStates[ valve ].hasTransitionBeenRequested = TRUE; result = TRUE; } @@ -427,6 +428,7 @@ { VALVE_STATE_T nextState = VALVE_STATE_IDLE; + if ( TRUE == currentValveStates[ valve ].hasHomingBeenRequested ) { currentValveStates[ valve ].hasValveBeenHomed = FALSE; @@ -436,8 +438,10 @@ } else if ( TRUE == currentValveStates[ valve ].hasTransitionBeenRequested ) { + currentValveStates[ valve ].pendingCommandedPosition = pendingValvePositionChange[ valve ]; if ( TRUE == movePinchValveToStoredPosition( valve, currentValveStates[ valve ].pendingCommandedPosition ) ) { + pendingValvePositionChange[ valve ] = VALVE_POSITION_NOT_IN_POSITION; currentValveStates[ valve ].hasTransitionBeenRequested = FALSE; currentValveStates[ valve ].commandedPosition = currentValveStates[ valve ].pendingCommandedPosition; currentValveStates[ valve ].currentPosition = VALVE_POSITION_NOT_IN_POSITION;