diff --git a/sinqEPICSApp/src/pmacAxis.cpp b/sinqEPICSApp/src/pmacAxis.cpp index 4359508..52c0060 100644 --- a/sinqEPICSApp/src/pmacAxis.cpp +++ b/sinqEPICSApp/src/pmacAxis.cpp @@ -340,7 +340,7 @@ asynStatus pmacAxis::getAxisStatus(bool *moving) char command[pC_->PMAC_MAXBUF_]; char response[pC_->PMAC_MAXBUF_]; int cmdStatus = 0;; - int done = 0; + int done = 0, posChanging = 0; double position = 0; int nvals = 0; int axisProblemFlag = 0; @@ -441,25 +441,33 @@ 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(status6Time == 0){ status6Time = time(NULL); + statusPos = position; } else { if(time(NULL) > status6Time + 60){ - done = 1; - *moving = false; - setIntegerParam(pC_->motorStatusMoving_, false); - setIntegerParam(pC_->motorStatusDone_, true); - setIntegerParam(pC_->motorStatusProblem_, true); - errlogPrintf("Axis %d stayed in 5,6 for more then 60 seconds BROKEN\n", axisNo_); - updateMsgTxtFromDriver("Axis stayed in 5,6 for more then 60 seconds: BROKEN"); - status6Time = 0; - return asynSuccess; + /* trigger error only when not moving */ + if(abs(position-statusPos) < .1){ + done = 1; + *moving = false; + setIntegerParam(pC_->motorStatusMoving_, false); + setIntegerParam(pC_->motorStatusDone_, true); + setIntegerParam(pC_->motorStatusProblem_, true); + errlogPrintf("Axis %d stayed in 5,6 for more then 60 seconds BROKEN\n", axisNo_); + updateMsgTxtFromDriver("Axis stayed in 5,6 for more then 60 seconds: BROKEN"); + status6Time = 0; + return asynSuccess; + } else { + status6Time = time(NULL); + statusPos = position; + } } } - } + } + if (!done) { *moving = true; diff --git a/sinqEPICSApp/src/pmacAxis.h b/sinqEPICSApp/src/pmacAxis.h index 51c777e..bb995eb 100644 --- a/sinqEPICSApp/src/pmacAxis.h +++ b/sinqEPICSApp/src/pmacAxis.h @@ -56,6 +56,7 @@ class pmacAxis : public SINQAxis time_t status6Time; int starting; int homing; + double statusPos; friend class pmacController; };