SICS-719: Acknowledge errors when in protocol 2 or 3

This commit is contained in:
Ferdi Franceschini
2014-01-30 12:30:14 +11:00
committed by Ferdi Franceschini
parent c2c7128245
commit f6ae3c62f7

View File

@@ -1553,6 +1553,8 @@ static int rspStatus(pDMC2280Driv self, const char* text) {
int iRet, iFlags;
int iSteps, iCounts;
int iTIzero, iTIone, iIOByte, iStopCode, iXQ0, iBG;
char cmd[CMDLEN];
iRet = sscanf(text, "%d %d %d %d %d %d %d %d",
&iSteps, &iCounts, &iFlags, &iBG,
&iStopCode, &iTIzero, &iTIone, &iXQ0);
@@ -1634,8 +1636,13 @@ static int rspStatus(pDMC2280Driv self, const char* text) {
self->ampError = !(1 & (iIOByte >> (self->axisLabel - 'E')));
#endif
self->runError = iBG < 0 ? iBG : 0;
if (iBG < 0)
if (iBG < 0) {
snprintf(self->dmc2280Error, CMDLEN, "MOTOR CONTROLLER RUN ERROR: %d", iBG);
if (self->protocol == 3) {
snprintf(cmd, CMDLEN, "RUN%cAK=1", self->axisLabel);
DMC_Send(self, cmd);
}
}
self->threadError = self->thread0 < 0;
self->moving = iBG > 0;
if (self->protocol == 3 && !(self->variables & VAR_STP)) {
@@ -1685,9 +1692,14 @@ static int rspVars(pDMC2280Driv self, const char* text) {
static int rspPoll(pDMC2280Driv self, const char* text) {
int iReply = atoi(text);
if (iReply < 0)
char cmd[CMDLEN];
if (iReply < 0) {
snprintf(self->dmc2280Error, CMDLEN, "MOTOR CONTROLLER REQ ERROR: %d",
iReply);
snprintf(cmd, CMDLEN, "RSP%cAK=1", self->axisLabel);
DMC_Send(self, cmd);
}
return iReply;
}