From 3ab40a8bf5bfd80c7e675333b662a8c7a850316c Mon Sep 17 00:00:00 2001 From: smathis Date: Wed, 17 Sep 2025 10:52:56 +0200 Subject: [PATCH] Fixed compiler warnings --- Makefile | 2 +- src/msgPrintControl.cpp | 4 ++-- src/sinqAxis.cpp | 30 +++++++++++++---------- src/sinqAxis.h | 6 ++--- src/sinqController.cpp | 53 ++++++++++++++++++++++++++++++----------- 5 files changed, 62 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index a94cf23..0bd2c57 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,6 @@ TEMPLATES += db/sinqMotor.db DBDS += src/sinqMotor.dbd USR_CFLAGS += -Wall -Wextra -Wunused-result # -Werror -USR_CXXFLAGS += -Wall -Wextra -Weffc++ -Wunused-result +USR_CXXFLAGS += -Wall -Wextra -Wunused-result # MISCS would be the place to keep the stream device template files diff --git a/src/msgPrintControl.cpp b/src/msgPrintControl.cpp index 24b714b..990b29a 100644 --- a/src/msgPrintControl.cpp +++ b/src/msgPrintControl.cpp @@ -92,8 +92,8 @@ bool msgPrintControl::shouldBePrinted(char *portName, int axisNo, const char *functionName, int line, bool wantToPrint, asynUser *pasynUser, size_t maxRepetitions) { - msgPrintControlKey key = - msgPrintControlKey(portName, axisNo, functionName, __LINE__); + msgPrintControlKey key = msgPrintControlKey(portName, axisNo, functionName, + line, maxRepetitions); return shouldBePrinted(key, wantToPrint, pasynUser); } diff --git a/src/sinqAxis.cpp b/src/sinqAxis.cpp index 7772476..e510412 100644 --- a/src/sinqAxis.cpp +++ b/src/sinqAxis.cpp @@ -318,7 +318,7 @@ asynStatus sinqAxis::forcedPoll(bool *moving) { return poll_status; } -asynStatus sinqAxis::doPoll(bool *moving) { return asynSuccess; } +asynStatus sinqAxis::doPoll(bool * /*moving*/) { return asynSuccess; } asynStatus sinqAxis::move(double position, int relative, double minVelocity, double maxVelocity, double acceleration) { @@ -354,8 +354,9 @@ asynStatus sinqAxis::move(double position, int relative, double minVelocity, return pC_->callParamCallbacks(); } -asynStatus sinqAxis::doMove(double position, int relative, double minVelocity, - double maxVelocity, double acceleration) { +asynStatus sinqAxis::doMove(double /*position*/, int /*relative*/, + double /*minVelocity*/, double /*maxVelocity*/, + double /*acceleration*/) { return asynSuccess; } @@ -397,8 +398,8 @@ asynStatus sinqAxis::home(double minVelocity, double maxVelocity, } } -asynStatus sinqAxis::doHome(double minVelocity, double maxVelocity, - double acceleration, int forwards) { +asynStatus sinqAxis::doHome(double /*minVelocity*/, double /*maxVelocity*/, + double /*acceleration*/, int /*forwards*/) { return asynSuccess; } @@ -420,7 +421,7 @@ asynStatus sinqAxis::reset() { asynStatus sinqAxis::doReset() { return asynError; } -asynStatus sinqAxis::enable(bool on) { return asynSuccess; } +asynStatus sinqAxis::enable(bool /*on*/) { return asynSuccess; } asynStatus sinqAxis::motorPosition(double *motorPos) { asynStatus status = asynSuccess; @@ -498,7 +499,7 @@ asynStatus sinqAxis::setVeloFields(double velo, double vbas, double vmax) { setAxisParamChecked( this, motorMessageText, "Speed is not inside limits. Set a new valid speed and try " - "moving. Otherwise, please call the support."); + "to move the motor. Otherwise, please call the support."); return asynError; } @@ -711,8 +712,9 @@ static const iocshArg setWatchdogEnabledArg2 = { "Enabling / disabling the watchdog", iocshArgInt}; static const iocshArg *const setWatchdogEnabledArgs[] = { &setWatchdogEnabledArg0, &setWatchdogEnabledArg1, &setWatchdogEnabledArg2}; -static const iocshFuncDef setWatchdogEnabledDef = {"setWatchdogEnabled", 3, - setWatchdogEnabledArgs}; +static const iocshFuncDef setWatchdogEnabledDef = { + "setWatchdogEnabled", 3, setWatchdogEnabledArgs, + "Set to 0 to disable the watchdog and to any other value to enable it."}; static void setWatchdogEnabledCallFunc(const iocshArgBuf *args) { setWatchdogEnabled(args[0].sval, args[1].ival, args[2].ival); @@ -758,8 +760,9 @@ static const iocshArg setOffsetMovTimeoutArg2 = {"Offset timeout for movement", static const iocshArg *const setOffsetMovTimeoutArgs[] = { &setOffsetMovTimeoutArg0, &setOffsetMovTimeoutArg1, &setOffsetMovTimeoutArg2}; -static const iocshFuncDef setOffsetMovTimeoutDef = {"setOffsetMovTimeout", 3, - setOffsetMovTimeoutArgs}; +static const iocshFuncDef setOffsetMovTimeoutDef = { + "setOffsetMovTimeout", 3, setOffsetMovTimeoutArgs, + "Specify an offset (in seconds) for the movement timeout watchdog"}; static void setOffsetMovTimeoutCallFunc(const iocshArgBuf *args) { setOffsetMovTimeout(args[0].sval, args[1].ival, args[2].dval); @@ -805,8 +808,9 @@ static const iocshArg setScaleMovTimeoutArg2 = { "Multiplier for calculated move time", iocshArgDouble}; static const iocshArg *const setScaleMovTimeoutArgs[] = { &setScaleMovTimeoutArg0, &setScaleMovTimeoutArg1, &setScaleMovTimeoutArg2}; -static const iocshFuncDef setScaleMovTimeoutDef = {"setScaleMovTimeout", 3, - setScaleMovTimeoutArgs}; +static const iocshFuncDef setScaleMovTimeoutDef = { + "setScaleMovTimeout", 3, setScaleMovTimeoutArgs, + "Set a scaling factor for the maximum expected movement time."}; static void setScaleMovTimeoutCallFunc(const iocshArgBuf *args) { setScaleMovTimeout(args[0].sval, args[1].ival, args[2].dval); diff --git a/src/sinqAxis.h b/src/sinqAxis.h index d451b98..b827dc7 100644 --- a/src/sinqAxis.h +++ b/src/sinqAxis.h @@ -606,7 +606,7 @@ template asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName, int (C::*func)(), int *readValue, const char *callerFunctionName, int lineNumber, - size_t msgSize, TypeTag) { + size_t /*msgSize*/, TypeTag) { int indexValue = (controller->*func)(); asynStatus status = controller->getIntegerParam(axis->axisNo(), indexValue, readValue); @@ -634,7 +634,7 @@ template asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName, int (C::*func)(), double *readValue, const char *callerFunctionName, int lineNumber, - size_t msgSize, TypeTag) { + size_t /*msgSize*/, TypeTag) { int indexValue = (controller->*func)(); asynStatus status = controller->getDoubleParam(axis->axisNo(), indexValue, readValue); @@ -665,7 +665,7 @@ template asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName, int (C::*func)(), std::string *readValue, const char *callerFunctionName, int lineNumber, - size_t msgSize, TypeTag) { + size_t /*msgSize*/, TypeTag) { int indexValue = (controller->*func)(); // Convert the pointer to a reference, since getStringParam expects the diff --git a/src/sinqController.cpp b/src/sinqController.cpp index 737aef4..98dbbf8 100644 --- a/src/sinqController.cpp +++ b/src/sinqController.cpp @@ -119,15 +119,35 @@ sinqController::sinqController(const char *portName, asynStatus status = asynSuccess; // The paramLib indices are populated with the calls to createParam - pSinqC_ = std::make_unique( - (sinqControllerImpl){.outstandingForcedFastPolls = 0, - .pasynOctetSyncIOipPort = nullptr, - .msgPrintC = msgPrintControl(), - .comTimeoutWindow = 3600, - .maxNumberTimeouts = 60, - .timeoutEvents = {}, - .maxSubsequentTimeouts = 10, - .maxSubsequentTimeoutsExceeded = false}); + pSinqC_ = std::make_unique((sinqControllerImpl){ + .outstandingForcedFastPolls = 0, + .pasynOctetSyncIOipPort = nullptr, + .msgPrintC = msgPrintControl(), + .comTimeoutWindow = 3600, + .maxNumberTimeouts = 60, + .timeoutEvents = {}, + .maxSubsequentTimeouts = 10, + .maxSubsequentTimeoutsExceeded = false, + .motorMessageText = 0, + .motorReset = 0, + .motorEnable = 0, + .motorEnableRBV = 0, + .motorCanDisable = 0, + .motorEnableMovWatchdog = 0, + .motorCanSetSpeed = 0, + .motorLimitsOffset = 0, + .motorForceStop = 0, + .motorConnected = 0, + .motorVeloFromDriver = 0, + .motorVbasFromDriver = 0, + .motorVmaxFromDriver = 0, + .motorAcclFromDriver = 0, + .motorHighLimitFromDriver = 0, + .motorLowLimitFromDriver = 0, + .motorPositionDeadband = 0, + .adaptivePolling = 0, + .encoderType = 0, + }); // Store the poll period information. The poller itself will be started // later (after the IOC is running in epicsInithookFunction) @@ -824,7 +844,8 @@ static const iocshArg *const setThresholdComTimeoutArgs[] = { &setThresholdComTimeoutArg0, &setThresholdComTimeoutArg1, &setThresholdComTimeoutArg2}; static const iocshFuncDef setThresholdComTimeoutDef = { - "setThresholdComTimeout", 3, setThresholdComTimeoutArgs}; + "setThresholdComTimeout", 3, setThresholdComTimeoutArgs, + "Set the communication timeout threshold in seconds"}; static void setThresholdComTimeoutCallFunc(const iocshArgBuf *args) { setThresholdComTimeout(args[0].sval, args[1].ival, args[2].ival); @@ -885,7 +906,9 @@ static const iocshArg SetMaxSubsequentTimeoutsArg1 = { static const iocshArg *const SetMaxSubsequentTimeoutsArgs[] = { &SetMaxSubsequentTimeoutsArg0, &SetMaxSubsequentTimeoutsArg1}; static const iocshFuncDef setMaxSubsequentTimeoutsDef = { - "setMaxSubsequentTimeouts", 2, SetMaxSubsequentTimeoutsArgs}; + "setMaxSubsequentTimeouts", 2, SetMaxSubsequentTimeoutsArgs, + "Set the maximum number of subsequent timeouts before the user receives an " + "error message"}; static void setMaxSubsequentTimeoutsCallFunc(const iocshArgBuf *args) { setMaxSubsequentTimeouts(args[0].sval, args[1].ival); } @@ -939,13 +962,15 @@ asynStatus setForcedFastPolls(const char *portName, int forcedFastPolls) { static const iocshArg SetForcedFastPollsArg0 = {"Controller name (e.g. mcu1)", iocshArgString}; static const iocshArg SetForcedFastPollsArg1 = { - "Number of fast polls after \"waking\" the poller (e.g. after issueing a " + "Number of fast polls after \"waking\" the poller (e.g. after issuing a " "move command).", iocshArgInt}; static const iocshArg *const SetForcedFastPollsArgs[] = { &SetForcedFastPollsArg0, &SetForcedFastPollsArg1}; -static const iocshFuncDef setForcedFastPollsDef = {"setForcedFastPolls", 2, - SetForcedFastPollsArgs}; +static const iocshFuncDef setForcedFastPollsDef = { + "setForcedFastPolls", 2, SetForcedFastPollsArgs, + "Set the number of fast polls after \"waking\" the poller (e.g. after " + "issuing a move command)."}; static void setForcedFastPollsCallFunc(const iocshArgBuf *args) { setForcedFastPolls(args[0].sval, args[1].ival); }