Some cleanup, force reload encoder before enable

This commit is contained in:
brambilla_m
2022-04-06 11:45:06 +02:00
parent f5da0d54bd
commit 8e2c1af10e
2 changed files with 58 additions and 59 deletions

View File

@@ -816,7 +816,7 @@ asynStatus SeleneController::writeFloat64(asynUser *pasynUser, epicsFloat64 valu
asynStatus pmacV3Controller::writeInt32(asynUser *pasynUser, epicsInt32 value) {
int function = pasynUser->reason;
asynStatus status = asynError;
asynStatus status = asynSuccess;
pmacV3Axis *pAxis = NULL;
char command[64] = {0};
char response[64] = {0};
@@ -831,9 +831,13 @@ asynStatus pmacV3Controller::writeInt32(asynUser *pasynUser, epicsInt32 value) {
/* Set the parameter and readback in the parameter library. This may be
* overwritten when we read back the status at the end, but that's OK */
status = pAxis->setIntegerParam(function, value);
pAxis->setIntegerParam(function, value);
if (function == enableAxis_) {
if(value == 1) {
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,
"%s: Enable axis on controller %s, axis %d enable=%d\n",
@@ -845,7 +849,7 @@ asynStatus pmacV3Controller::writeInt32(asynUser *pasynUser, epicsInt32 value) {
// Execute the command.
if (command[0] != 0 && status == asynSuccess) {
status = lowLevelWriteRead(pAxis->axisNo_, command, response);
lowLevelWriteRead(pAxis->axisNo_, command, response);
}
return pmacController::writeInt32(pasynUser, value);