Fixed a bug in msgPrintControl

This commit is contained in:
2025-03-19 15:01:20 +01:00
parent f26d1bb612
commit 828e9bc59c
3 changed files with 25 additions and 6 deletions

View File

@ -139,7 +139,7 @@ class msgPrintControl {
private:
std::unordered_map<msgPrintControlKey, size_t> map_;
char suffix_[200] = {0};
char suffix_[300] = {0};
};
#endif

View File

@ -15,6 +15,19 @@ sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
offsetMovTimeout_ = 30;
targetPosition_ = 0.0;
// This check is also done in asynMotorAxis, but there the IOC continues
// running even though the configuration is incorrect. When failing this
// check, the IOC is stopped, since this is definitely a configuration
// problem.
if ((axisNo < 0) || (axisNo >= pC->numAxes())) {
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
"(axis index %d is not in range 0 to %d)\n. Terminating IOC",
pC->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, axisNo,
pC->numAxes() - 1);
exit(-1);
}
// Motor is assumed to be enabled
status = setIntegerParam(pC_->motorEnableRBV(), 1);
if (status != asynSuccess) {
@ -699,9 +712,9 @@ asynStatus setScaleMovTimeout(const char *portName, int axisNo,
sinqAxis *axis = dynamic_cast<sinqAxis *>(asynAxis);
if (axis == nullptr) {
errlogPrintf("Controller \"%s\" => %s, line %d:\nAxis %d does not "
"exist or is not an "
"instance of sinqAxis.",
"exist or is not an instance of sinqAxis.",
portName, __PRETTY_FUNCTION__, __LINE__, axisNo);
return asynError;
}
return axis->setScaleMovTimeout(scaleMovTimeout);

View File

@ -274,9 +274,15 @@ sinqController::sinqController(const char *portName,
}
sinqController::~sinqController(void) {
/*
Cleanup of the memory allocated in the asynMotorController constructor
*/
// Free all axes
for (int axisNo = 0; axisNo < numAxes_; axisNo++) {
if (pAxes_[axisNo] != nullptr) {
delete pAxes_[axisNo];
}
}
// Cleanup of the array allocated in the asynMotorController constructor
free(this->pAxes_);
}