From f93c9f331e565bd3a79eb31fa241d4a94208ea7d Mon Sep 17 00:00:00 2001 From: Malaurie Bernard <mbernard@kinouby> Date: Mon, 10 Jul 2023 11:55:02 +0200 Subject: [PATCH] Fixing the method stop() in motor so the motor can stop without keep on turning --- motor.cpp | 4 +++- web.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/motor.cpp b/motor.cpp index f462c3d..8dd7585 100644 --- a/motor.cpp +++ b/motor.cpp @@ -133,6 +133,8 @@ void Motor :: stop () { #if !CORE_MOCK cli(); + stepper.setAcceleration(1e20); + stepper.moveTo(stepper.currentPosition()); stepper.stop(); sei(); #endif @@ -148,7 +150,7 @@ void Motor :: stay_here () #if !CORE_MOCK cli(); stepper.setAcceleration(1e20); - stepper.moveTo(stepper.currentPosition()); // change target to here + stepper.moveTo(stepper.currentPosition()); // change target to here set_accel_mm_per_sec_per_sec(_acceleration_mm_per_sec_per_sec); sei(); #endif diff --git a/web.cpp b/web.cpp index c912e27..f29ecb1 100644 --- a/web.cpp +++ b/web.cpp @@ -383,7 +383,7 @@ void switch_status_callback1(Control* sender, int value, void* param) ESPUI.print(status_label_id1, "A l'arrĂȘt"); ESPUI.setPanelStyle(status_label_id1, couleurs[2]); ESPUI.setElementStyle(status_label_id1, couleurs[3]); - syringe_filled.stay_here(); + syringe_filled.stop(); break; } -- GitLab