From c32708e49ca4c126995fc71d27d4f16b84674830 Mon Sep 17 00:00:00 2001 From: smathis Date: Wed, 16 Jul 2025 11:21:52 +0200 Subject: [PATCH] Removed lastSpeed caching After discussion with Sven Schlienger, I now send the new speed unconditionally before each move command. This also means that the caching of the last speed is no longer needed. --- src/masterMacsAxis.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/masterMacsAxis.cpp b/src/masterMacsAxis.cpp index 6dacb03..b16ed76 100644 --- a/src/masterMacsAxis.cpp +++ b/src/masterMacsAxis.cpp @@ -19,7 +19,6 @@ struct masterMacsAxisImpl { std::bitset<16> axisStatus; std::bitset<16> axisError; - double lastSetSpeed; bool waitForHandshake; time_t timeAtHandshake; bool needInit = true; @@ -122,7 +121,6 @@ masterMacsAxis::masterMacsAxis(masterMacsController *pC, int axisNo) pMasterMacsA_ = std::make_unique((masterMacsAxisImpl){ .axisStatus = std::bitset<16>(0), .axisError = std::bitset<16>(0), - .lastSetSpeed = 0.0, .waitForHandshake = false, .timeAtHandshake = 0, .targetReachedUninitialized = true, @@ -262,11 +260,6 @@ asynStatus masterMacsAxis::init() { __PRETTY_FUNCTION__, __LINE__); } - // Cache the motor speed. If this value differs from the one in the motor - // record at the start of a movement, the motor record value is sent to - // MasterMACS. - pMasterMacsA_->lastSetSpeed = motorVelocity; - // Store the motor position in the parameter library pl_status = setMotorPosition(motorPosition); if (pl_status != asynSuccess) { @@ -741,9 +734,7 @@ asynStatus masterMacsAxis::doMove(double position, int relative, // Set the new motor speed, if the user is allowed to do so and if the // motor speed changed since the last move command. - if (motorCanSetSpeed != 0 && pMasterMacsA_->lastSetSpeed != motorVelocity) { - - pMasterMacsA_->lastSetSpeed = motorVelocity; + if (motorCanSetSpeed != 0) { snprintf(value, sizeof(value), "%lf", motorVelocity); status = pC_->write(axisNo_, 05, value);