From b267200039fa693598bd5a656709c0cc81cc1247 Mon Sep 17 00:00:00 2001 From: smathis Date: Wed, 14 May 2025 16:07:03 +0200 Subject: [PATCH] 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. --- src/sinqAxis.cpp | 9 +++++++++ src/sinqController.cpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/sinqAxis.cpp b/src/sinqAxis.cpp index de89666..9c68aa2 100644 --- a/src/sinqAxis.cpp +++ b/src/sinqAxis.cpp @@ -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); } diff --git a/src/sinqController.cpp b/src/sinqController.cpp index 2da6b7b..296ed7d 100644 --- a/src/sinqController.cpp +++ b/src/sinqController.cpp @@ -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; }