From 1f860a14236f4502461af0d4034096d4e263d17b Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Tue, 29 Mar 2011 21:28:25 +0000 Subject: [PATCH] Removed writeFloat64, not needed; add setPosition() --- motorApp/MotorSimSrc/motorSimDriver.cpp | 46 +++++-------------------- 1 file changed, 8 insertions(+), 38 deletions(-) diff --git a/motorApp/MotorSimSrc/motorSimDriver.cpp b/motorApp/MotorSimSrc/motorSimDriver.cpp index bf662639..0387562d 100644 --- a/motorApp/MotorSimSrc/motorSimDriver.cpp +++ b/motorApp/MotorSimSrc/motorSimDriver.cpp @@ -179,7 +179,7 @@ asynStatus motorSimController::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 = setIntegerParam(pAxis->axisNo_, function, value); + pAxis->setIntegerParam(function, value); if (function == motorDeferMoves_) { @@ -198,7 +198,7 @@ asynStatus motorSimController::writeInt32(asynUser *pasynUser, epicsInt32 value) } /* Do callbacks so higher layers see any changes */ - callParamCallbacks(pAxis->axisNo_); + pAxis->callParamCallbacks(); if (status) asynPrint(pasynUser, ASYN_TRACE_ERROR, "%s:%s: error, status=%d function=%d, value=%d\n", @@ -210,42 +210,6 @@ asynStatus motorSimController::writeInt32(asynUser *pasynUser, epicsInt32 value) return status; } -asynStatus motorSimController::writeFloat64(asynUser *pasynUser, epicsFloat64 value) -{ - int function = pasynUser->reason; - asynStatus status = asynSuccess; - motorSimAxis *pAxis = this->getAxis(pasynUser); - static const char *functionName = "writeFloat64"; - - - /* 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 = setDoubleParam(pAxis->axisNo_, function, value); - - if (function == motorPosition_) - { - pAxis->enc_offset_ = (double) value - pAxis->nextpoint_.axis[0].p; - asynPrint(pasynUser, ASYN_TRACE_FLOW, - "%s:%s: Set axis %d to position %d\n", - driverName, functionName, pAxis->axisNo_, value); - } else { - /* Call base class call its method (if we have our parameters check this here) */ - status = asynMotorController::writeFloat64(pasynUser, value); - } - - /* Do callbacks so higher layers see any changes */ - callParamCallbacks(pAxis->axisNo_); - if (status) - asynPrint(pasynUser, ASYN_TRACE_ERROR, - "%s:%s: error, status=%d function=%d, value=%f\n", - driverName, functionName, status, function, value); - else - asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, - "%s:%s: function=%d, value=%f\n", - driverName, functionName, function, value); - return status; -} - motorSimAxis* motorSimController::getAxis(asynUser *pasynUser) { return static_cast(asynMotorController::getAxis(pasynUser)); @@ -390,6 +354,12 @@ asynStatus motorSimAxis::stop(double acceleration ) return asynSuccess; } +asynStatus motorSimAxis::setPosition(double position) +{ + enc_offset_ = position - nextpoint_.axis[0].p; + return asynSuccess; +} + asynStatus motorSimAxis::config(int hiHardLimit, int lowHardLimit, int home, int start) { hiHardLimit_ = hiHardLimit;