Er, maybe I was wrong. My mind is still seething over the lengthy delays trying to ban spammers on the forum.
This code here:
 // check current drain
 while (millis () - start < time_to_go)
  {
  if (analogRead (0) > 325) // > 1.46 amps
   break; Â
  }
That makes it stop if the current drain exceeds 1.46 amps. You might want to tweak that a bit. Perhaps your motors are drawing more than mine did. So if you make it higher, it will draw more current before stopping.
I am assuming that is the delay between direction changes?
Yes.