Fixed a bug in the pmac driver which caused wrong state 5/6 errors to be

found on a slow motor.
This commit is contained in:
2019-10-30 11:32:33 +01:00
parent 3133d933fa
commit 5aefbd4684
2 changed files with 21 additions and 12 deletions

View File

@ -340,7 +340,7 @@ asynStatus pmacAxis::getAxisStatus(bool *moving)
char command[pC_->PMAC_MAXBUF_]; char command[pC_->PMAC_MAXBUF_];
char response[pC_->PMAC_MAXBUF_]; char response[pC_->PMAC_MAXBUF_];
int cmdStatus = 0;; int cmdStatus = 0;;
int done = 0; int done = 0, posChanging = 0;
double position = 0; double position = 0;
int nvals = 0; int nvals = 0;
int axisProblemFlag = 0; int axisProblemFlag = 0;
@ -441,26 +441,34 @@ asynStatus pmacAxis::getAxisStatus(bool *moving)
} }
/* /*
code to check for checking against too long status 6 code to test against too long status 5 or 6
*/ */
if(axStat == 5 || axStat == 6){ if(axStat == 5 || axStat == 6){
if(status6Time == 0){ if(status6Time == 0){
status6Time = time(NULL); status6Time = time(NULL);
statusPos = position;
} else { } else {
if(time(NULL) > status6Time + 60){ if(time(NULL) > status6Time + 60){
done = 1; /* trigger error only when not moving */
*moving = false; if(abs(position-statusPos) < .1){
setIntegerParam(pC_->motorStatusMoving_, false); done = 1;
setIntegerParam(pC_->motorStatusDone_, true); *moving = false;
setIntegerParam(pC_->motorStatusProblem_, true); setIntegerParam(pC_->motorStatusMoving_, false);
errlogPrintf("Axis %d stayed in 5,6 for more then 60 seconds BROKEN\n", axisNo_); setIntegerParam(pC_->motorStatusDone_, true);
updateMsgTxtFromDriver("Axis stayed in 5,6 for more then 60 seconds: BROKEN"); setIntegerParam(pC_->motorStatusProblem_, true);
status6Time = 0; errlogPrintf("Axis %d stayed in 5,6 for more then 60 seconds BROKEN\n", axisNo_);
return asynSuccess; updateMsgTxtFromDriver("Axis stayed in 5,6 for more then 60 seconds: BROKEN");
status6Time = 0;
return asynSuccess;
} else {
status6Time = time(NULL);
statusPos = position;
}
} }
} }
} }
if (!done) { if (!done) {
*moving = true; *moving = true;
setIntegerParam(pC_->motorStatusMoving_, true); setIntegerParam(pC_->motorStatusMoving_, true);

View File

@ -56,6 +56,7 @@ class pmacAxis : public SINQAxis
time_t status6Time; time_t status6Time;
int starting; int starting;
int homing; int homing;
double statusPos;
friend class pmacController; friend class pmacController;
}; };