Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r9ee85cc1a178b3b619478b9b4386d5184537d73c -r470fde672305348c9a4f5002af814737fcfa00db --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 9ee85cc1a178b3b619478b9b4386d5184537d73c) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 470fde672305348c9a4f5002af814737fcfa00db) @@ -540,17 +540,8 @@ // handle a home request if ( TRUE == currentValveStates[ valve ].hasHomingBeenRequested ) { - S16 tgtPos = currentValveStates[ valve ].positionsABC[ VALVE_POSITION_C_CLOSE ]; - S16 mag = currentValveStates[ valve ].currentEncPosition - tgtPos; // calculate magnitude of position change - - // Set commanded position and transition start time stamp - // Transition back to position C to try the next energized position. It has to start from position C - currentValveStates[ valve ].commandedPosition = VALVE_POSITION_C_CLOSE; - currentValveStates[ valve ].valveOpsStartTime = getMSTimerCount(); - currentValveStates[ valve ].hasValveBeenReset = FALSE; - nextState = VALVE_STATE_IN_TRANSITION; - // Command FPGA to move valve to commanded position - setValveCmdChangePosition( valve, (U16)(mag), MOTOR_DIR_REVERSE ); + // Transition to homing not started. Reseting and enabling the valve and encoder is not needed + nextState = VALVE_STATE_HOMING_NOT_STARTED; } // handle a position change request else if ( TRUE == currentValveStates[ valve ].hasTransitionBeenRequested ) @@ -598,6 +589,7 @@ if ( abs( delta ) < VALVE_TRANSITION_MIN_TGT_DELTA ) { currentValveStates[ valve ].currentPosition = currentValveStates[ valve ].commandedPosition; + nextState = VALVE_STATE_IDLE; } // is transition taking too long? else if ( ( TRUE == didTimeout( currentValveStates[ valve ].valveOpsStartTime, VALVE_TRANSITION_TIMEOUT_MS ) ) &&