The member variable oredMSR of EL734Axis contains the axis status from the previous poll.
Therefore, it needs to initialized with a sensible value (i.e. 1 which means that the axis is standing still and has no errors.
This commit is contained in:
@ -11,7 +11,6 @@ Mark Koennecke, May, August 2017
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -30,7 +29,6 @@ Mark Koennecke, May, August 2017
|
|||||||
|
|
||||||
#define IDLEPOLL 60
|
#define IDLEPOLL 60
|
||||||
|
|
||||||
|
|
||||||
/** Creates a new EL734Controller object.
|
/** Creates a new EL734Controller object.
|
||||||
* \param[in] portName The name of the asyn port that will be created for this driver
|
* \param[in] portName The name of the asyn port that will be created for this driver
|
||||||
* \param[in] EL734PortName The name of the drvAsynSerialPort that was created previously to connect to the EL734 controller
|
* \param[in] EL734PortName The name of the drvAsynSerialPort that was created previously to connect to the EL734 controller
|
||||||
@ -43,10 +41,10 @@ EL734Controller::EL734Controller(const char *portName, const char *EL734PortName
|
|||||||
asynStatus status;
|
asynStatus status;
|
||||||
static const char *functionName = "EL734Controller::EL734Controller";
|
static const char *functionName = "EL734Controller::EL734Controller";
|
||||||
|
|
||||||
|
|
||||||
/* Connect to EL734 controller */
|
/* Connect to EL734 controller */
|
||||||
status = pasynOctetSyncIO->connect(EL734PortName, 0, &pasynUserController_, NULL);
|
status = pasynOctetSyncIO->connect(EL734PortName, 0, &pasynUserController_, NULL);
|
||||||
if (status) {
|
if (status)
|
||||||
|
{
|
||||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||||
"%s: cannot connect to EL734 controller\n",
|
"%s: cannot connect to EL734 controller\n",
|
||||||
functionName);
|
functionName);
|
||||||
@ -56,14 +54,14 @@ EL734Controller::EL734Controller(const char *portName, const char *EL734PortName
|
|||||||
|
|
||||||
switchRemote();
|
switchRemote();
|
||||||
|
|
||||||
for (axis=0; axis<numAxes; axis++) {
|
for (axis = 0; axis < numAxes; axis++)
|
||||||
|
{
|
||||||
new EL734Axis(this, axis + 1);
|
new EL734Axis(this, axis + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
startPoller(1000. / 1000., IDLEPOLL, 2);
|
startPoller(1000. / 1000., IDLEPOLL, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Creates a new EL734Controller object.
|
/** Creates a new EL734Controller object.
|
||||||
* Configuration command, called directly or from iocsh
|
* Configuration command, called directly or from iocsh
|
||||||
* \param[in] portName The name of the asyn port that will be created for this driver
|
* \param[in] portName The name of the asyn port that will be created for this driver
|
||||||
@ -72,8 +70,7 @@ EL734Controller::EL734Controller(const char *portName, const char *EL734PortName
|
|||||||
*/
|
*/
|
||||||
extern "C" int EL734CreateController(const char *portName, const char *EL734PortName, int numAxes)
|
extern "C" int EL734CreateController(const char *portName, const char *EL734PortName, int numAxes)
|
||||||
{
|
{
|
||||||
EL734Controller *pEL734Controller
|
EL734Controller *pEL734Controller = new EL734Controller(portName, EL734PortName, numAxes);
|
||||||
= new EL734Controller(portName, EL734PortName, numAxes);
|
|
||||||
pEL734Controller = NULL;
|
pEL734Controller = NULL;
|
||||||
return (asynSuccess);
|
return (asynSuccess);
|
||||||
}
|
}
|
||||||
@ -148,8 +145,10 @@ asynStatus EL734Controller::transactController(int axisNo,char command[COMLEN],
|
|||||||
|
|
||||||
status = pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
status = pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
||||||
reply, COMLEN, 2., &out, &in, &reason);
|
reply, COMLEN, 2., &out, &in, &reason);
|
||||||
if(status != asynSuccess){
|
if (status != asynSuccess)
|
||||||
if(axis!= NULL){
|
{
|
||||||
|
if (axis != NULL)
|
||||||
|
{
|
||||||
axis->updateMsgTxtFromDriver("Lost connection to motor controller");
|
axis->updateMsgTxtFromDriver("Lost connection to motor controller");
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
@ -158,7 +157,8 @@ asynStatus EL734Controller::transactController(int axisNo,char command[COMLEN],
|
|||||||
/*
|
/*
|
||||||
check for the offline reply
|
check for the offline reply
|
||||||
*/
|
*/
|
||||||
if(strstr(reply,"?LOC") != NULL){
|
if (strstr(reply, "?LOC") != NULL)
|
||||||
|
{
|
||||||
switchRemote();
|
switchRemote();
|
||||||
return pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
return pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
||||||
reply, COMLEN, 1., &out, &in, &reason);
|
reply, COMLEN, 1., &out, &in, &reason);
|
||||||
@ -167,7 +167,8 @@ asynStatus EL734Controller::transactController(int axisNo,char command[COMLEN],
|
|||||||
/*
|
/*
|
||||||
check for echos. This means that the thing is offline.
|
check for echos. This means that the thing is offline.
|
||||||
*/
|
*/
|
||||||
if(strstr(reply,"p ") != NULL || strstr(reply,"u ") != NULL || strstr(reply,"msr ") != NULL){
|
if (strstr(reply, "p ") != NULL || strstr(reply, "u ") != NULL || strstr(reply, "msr ") != NULL)
|
||||||
|
{
|
||||||
switchRemote();
|
switchRemote();
|
||||||
return pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
return pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
||||||
reply, COMLEN, 1., &out, &in, &reason);
|
reply, COMLEN, 1., &out, &in, &reason);
|
||||||
@ -176,27 +177,36 @@ asynStatus EL734Controller::transactController(int axisNo,char command[COMLEN],
|
|||||||
check for EL734 errors
|
check for EL734 errors
|
||||||
*/
|
*/
|
||||||
strcpy(myReply, reply);
|
strcpy(myReply, reply);
|
||||||
for(i = 0; i < strlen(reply); i++){
|
for (i = 0; i < strlen(reply); i++)
|
||||||
|
{
|
||||||
myReply[i] = (char)tolower((int)reply[i]);
|
myReply[i] = (char)tolower((int)reply[i]);
|
||||||
}
|
}
|
||||||
if(strstr(myReply,"?cmd") != NULL){
|
if (strstr(myReply, "?cmd") != NULL)
|
||||||
|
{
|
||||||
snprintf(errTxt, sizeof(errTxt), "Bad command %s at axis %d", command, axisNo);
|
snprintf(errTxt, sizeof(errTxt), "Bad command %s at axis %d", command, axisNo);
|
||||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, errTxt);
|
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, errTxt);
|
||||||
if(axis!= NULL){
|
if (axis != NULL)
|
||||||
|
{
|
||||||
axis->updateMsgTxtFromDriver(errTxt);
|
axis->updateMsgTxtFromDriver(errTxt);
|
||||||
}
|
}
|
||||||
return asynError;
|
return asynError;
|
||||||
} else if(strstr(myReply,"?par") != NULL){
|
}
|
||||||
|
else if (strstr(myReply, "?par") != NULL)
|
||||||
|
{
|
||||||
snprintf(errTxt, sizeof(errTxt), "Bad parameter in command %s", command);
|
snprintf(errTxt, sizeof(errTxt), "Bad parameter in command %s", command);
|
||||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, errTxt);
|
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, errTxt);
|
||||||
if(axis!= NULL){
|
if (axis != NULL)
|
||||||
|
{
|
||||||
axis->updateMsgTxtFromDriver(errTxt);
|
axis->updateMsgTxtFromDriver(errTxt);
|
||||||
}
|
}
|
||||||
return asynError;
|
return asynError;
|
||||||
} else if(strstr(myReply,"?rng") != NULL){
|
}
|
||||||
|
else if (strstr(myReply, "?rng") != NULL)
|
||||||
|
{
|
||||||
snprintf(errTxt, sizeof(errTxt), "Parameter out of range in command %s", command);
|
snprintf(errTxt, sizeof(errTxt), "Parameter out of range in command %s", command);
|
||||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, errTxt);
|
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, errTxt);
|
||||||
if(axis!= NULL){
|
if (axis != NULL)
|
||||||
|
{
|
||||||
axis->updateMsgTxtFromDriver(errTxt);
|
axis->updateMsgTxtFromDriver(errTxt);
|
||||||
}
|
}
|
||||||
return asynError;
|
return asynError;
|
||||||
@ -226,24 +236,34 @@ EL734Axis::EL734Axis(EL734Controller *pC, int axisNo)
|
|||||||
*/
|
*/
|
||||||
sprintf(command, "H %d", axisNo_);
|
sprintf(command, "H %d", axisNo_);
|
||||||
status = pC_->transactController(axisNo_, command, reply);
|
status = pC_->transactController(axisNo_, command, reply);
|
||||||
if(status == asynSuccess){
|
if (status == asynSuccess)
|
||||||
|
{
|
||||||
count = sscanf(reply, "%f %f", &low, &high);
|
count = sscanf(reply, "%f %f", &low, &high);
|
||||||
if(count >= 2){
|
if (count >= 2)
|
||||||
|
{
|
||||||
pC_->setDoubleParam(axisNo_, pC_->motorLowLimit_, low);
|
pC_->setDoubleParam(axisNo_, pC_->motorLowLimit_, low);
|
||||||
pC_->setDoubleParam(axisNo_, pC_->motorHighLimit_, high);
|
pC_->setDoubleParam(axisNo_, pC_->motorHighLimit_, high);
|
||||||
callParamCallbacks();
|
callParamCallbacks();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||||
"Bad response - %s - requesting limits at axis %d", reply, axisNo_);
|
"Bad response - %s - requesting limits at axis %d", reply, axisNo_);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||||
"Failed to read limits at axis %d", axisNo_);
|
"Failed to read limits at axis %d", axisNo_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
oredMSR contains the axis status from the previous poll. The initial value
|
||||||
|
1 means that the axis is not moving and has no errors.
|
||||||
|
*/
|
||||||
|
oredMSR = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Reports on status of the axis
|
/** Reports on status of the axis
|
||||||
* \param[in] fp The file pointer on which report information will be written
|
* \param[in] fp The file pointer on which report information will be written
|
||||||
* \param[in] level The level of report detail desired
|
* \param[in] level The level of report detail desired
|
||||||
@ -252,7 +272,8 @@ EL734Axis::EL734Axis(EL734Controller *pC, int axisNo)
|
|||||||
*/
|
*/
|
||||||
void EL734Axis::report(FILE *fp, int level)
|
void EL734Axis::report(FILE *fp, int level)
|
||||||
{
|
{
|
||||||
if (level > 0) {
|
if (level > 0)
|
||||||
|
{
|
||||||
fprintf(fp, " axis %d\n",
|
fprintf(fp, " axis %d\n",
|
||||||
axisNo_);
|
axisNo_);
|
||||||
}
|
}
|
||||||
@ -261,7 +282,6 @@ void EL734Axis::report(FILE *fp, int level)
|
|||||||
// asynMotorAxis::report(fp, level);
|
// asynMotorAxis::report(fp, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
asynStatus EL734Axis::move(double position, int relative, double minVelocity, double maxVelocity, double acceleration)
|
asynStatus EL734Axis::move(double position, int relative, double minVelocity, double maxVelocity, double acceleration)
|
||||||
{
|
{
|
||||||
asynStatus status;
|
asynStatus status;
|
||||||
@ -278,10 +298,10 @@ asynStatus EL734Axis::move(double position, int relative, double minVelocity, do
|
|||||||
sprintf(command, "J %d %d", axisNo_, (int)maxVelocity);
|
sprintf(command, "J %d %d", axisNo_, (int)maxVelocity);
|
||||||
status = pC_->transactController(axisNo_, command, reply);
|
status = pC_->transactController(axisNo_, command, reply);
|
||||||
|
|
||||||
if (relative) {
|
if (relative)
|
||||||
|
{
|
||||||
position += this->position;
|
position += this->position;
|
||||||
}
|
}
|
||||||
oredMSR = 0;
|
|
||||||
homing = 0;
|
homing = 0;
|
||||||
errorReported = 0;
|
errorReported = 0;
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||||
@ -323,12 +343,14 @@ asynStatus EL734Axis::moveVelocity(double minVelocity, double maxVelocity, doubl
|
|||||||
// "%s: minVelocity=%f, maxVelocity=%f, acceleration=%f\n",
|
// "%s: minVelocity=%f, maxVelocity=%f, acceleration=%f\n",
|
||||||
// functionName, minVelocity, maxVelocity, acceleration);
|
// functionName, minVelocity, maxVelocity, acceleration);
|
||||||
|
|
||||||
|
|
||||||
errorReported = 0;
|
errorReported = 0;
|
||||||
if (maxVelocity > 0.) {
|
if (maxVelocity > 0.)
|
||||||
|
{
|
||||||
/* This is a positive move */
|
/* This is a positive move */
|
||||||
sprintf(command, "FF %d", axisNo_);
|
sprintf(command, "FF %d", axisNo_);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* This is a negative move */
|
/* This is a negative move */
|
||||||
sprintf(command, "FB %d", axisNo_);
|
sprintf(command, "FB %d", axisNo_);
|
||||||
}
|
}
|
||||||
@ -347,7 +369,8 @@ asynStatus EL734Axis::stop(double acceleration )
|
|||||||
bool moving = false;
|
bool moving = false;
|
||||||
|
|
||||||
this->poll(&moving);
|
this->poll(&moving);
|
||||||
if(moving && errorReported == 0){
|
if (moving && errorReported == 0)
|
||||||
|
{
|
||||||
sprintf(command, "S %d", axisNo_);
|
sprintf(command, "S %d", axisNo_);
|
||||||
status = pC_->transactController(axisNo_, command, reply);
|
status = pC_->transactController(axisNo_, command, reply);
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "Sent STOP on Axis %d\n", axisNo_);
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "Sent STOP on Axis %d\n", axisNo_);
|
||||||
@ -397,7 +420,8 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
char command[COMLEN], reply[COMLEN], errTxt[256];
|
char command[COMLEN], reply[COMLEN], errTxt[256];
|
||||||
|
|
||||||
// protect against excessive polling
|
// protect against excessive polling
|
||||||
if(time(NULL) < next_poll){
|
if (time(NULL) < next_poll)
|
||||||
|
{
|
||||||
*moving = false;
|
*moving = false;
|
||||||
return asynSuccess;
|
return asynSuccess;
|
||||||
}
|
}
|
||||||
@ -405,9 +429,11 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
// read hardware limits
|
// read hardware limits
|
||||||
sprintf(command, "H %d", axisNo_);
|
sprintf(command, "H %d", axisNo_);
|
||||||
comStatus = pC_->transactController(axisNo_, command, reply);
|
comStatus = pC_->transactController(axisNo_, command, reply);
|
||||||
if(comStatus == asynSuccess){
|
if (comStatus == asynSuccess)
|
||||||
|
{
|
||||||
count = sscanf(reply, "%f %f", &low, &high);
|
count = sscanf(reply, "%f %f", &low, &high);
|
||||||
if(count >= 2){
|
if (count >= 2)
|
||||||
|
{
|
||||||
pC_->setDoubleParam(axisNo_, pC_->motorLowLimit_, low);
|
pC_->setDoubleParam(axisNo_, pC_->motorLowLimit_, low);
|
||||||
pC_->setDoubleParam(axisNo_, pC_->motorHighLimit_, high);
|
pC_->setDoubleParam(axisNo_, pC_->motorHighLimit_, high);
|
||||||
callParamCallbacks();
|
callParamCallbacks();
|
||||||
@ -418,11 +444,13 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
setIntegerParam(pC_->motorStatusProblem_, false);
|
setIntegerParam(pC_->motorStatusProblem_, false);
|
||||||
sprintf(command, "u %d", axisNo_);
|
sprintf(command, "u %d", axisNo_);
|
||||||
comStatus = pC_->transactController(axisNo_, command, reply);
|
comStatus = pC_->transactController(axisNo_, command, reply);
|
||||||
if(comStatus == asynError){
|
if (comStatus == asynError)
|
||||||
|
{
|
||||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
if(strstr(reply,"*ES") != NULL){
|
if (strstr(reply, "*ES") != NULL)
|
||||||
|
{
|
||||||
*moving = false;
|
*moving = false;
|
||||||
setIntegerParam(pC_->motorStatusDone_, true);
|
setIntegerParam(pC_->motorStatusDone_, true);
|
||||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
@ -430,14 +458,18 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
updateMsgTxtFromDriver("Emergency Stop Engaged");
|
updateMsgTxtFromDriver("Emergency Stop Engaged");
|
||||||
comStatus = asynError;
|
comStatus = asynError;
|
||||||
goto skip;
|
goto skip;
|
||||||
} else if(strstr(reply,"?BSY") != NULL){
|
}
|
||||||
|
else if (strstr(reply, "?BSY") != NULL)
|
||||||
|
{
|
||||||
*moving = true;
|
*moving = true;
|
||||||
setIntegerParam(pC_->motorStatusDone_, false);
|
setIntegerParam(pC_->motorStatusDone_, false);
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
count = sscanf(reply, "%lf", &position);
|
count = sscanf(reply, "%lf", &position);
|
||||||
if(count != 1) {
|
if (count != 1)
|
||||||
if(!homing) {
|
{
|
||||||
|
if (!homing)
|
||||||
|
{
|
||||||
snprintf(errTxt, sizeof(errTxt), "Bad reply %s when reading position for %d", reply, axisNo_);
|
snprintf(errTxt, sizeof(errTxt), "Bad reply %s when reading position for %d", reply, axisNo_);
|
||||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
errorReported = 1;
|
errorReported = 1;
|
||||||
@ -445,7 +477,9 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
comStatus = asynError;
|
comStatus = asynError;
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||||
"Axis %d, reply %s, position %lf\n", axisNo_, reply, position);
|
"Axis %d, reply %s, position %lf\n", axisNo_, reply, position);
|
||||||
setDoubleParam(pC_->motorPosition_, position * 1000);
|
setDoubleParam(pC_->motorPosition_, position * 1000);
|
||||||
@ -455,7 +489,8 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
// Read the moving status of this motor
|
// Read the moving status of this motor
|
||||||
sprintf(command, "msr %d", axisNo_);
|
sprintf(command, "msr %d", axisNo_);
|
||||||
comStatus = pC_->transactController(axisNo_, command, reply);
|
comStatus = pC_->transactController(axisNo_, command, reply);
|
||||||
if(comStatus == asynError){
|
if (comStatus == asynError)
|
||||||
|
{
|
||||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
@ -465,35 +500,44 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
// axisNo_, reply, msr, oredMSR, position);
|
// axisNo_, reply, msr, oredMSR, position);
|
||||||
|
|
||||||
oredMSR |= msr;
|
oredMSR |= msr;
|
||||||
if( (msr & 0x1) == 0){
|
if ((msr & 0x1) == 0)
|
||||||
|
{
|
||||||
// done: check for trouble
|
// done: check for trouble
|
||||||
// errlogPrintf("Axis %d finished\n", axisNo_);
|
// errlogPrintf("Axis %d finished\n", axisNo_);
|
||||||
*moving = false;
|
*moving = false;
|
||||||
setIntegerParam(pC_->motorStatusDone_, true);
|
setIntegerParam(pC_->motorStatusDone_, true);
|
||||||
|
|
||||||
next_poll = time(NULL) + IDLEPOLL;
|
next_poll = time(NULL) + IDLEPOLL;
|
||||||
if(oredMSR & 0x10){
|
if (oredMSR & 0x10)
|
||||||
|
{
|
||||||
setIntegerParam(pC_->motorStatusLowLimit_, true);
|
setIntegerParam(pC_->motorStatusLowLimit_, true);
|
||||||
updateMsgTxtFromDriver("Lower Limit Hit");
|
updateMsgTxtFromDriver("Lower Limit Hit");
|
||||||
errorReported = 1;
|
errorReported = 1;
|
||||||
comStatus = asynError;
|
comStatus = asynError;
|
||||||
goto skip;
|
goto skip;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
setIntegerParam(pC_->motorStatusLowLimit_, false);
|
setIntegerParam(pC_->motorStatusLowLimit_, false);
|
||||||
}
|
}
|
||||||
if(oredMSR & 0x20){
|
if (oredMSR & 0x20)
|
||||||
|
{
|
||||||
setIntegerParam(pC_->motorStatusHighLimit_, true);
|
setIntegerParam(pC_->motorStatusHighLimit_, true);
|
||||||
updateMsgTxtFromDriver("Upper Limit Hit");
|
updateMsgTxtFromDriver("Upper Limit Hit");
|
||||||
errorReported = 1;
|
errorReported = 1;
|
||||||
comStatus = asynError;
|
comStatus = asynError;
|
||||||
goto skip;
|
goto skip;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
setIntegerParam(pC_->motorStatusHighLimit_, false);
|
setIntegerParam(pC_->motorStatusHighLimit_, false);
|
||||||
}
|
}
|
||||||
if(homing){
|
if (homing)
|
||||||
|
{
|
||||||
setIntegerParam(pC_->motorStatusAtHome_, true);
|
setIntegerParam(pC_->motorStatusAtHome_, true);
|
||||||
}
|
}
|
||||||
if(oredMSR & 0x1000){
|
if (oredMSR & 0x1000)
|
||||||
|
{
|
||||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
// errlogPrintf("Detected air cushion error on %d", axisNo_);
|
// errlogPrintf("Detected air cushion error on %d", axisNo_);
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "Air cushion problem on %d", axisNo_);
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "Air cushion problem on %d", axisNo_);
|
||||||
@ -502,7 +546,8 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
comStatus = asynError;
|
comStatus = asynError;
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
if(oredMSR & 0x100){
|
if (oredMSR & 0x100)
|
||||||
|
{
|
||||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "Run failure at %d", axisNo_);
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "Run failure at %d", axisNo_);
|
||||||
updateMsgTxtFromDriver("Run failure");
|
updateMsgTxtFromDriver("Run failure");
|
||||||
@ -510,7 +555,8 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
errorReported = 1;
|
errorReported = 1;
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
if(oredMSR & 0x400){
|
if (oredMSR & 0x400)
|
||||||
|
{
|
||||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "Positioning failure at %d", axisNo_);
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "Positioning failure at %d", axisNo_);
|
||||||
updateMsgTxtFromDriver("Positioning failure");
|
updateMsgTxtFromDriver("Positioning failure");
|
||||||
@ -518,11 +564,14 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
errorReported = 1;
|
errorReported = 1;
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
if(oredMSR & 0x200 || oredMSR & 0x80) {
|
if (oredMSR & 0x200 || oredMSR & 0x80)
|
||||||
|
{
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_WARNING, "Positioning fault at %d", axisNo_);
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_WARNING, "Positioning fault at %d", axisNo_);
|
||||||
}
|
}
|
||||||
setIntegerParam(pC_->motorStatusProblem_, false);
|
setIntegerParam(pC_->motorStatusProblem_, false);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
*moving = true;
|
*moving = true;
|
||||||
next_poll = -1;
|
next_poll = -1;
|
||||||
setIntegerParam(pC_->motorStatusDone_, false);
|
setIntegerParam(pC_->motorStatusDone_, false);
|
||||||
@ -551,6 +600,7 @@ static void EL734Register(void)
|
|||||||
iocshRegister(&EL734CreateControllerDef, EL734CreateContollerCallFunc);
|
iocshRegister(&EL734CreateControllerDef, EL734CreateContollerCallFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
epicsExportRegistrar(EL734Register);
|
epicsExportRegistrar(EL734Register);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@ private:
|
|||||||
friend class EL734Controller;
|
friend class EL734Controller;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EL734Controller : public SINQController {
|
class EL734Controller : public SINQController
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
EL734Controller(const char *portName, const char *EL734PortName, int numAxes);
|
EL734Controller(const char *portName, const char *EL734PortName, int numAxes);
|
||||||
|
|
||||||
@ -48,11 +49,11 @@ public:
|
|||||||
EL734Axis *getAxis(int axisNo);
|
EL734Axis *getAxis(int axisNo);
|
||||||
|
|
||||||
friend class EL734Axis;
|
friend class EL734Axis;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
asynUser *pasynUserController_;
|
asynUser *pasynUserController_;
|
||||||
|
|
||||||
asynStatus transactController(int axis, char command[COMLEN], char reply[COMLEN]);
|
asynStatus transactController(int axis, char command[COMLEN], char reply[COMLEN]);
|
||||||
|
|
||||||
void switchRemote();
|
void switchRemote();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user