From 60c83b0af2a8490ff342a9d6be6e3821c1ee83dd Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sun, 29 Aug 2021 14:31:41 +0200 Subject: [PATCH] Allow to set axis acceleration with AxisUnit and physical units --- src/modules/motion.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/modules/motion.h b/src/modules/motion.h index b2c3c5d..e2bd88d 100644 --- a/src/modules/motion.h +++ b/src/modules/motion.h @@ -185,6 +185,23 @@ public: axisData[axis].ctrl.SetAcceleration(accel); } + /// Set acceleration for the selected axis, but using AxisUnit. The Axis needs to + /// be supplied as the first template argument: SetAcceleration(accel). + /// @see SetAcceleration, unitToSteps + template + void SetAcceleration(AxisUnit accel) { + SetAcceleration(A, accel.v); + } + + /// Set acceleration for the selected axis, but using physical units. The Axis needs to + /// be supplied as the first template argument: SetAcceleration(accel). + /// @param axis axis affected + /// @param accel acceleration + template + void SetAcceleration(config::Unit accel) { + SetAcceleration(unitToAxisUnit>(accel)); + } + /// Get current jerk for the selected axis /// @param axis axis affected /// @returns jerk