Simplified paramLib access and show error messages for one poll cycle

Simplified getting and setting paramLib entries via a macro and created
a mechanism within poll() which makes sure that error messages are shown
for at least one poll cycle. Also moved MAXBUF_ to the SinqController
level.
This commit is contained in:
2025-05-14 16:07:03 +02:00
parent 9bc90cff61
commit b267200039
2 changed files with 10 additions and 1 deletions

View File

@ -327,8 +327,17 @@ asynStatus sinqAxis::poll(bool *moving) {
message entry which is currently in the paramLib.
*/
if (poll_status != asynSuccess || waitingMessage[0] != '\0') {
/*
If doPoll cleared the error message paramLib entry, but an old message
is still waiting, set the old message.
*/
getAxisParamChecked(this, motorMessageText, &newMessage);
if (newMessage[0] == '\0') {
setAxisParamChecked(this, motorMessageText, waitingMessage);
}
setAxisParamChecked(this, motorStatusProblem, true);
} else {
// No errors are waiting -> Clear everything.
setAxisParamChecked(this, motorMessageText, "");
setAxisParamChecked(this, motorStatusProblem, false);
}

View File

@ -495,7 +495,7 @@ asynStatus sinqController::checkComTimeoutWatchdog(sinqAxis *axis) {
asynStatus status =
checkComTimeoutWatchdog(axis->axisNo(), errorMessage, MAXBUF_);
if (status == asynError) {
setAxisParamChecked(axis, motorMessageText, motorMessage);
setAxisParamChecked(axis, motorMessageText, errorMessage);
}
return status;
}