diff --git a/src/beamShiftAxis.cpp b/src/beamShiftAxis.cpp index 9128c7b..759d0d1 100644 --- a/src/beamShiftAxis.cpp +++ b/src/beamShiftAxis.cpp @@ -146,7 +146,7 @@ asynStatus beamShiftAxis::doPoll(bool *moving) { asynStatus errorStatus = asynSuccess; // Status of read-write-operations of ASCII commands to the controller - asynStatus rw_status = asynSuccess; + asynStatus status = asynSuccess; // Status of parameter library operations asynStatus pl_status = asynSuccess; @@ -182,9 +182,9 @@ asynStatus beamShiftAxis::doPoll(bool *moving) { - Lower limit */ snprintf(command, sizeof(command), "P154 Q110 P158 P159 Q113 Q114"); - rw_status = pC_->writeRead(axisNo(), command, response, 6); - if (rw_status != asynSuccess) { - return rw_status; + status = pC_->writeRead(axisNo(), command, response, 6); + if (status != asynSuccess) { + return status; }; nvals = sscanf(response, "%d %lf %d %d %lf %lf", (int *)moving, @@ -393,10 +393,7 @@ asynStatus beamShiftAxis::doMove(double position, int relative, double acceleration) { // Status of read-write-operations of ASCII commands to the controller - asynStatus rw_status = asynSuccess; - - // Status of parameter library operations - asynStatus pl_status = asynSuccess; + asynStatus status = asynSuccess; char command[pC_->MAXBUF_] = {0}; char response[pC_->MAXBUF_] = {0}; @@ -430,8 +427,8 @@ asynStatus beamShiftAxis::doMove(double position, int relative, motorCoordinatesPosition); // We don't expect an answer - rw_status = pC_->writeRead(axisNo(), command, response, 0); - if (rw_status != asynSuccess) { + status = pC_->writeRead(axisNo(), command, response, 0); + if (status != asynSuccess) { asynPrint( pC_->pasynUser(), ASYN_TRACE_ERROR, @@ -441,7 +438,7 @@ asynStatus beamShiftAxis::doMove(double position, int relative, motorCoordinatesPosition); setAxisParamChecked(this, motorStatusProblem, true); } - return rw_status; + return status; } asynStatus beamShiftAxis::stop(double acceleration) { @@ -483,7 +480,6 @@ asynStatus beamShiftAxis::enable(bool on) { char command[pC_->MAXBUF_] = {0}; char response[pC_->MAXBUF_] = {0}; char userMessage[pC_->MAXBUF_] = {0}; - asynStatus status = asynSuccess; int nvals = 0; int error = 0; int enabled = 0; @@ -495,7 +491,10 @@ asynStatus beamShiftAxis::enable(bool on) { if (on) { // Check if the axis is currently switched off snprintf(command, sizeof(command), "P158 P159"); - status = pC_->writeRead(axisNo(), command, response, 2); + asynStatus status = pC_->writeRead(axisNo(), command, response, 2); + if (status != asynSuccess) { + return status; + } nvals = sscanf(response, "%d %d", &enabled, &error); if (nvals != 2) {