Bug fix in the Adafruit stepper code, specifically with respect to the AdafruitDouble step-style.

This commit is contained in:
Josh Finken 2016-08-30 22:05:26 -06:00
parent c1d520e6ab
commit 46191cda90
1 changed files with 6 additions and 4 deletions

View File

@ -493,11 +493,13 @@ func (a *AdafruitMotorHatDriver) Step(motor, steps int, dir AdafruitDirection, s
}
// As documented in the Adafruit python driver:
// This is an edge case, if we are in between full steps, keep going to end on a full step
for latestStep != 0 && latestStep != stepperMicrosteps {
if latestStep, err = a.oneStep(motor, dir, style); err != nil {
return
if style == AdafruitMicrostep {
for latestStep != 0 && latestStep != stepperMicrosteps {
if latestStep, err = a.oneStep(motor, dir, style); err != nil {
return
}
<-time.After(time.Duration(secPerStep) * time.Second)
}
<-time.After(time.Duration(secPerStep) * time.Second)
}
return
}