Implemented that enable commands are only sent when a status chnage is required
Stop commands are only sent by EL734 and pmac when actually moving. The motor record logic calls stop() in an excessive way.
This commit is contained in:
@ -341,12 +341,15 @@ asynStatus EL734Axis::stop(double acceleration )
|
||||
asynStatus status = asynSuccess;
|
||||
//static const char *functionName = "EL734Axis::stop";
|
||||
char command[COMLEN], reply[COMLEN];
|
||||
bool moving = false;
|
||||
|
||||
if(errorReported == 0){
|
||||
this->poll(&moving);
|
||||
if(moving && errorReported == 0){
|
||||
sprintf(command, "S %d", axisNo_);
|
||||
status = pC_->transactController(axisNo_,command,reply);
|
||||
errlogPrintf("Sent STOP on Axis %d\n", axisNo_);
|
||||
updateMsgTxtFromDriver("Axis interrupted");
|
||||
errorReported = 1;
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -284,15 +284,20 @@ asynStatus pmacAxis::setPosition(double position) {
|
||||
asynStatus pmacAxis::stop(double acceleration) {
|
||||
asynStatus status = asynError;
|
||||
static const char *functionName = "pmacAxis::stopAxis";
|
||||
bool moving = false;
|
||||
|
||||
pC_->debugFlow(functionName);
|
||||
|
||||
char command[128] = {0};
|
||||
char response[32] = {0};
|
||||
|
||||
sprintf(command, "M%2.2d=8", axisNo_);
|
||||
this->getAxisStatus(&moving);
|
||||
|
||||
status = pC_->lowLevelWriteRead(axisNo_, command, response);
|
||||
if(moving) {
|
||||
// only send a stop when actually moving
|
||||
sprintf(command, "M%2.2d=8", axisNo_);
|
||||
status = pC_->lowLevelWriteRead(axisNo_, command, response);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -820,6 +820,7 @@ asynStatus pmacV3Controller::writeInt32(asynUser *pasynUser, epicsInt32 value) {
|
||||
pmacV3Axis *pAxis = NULL;
|
||||
char command[64] = {0};
|
||||
char response[64] = {0};
|
||||
int isOn;
|
||||
static const char *functionName = "pmacV3Controller::writeInt32";
|
||||
|
||||
debugFlow(functionName);
|
||||
@ -834,16 +835,22 @@ asynStatus pmacV3Controller::writeInt32(asynUser *pasynUser, epicsInt32 value) {
|
||||
pAxis->setIntegerParam(function, value);
|
||||
|
||||
if (function == enableAxis_) {
|
||||
if(value == 1) {
|
||||
// only send commands when a state change is necessary
|
||||
snprintf(command, sizeof(command), "P%2.2d00", pAxis->axisNo_);
|
||||
this->lowLevelWriteRead(pAxis->axisNo_, command, response);
|
||||
isOn = strtol(response, NULL, 10);
|
||||
if(value == 1 && isOn == 0) {
|
||||
sprintf(command, "M%2.2d=15\n", pAxis->axisNo_);
|
||||
lowLevelWriteRead(pAxis->axisNo_, command, response);
|
||||
}
|
||||
sprintf(command, "M%2.2d14=%d\n", pAxis->axisNo_, value);
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW,
|
||||
pAxis->updateMsgTxtFromDriver("");
|
||||
if(isOn != value) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW,
|
||||
"%s: Enable axis on controller %s, axis %d enable=%d\n",
|
||||
functionName, portName, pAxis->axisNo_, value);
|
||||
pAxis->updateMsgTxtFromDriver("");
|
||||
lowLevelWriteRead(pAxis->axisNo_, command, response);
|
||||
lowLevelWriteRead(pAxis->axisNo_, command, response);
|
||||
}
|
||||
}
|
||||
|
||||
return pmacController::writeInt32(pasynUser, value);
|
||||
|
Reference in New Issue
Block a user