Modified communication protocol for MCU software 2.0
This commit is contained in:
@@ -303,6 +303,34 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
|
||||
// Are we currently waiting for a handshake?
|
||||
if (waitForHandshake_) {
|
||||
|
||||
// Check if the handshake takes too long and communicate an error in
|
||||
// this case. A handshake should not take more than 5 seconds.
|
||||
time_t currentTime = time(NULL);
|
||||
bool timedOut = (currentTime > timeAtHandshake_ + 5);
|
||||
|
||||
if (pC_->msgPrintControl_.shouldBePrinted(
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, timedOut,
|
||||
pC_->pasynUserSelf)) {
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d\nAsked for a "
|
||||
"handshake at %ld s and didn't get a positive reply yet "
|
||||
"(current time is %ld s).\n",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
timeAtHandshake_, currentTime);
|
||||
}
|
||||
|
||||
if (timedOut) {
|
||||
pl_status =
|
||||
setStringParam(pC_->motorMessageText_,
|
||||
"Timed out while waiting for a handshake");
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
pC_->read(axisNo_, 86, response);
|
||||
if (rw_status != asynSuccess) {
|
||||
return rw_status;
|
||||
@@ -580,7 +608,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pC_->msgPrintControl_.resetCount(keyError);
|
||||
pC_->msgPrintControl_.resetCount(keyError, pC_->pasynUserSelf);
|
||||
}
|
||||
|
||||
// Read out the limits, if the motor is not moving
|
||||
|
||||
Reference in New Issue
Block a user