summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--esp32c3_stand_firmware/esp32c3_stand_firmware.ino10
1 files changed, 8 insertions, 2 deletions
diff --git a/esp32c3_stand_firmware/esp32c3_stand_firmware.ino b/esp32c3_stand_firmware/esp32c3_stand_firmware.ino
index d2cb559..70debb7 100644
--- a/esp32c3_stand_firmware/esp32c3_stand_firmware.ino
+++ b/esp32c3_stand_firmware/esp32c3_stand_firmware.ino
@@ -128,8 +128,7 @@ void handleMove()
const auto stepsStr = server.arg(stepsArg);
s.print("handleMove: arg(stepsArg): ");
s.println(stepsStr);
-
- server.send(200, "text/plain", "move " + stepsStr + " steps\n");
+
stepperRun = true;
stepper.enableOutputs();
@@ -138,6 +137,13 @@ void handleMove()
//bool backward = rand() % 2;
//stepper.move(8000 * (backward ? -1 : 1));
stepper.move(steps);
+
+ while (stepper.distanceToGo() != 0)
+ {
+ stepper.run();
+ }
+
+ server.send(200, "text/plain", "move " + stepsStr + " steps\n");
}
void handleStop()