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:
@@ -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