From d7be2bc65d561b092a64c1b572e5668b2626ed27 Mon Sep 17 00:00:00 2001 From: Peter Jaquiery Date: Tue, 18 Jul 2023 15:40:36 +1200 Subject: [PATCH] Call step(...) in enableOutputs() to ensure motor pins are driven in case there was a previous call to disableOutputs() --- src/AccelStepper.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/AccelStepper.cpp b/src/AccelStepper.cpp index 54535cc..f6ffde6 100644 --- a/src/AccelStepper.cpp +++ b/src/AccelStepper.cpp @@ -601,6 +601,10 @@ void AccelStepper::enableOutputs() pinMode(_enablePin, OUTPUT); digitalWrite(_enablePin, HIGH ^ _enableInverted); } + + // Ensure pins are updated for the current position to make sure + // motor is powered following disableOutputs(). + step(_currentPos); } void AccelStepper::setMinPulseWidth(unsigned int minWidth)