DC motor don't come back in same position

How many sensor pulses do you get per revolution?

I don't know!

But here's my dilemma. Supposing that ISR routine can't capture each pulse from both sensors witch is very probable. But this should not affect the working time of the motors. For example, if the pulses are recorded only 8000 from an real of 10.000, this happens in both directions and finally the motor should return to the same position. Stop command is given only when count number reaches a certain value.
Maybe something i don't understand right.
I suspect another problem but need to check that. Maybe motors don't have same speed in both directions witch will be strange but.... . If is extending a little faster than when is retracting then in extend move are captured less "real" pulses and in retracting movement are captured more pulses witch in effect lead to a closing of the gates earlier than it should.
If this is happens i see two solutions:

  1. dirty solution, simplest but imprecise: add an correction when gate reverse to close position.
  2. simplify ISR routine to only increment counters so can capture each pulse. In this case motor speed will not affect anymore open/close position.