From 63a5fcd518caac81b7fd7a1de3ef65bf5cabb8be Mon Sep 17 00:00:00 2001 From: smathis Date: Tue, 13 May 2025 14:39:08 +0200 Subject: [PATCH] Allow enabling / disabling the motor regardless of the status returned by the poll. --- src/turboPmacAxis.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/turboPmacAxis.cpp b/src/turboPmacAxis.cpp index 20446da..23c942c 100644 --- a/src/turboPmacAxis.cpp +++ b/src/turboPmacAxis.cpp @@ -392,13 +392,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) { switch (axStatus) { case -6: // Axis is stopping - - // If the axis was already idle during the last poll, it is not moving - if (previousStatusDone == 0) { - *moving = true; - } else { - *moving = false; - } + *moving = true; break; case -5: // Axis is deactivated @@ -1277,11 +1271,14 @@ asynStatus turboPmacAxis::enable(bool on) { // Status of parameter library operations asynStatus pl_status = asynSuccess; + /* + Continue regardless of the status returned by the poll; we just want to + find out whether the motor is currently moving or not. If the poll + function fails before it can determine that, it is assumed that the motor + is not moving. + */ bool moving = false; - rw_status = doPoll(&moving); - if (rw_status != asynSuccess) { - return rw_status; - } + doPoll(&moving); // =========================================================================