From ff183576ec18ccdd1619bb198bd58b3f4f326b20 Mon Sep 17 00:00:00 2001 From: smathis Date: Tue, 5 Aug 2025 08:58:50 +0200 Subject: [PATCH] Added axis reinitialization after node reset When resetting the node, values within the controller may change, which need to be reread by the init function. --- src/masterMacsAxis.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/masterMacsAxis.cpp b/src/masterMacsAxis.cpp index 50472f9..ea40dc1 100644 --- a/src/masterMacsAxis.cpp +++ b/src/masterMacsAxis.cpp @@ -814,8 +814,9 @@ asynStatus masterMacsAxis::doReset() { setAxisParamChecked(this, motorStatusProblem, true); } - // Reset any errors in the controller - status = pC_->write(axisNo_, 17, ""); + // Reset any errors in the controller. Since the node reset results in a + // power cycle, we use the corresponding timeout. + status = pC_->write(axisNo_, 17, "", PowerCycleTimeout); if (status != asynSuccess) { setAxisParamChecked(this, motorStatusProblem, true); } @@ -823,7 +824,13 @@ asynStatus masterMacsAxis::doReset() { // Move out of the handshake wait loop, if we're currently inside it. pMasterMacsA_->waitForHandshake = false; - return status; + // Reinitialize the axis + status = masterMacsAxis::init(); + if (status != asynSuccess) { + return status; + } + bool moving = false; + return forcedPoll(&moving); } /*