diff --git a/sinqEPICSApp/src/pmacAxis.cpp b/sinqEPICSApp/src/pmacAxis.cpp index 0c29be8..e53eb79 100644 --- a/sinqEPICSApp/src/pmacAxis.cpp +++ b/sinqEPICSApp/src/pmacAxis.cpp @@ -16,7 +16,7 @@ * when the motor is hung, it wont start. I check for this and cause an alarm. * * Another mode where the motor is in trouble is if it stays too long in status - *5 or 6. I check and cause an alarm in this state too. + * 5 or 6. I check and cause an alarm in this state too. * * Mark Koennecke, February 2013 * @@ -339,7 +339,7 @@ static char *translateAxisError(int axErr) { return strdup("command not allowed"); break; case 6: - return strdup("watchdog triggere"); + return strdup("watchdog triggered"); break; case 7: return strdup("current limit reached"); @@ -985,24 +985,6 @@ asynStatus pmacV3Axis::getAxisStatus(bool *moving) { done = 0; } - // if (starting && time(NULL) > startTime + 10) { - // /* - // did not start in 10 seconds: messed up: cause an alarm - // */ - // done = 1; - // *moving = false; - // st = setIntegerParam(pC_->motorStatusMoving_, false); - // cmdStatus = cmdStatus > st ? cmdStatus : st; - // st = setIntegerParam(pC_->motorStatusDone_, true); - // cmdStatus = cmdStatus > st ? cmdStatus : st; - // st = setIntegerParam(pC_->motorStatusProblem_, true); - // cmdStatus = cmdStatus > st ? cmdStatus : st; - // errlogPrintf("Axis %d did not start within 10 seconds!! BROKEN\n", axisNo_); - // updateMsgTxtFromDriver("Axis did not start within 10 seconds"); - // starting = 0; - // return st; - // } - // /* // code to test against too long status 5 or 6 // */ @@ -1014,20 +996,11 @@ asynStatus pmacV3Axis::getAxisStatus(bool *moving) { EstimatedTimeOfArrival = std::ceil(2 * std::fabs(setpointPosition_ - position) / Speed); - } - else { + } else { if (time(NULL) > status6Time + EstimatedTimeOfArrival) { /* trigger error only when not moving */ if (abs(position - statusPos) < .1) { - // done = 1; - // *moving = false; - // st = setIntegerParam(pC_->motorStatusMoving_, false); - // cmdStatus = cmdStatus > st ? cmdStatus : st; - // st = setIntegerParam(pC_->motorStatusDone_, true); - // cmdStatus = cmdStatus > st ? cmdStatus : st; - // st = setIntegerParam(pC_->motorStatusProblem_, true); - // cmdStatus = cmdStatus > st ? cmdStatus : st; - + done = 1; errlogPrintf( "Axis %d stayed in 5,6 for more than %d seconds BROKEN\n", axisNo_, EstimatedTimeOfArrival); @@ -1148,6 +1121,40 @@ asynStatus pmacV3Axis::getAxisStatus(bool *moving) { axisProblemFlag = 0; axisErrorCount = 0; } + + // test for more error conditions encoded in axStat + switch(axStat) { + case -4: + snprintf(message, sizeof(message), "PMAC: %s on %d", + "Emergency stop activated", axisNo_); + updateMsgTxtFromDriver(message); + asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "%s\n", message); + axisProblemFlag = 1; + break; + case -5: + snprintf(message, sizeof(message), "PMAC: %s on %d", + "Motor is not installed", axisNo_); + updateMsgTxtFromDriver(message); + asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "%s\n", message); + axisProblemFlag = 1; + break; + case -3: + snprintf(message, sizeof(message), "PMAC: %s on %d", + "Axis disabled", axisNo_); + updateMsgTxtFromDriver(message); + asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "%s\n", message); + axisProblemFlag = 1; + break; + case -2: + case -1: + snprintf(message, sizeof(message), "PMAC: %s on %d", + "Axis locked", axisNo_); + updateMsgTxtFromDriver(message); + asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "%s\n", message); + axisProblemFlag = 1; + break; + } + st = setIntegerParam(pC_->motorStatusProblem_, axisProblemFlag); cmdStatus = cmdStatus > st ? cmdStatus : st; @@ -1163,4 +1170,4 @@ asynStatus pmacV3Axis::move(double position, int relative, double min_velocity, } updateMsgTxtFromDriver(""); return pmacAxis::move(position, relative, min_velocity, max_velocity, acceleration); -} \ No newline at end of file +}