Added message print control for movement timout watchdog

This commit is contained in:
2025-04-22 11:43:47 +02:00
parent 228bcf7fd7
commit 76a91d4a2f

View File

@ -670,14 +670,22 @@ asynStatus sinqAxis::checkMovTimeoutWatchdog(bool moving) {
return asynSuccess; return asynSuccess;
} }
// Create the unique callsite identifier manually so it can be used later in
// the shouldBePrinted calls.
msgPrintControlKey key = msgPrintControlKey(pC_->portName, axisNo_,
__PRETTY_FUNCTION__, __LINE__);
// Check if the expected time of arrival has been exceeded. // Check if the expected time of arrival has been exceeded.
if (expectedArrivalTime_ < time(NULL)) { if (expectedArrivalTime_ < time(NULL)) {
// Check the watchdog // Check the watchdog
if (pC_->getMsgPrintControl().shouldBePrinted(key, true,
pC_->pasynUser())) {
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR, asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d:\nExceeded " "Controller \"%s\", axis %d => %s, line %d:\nExceeded "
"expected arrival time %ld (current time is %ld).\n", "expected arrival time %ld (current time is %ld).\n",
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
expectedArrivalTime_, time(NULL)); expectedArrivalTime_, time(NULL));
}
pl_status = setStringParam( pl_status = setStringParam(
pC_->motorMessageText(), pC_->motorMessageText(),
@ -693,12 +701,13 @@ asynStatus sinqAxis::checkMovTimeoutWatchdog(bool moving) {
pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", axisNo_, pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", axisNo_,
__PRETTY_FUNCTION__, __LINE__); __PRETTY_FUNCTION__, __LINE__);
} }
} else {
pC_->getMsgPrintControl().resetCount(key, pC_->pasynUser());
}
// Even if the movement timed out, the rest of the poll should continue. // Even if the movement timed out, the rest of the poll should continue.
return asynSuccess; return asynSuccess;
} }
return asynSuccess;
}
// ============================================================================= // =============================================================================
// IOC shell functions // IOC shell functions
@ -773,8 +782,7 @@ asynStatus setOffsetMovTimeout(const char *portName, int axisNo,
sinqAxis *axis = dynamic_cast<sinqAxis *>(asynAxis); sinqAxis *axis = dynamic_cast<sinqAxis *>(asynAxis);
if (axis == nullptr) { if (axis == nullptr) {
errlogPrintf("Controller \"%s\" => %s, line %d:\nAxis %d does not " errlogPrintf("Controller \"%s\" => %s, line %d:\nAxis %d does not "
"exist or is not an " "exist or is not an instance of sinqAxis.",
"instance of sinqAxis.",
portName, __PRETTY_FUNCTION__, __LINE__, axisNo); portName, __PRETTY_FUNCTION__, __LINE__, axisNo);
} }