Split error handling in communication error and other errors.
This commit is contained in:
1 parent
a8d8a7dbaf
commit
420f0868fc
1 file changed
+17
-15
+17
-15
@@ -573,8 +573,9 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
rwStatus = readAxisError();
|
||||
}
|
||||
|
||||
msgPrintControlKey keyError = msgPrintControlKey(
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||
msgPrintControlKey commError = msgPrintControlKey(
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
{.maxRepetitions = 5, .minRepetitions = 1});
|
||||
|
||||
/*
|
||||
A communication error is a special case. If a communication between
|
||||
@@ -582,12 +583,10 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
since this information is not reliable.
|
||||
*/
|
||||
if (communicationError()) {
|
||||
// Ignore the first four communication errors.
|
||||
keyError.options_ = {.maxRepetitions = 8, .minRepetitions = 4};
|
||||
|
||||
if (pC_->getMsgPrintControl().repetitionCount(keyError) >
|
||||
keyError.options_.minRepetitions) {
|
||||
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||
if (pC_->getMsgPrintControl().repetitionCount(commError) >=
|
||||
commError.options_.minRepetitions) {
|
||||
if (pC_->getMsgPrintControl().shouldBePrinted(commError, true,
|
||||
pC_->pasynUser())) {
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line "
|
||||
@@ -600,15 +599,15 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
setAxisParamChecked(
|
||||
this, motorMessageText,
|
||||
"Communication error between MACS and controller. Try "
|
||||
"resetting "
|
||||
"the axis. If the error persists, call the support.");
|
||||
"resetting the axis. If the error persists, call the support.");
|
||||
|
||||
poll_status = asynError;
|
||||
} else {
|
||||
pC_->getMsgPrintControl().incrementRepetitionCount(keyError);
|
||||
pC_->getMsgPrintControl().incrementRepetitionCount(commError);
|
||||
}
|
||||
|
||||
} else {
|
||||
pC_->getMsgPrintControl().resetCount(commError, pC_->pasynUser());
|
||||
|
||||
// This buffer must be initialized to zero because we build the
|
||||
// error message by appending strings.
|
||||
@@ -781,8 +780,11 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
poll_status = asynError;
|
||||
}
|
||||
|
||||
msgPrintControlKey otherErrors = msgPrintControlKey(
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||
|
||||
if (strlen(shellMessage) > 0) {
|
||||
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||
if (pC_->getMsgPrintControl().shouldBePrinted(otherErrors, true,
|
||||
pC_->pasynUser())) {
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line "
|
||||
@@ -793,11 +795,11 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
}
|
||||
|
||||
setAxisParamChecked(this, motorMessageText, errorMessage);
|
||||
}
|
||||
|
||||
// No error has been detected -> Reset the error count
|
||||
if (poll_status == asynSuccess) {
|
||||
pC_->getMsgPrintControl().resetCount(keyError, pC_->pasynUser());
|
||||
// No error has been detected -> Reset the error count
|
||||
if (poll_status == asynSuccess) {
|
||||
pC_->getMsgPrintControl().resetCount(otherErrors, pC_->pasynUser());
|
||||
}
|
||||
}
|
||||
|
||||
// Read out the limits, if the motor is not moving and if the limits are
|
||||
|
||||
Reference in new issue
Block a user