fehlfarbe / arduino-motorfocus

Arduino motorfocus with moonlite protocol for telescopes
MIT License
49 stars 13 forks source link

stepper not disabled in fringe condition #10

Closed jvanderk closed 2 years ago

jvanderk commented 2 years ago

In the code

isRunning = false;
if (millis() - millisLastMove > millisDisableDelay)
{
  // Save current location in EEPROM
  if (lastSavedPosition != currentPosition)
  {
    EEPROM.put(0, currentPosition);
    lastSavedPosition = currentPosition;
    debugSerial.println("Save last position to EEPROM");
    stepper.disableOutputs();
    debugSerial.println("Disabled output pins");
  }
}

the stepper is not disabled if the lastSavedPosition is identical to currentPosition. I ran into this when testing, it is unlikely to occur in real life.

A simple solution may be to pull the disableOutputs() line out of the if command.

fehlfarbe commented 2 years ago

You're right, thanks! :)