From d18032b7297f79717b0d315782a6c84b6dfe30a9 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 7 Sep 2021 10:44:47 +0200 Subject: [PATCH] Motion: allow to abort movement on a single axis This can be useful for things like faster homing in the future and comes at no expense. --- src/modules/motion.cpp | 6 +++++- src/modules/motion.h | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/motion.cpp b/src/modules/motion.cpp index 94bd9af..a352b99 100644 --- a/src/modules/motion.cpp +++ b/src/modules/motion.cpp @@ -70,9 +70,13 @@ bool Motion::QueueEmpty() const { return true; } +void Motion::AbortPlannedMoves(Axis axis, bool halt) { + axisData[axis].ctrl.AbortPlannedMoves(halt); +} + void Motion::AbortPlannedMoves(bool halt) { for (uint8_t i = 0; i != NUM_AXIS; ++i) - axisData[i].ctrl.AbortPlannedMoves(halt); + AbortPlannedMoves((Axis)i, halt); } st_timer_t Motion::Step() { diff --git a/src/modules/motion.h b/src/modules/motion.h index d78924b..26bcea1 100644 --- a/src/modules/motion.h +++ b/src/modules/motion.h @@ -255,7 +255,12 @@ public: /// @param axis axis requested bool Full(Axis axis) const { return axisData[axis].ctrl.Full(); } - /// stop whatever moves are being done + /// Stop whatever moves are being done for one axis + /// @param axis axis requested + /// @param halt When true, also abruptly stop axis movement. + void AbortPlannedMoves(Axis axis, bool halt = true); + + /// Stop whatever moves are being done on all axes /// @param halt When true, also abruptly stop axis movement. void AbortPlannedMoves(bool halt = true);