From 2578081814943129175fbb6ec329ec7531f59b8b Mon Sep 17 00:00:00 2001 From: smathis Date: Tue, 20 Jan 2026 16:44:13 +0100 Subject: [PATCH] Added dedicated interface function for setting the operation mode. --- README.md | 2 ++ src/sinqAxis.cpp | 5 +++++ src/sinqAxis.h | 12 ++++++++++++ src/sinqController.cpp | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 82560c9..fb577bd 100644 --- a/README.md +++ b/README.md @@ -331,6 +331,8 @@ available in the IOC shell. This function is also available in the IOC shell. - `setScaleMovTimeout`: Set a scaling factor for the expected movement time. This function is also available in the IOC shell. +- `setMode`: This is an empty function which should be overwritten by concrete +driver implementations. #### msgPrintControl.h In addition to the two extension classes this library also includes a mechanism diff --git a/src/sinqAxis.cpp b/src/sinqAxis.cpp index bf02152..010934c 100644 --- a/src/sinqAxis.cpp +++ b/src/sinqAxis.cpp @@ -732,6 +732,11 @@ void sinqAxis::setTargetPosition(double targetPosition) { pSinqA_->targetPosition = targetPosition; } +asynStatus sinqAxis::setMode(int mode) { + (void)mode; + return asynSuccess; +} + // ============================================================================= // IOC shell functions extern "C" { diff --git a/src/sinqAxis.h b/src/sinqAxis.h index e118548..f9adaa7 100644 --- a/src/sinqAxis.h +++ b/src/sinqAxis.h @@ -434,6 +434,18 @@ class HIDDEN sinqAxis : public asynMotorAxis { */ asynStatus assertConnected(); + /** + * @brief Set the operation mode (position or velocity) of the axis. It + * should be implemented by a child class of sinqAxis. + * + * This function is called from within sinqController::writeInt32 if a new + * operation mode has been set. + * + * @param mode: New operation mode. 0 is position mode, 1 is velocity mode. + * @return asynStatus + */ + virtual asynStatus setMode(int mode); + /** * @brief Return a pointer to the axis controller. * diff --git a/src/sinqController.cpp b/src/sinqController.cpp index 322023f..09f530b 100644 --- a/src/sinqController.cpp +++ b/src/sinqController.cpp @@ -510,7 +510,7 @@ asynStatus sinqController::writeInt32(asynUser *pasynUser, epicsInt32 value) { // for velocity mode): if (value == 0 || value == 1) { setAxisParamChecked(axis, motorMode, value); - return asynMotorController::writeInt32(pasynUser, value); + return axis->setMode(value); } else { int axisNo; getAddress(pasynUser, &axisNo);