static int motorAxisSetInteger( AXIS_HDL pAxis, motorAxisParam_t function, int value ) { int status = MOTOR_AXIS_OK; if (pAxis == NULL) return (MOTOR_AXIS_ERROR); else { if (epicsMutexLock( pAxis->axisMutex ) == epicsMutexLockOK) { switch (function) { case motorAxisPosition: { pAxis->enc_offset = (double) value - pAxis->nextpoint.axis[0].p; pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d to position %d", pAxis->card, pAxis->axis, value ); break; } case motorAxisLowLimit: { pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d low limit to %d", pAxis->card, pAxis->axis, value ); break; } case motorAxisHighLimit: { pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d high limit to %d", pAxis->card, pAxis->axis, value ); break; } case motorAxisClosedLoop: { pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d closed loop to %s", pAxis->card, pAxis->axis, (value?"ON":"OFF") ); break; } case motorAxisDeferMoves: { pAxis->print( pAxis->logParam, TRACE_FLOW, "%sing Deferred Move flag on PMAC card %d\n", value != 0.0?"Sett":"Clear",pAxis->card); if (value == 0.0 && pAxis->pDrv->movesDeferred != 0) { processDeferredMoves(pAxis->pDrv); } pAxis->pDrv->movesDeferred = value; break; } default: status = MOTOR_AXIS_ERROR; break; } if (status != MOTOR_AXIS_ERROR ) { status = motorParam->setInteger( pAxis->params, function, value ); motorParam->callCallback(pAxis->params); } epicsMutexUnlock(pAxis->axisMutex); } return (status); } }
asynStatus motorSimController::writeInt32(asynUser *pasynUser, epicsInt32 value) { int function = pasynUser->reason; asynStatus status = asynSuccess; motorSimAxis *pAxis = this->getAxis(pasynUser); static const char *functionName = "writeInt32"; /* 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 */ pAxis->setIntegerParam(function, value); if (function == motorDeferMoves_) { asynPrint(pasynUser, ASYN_TRACE_FLOW, "%s:%s: %sing Deferred Move flag on driver %s\n", value != 0.0?"Sett":"Clear", driverName, functionName, this->portName); if (value == 0.0 && movesDeferred_ != 0) { processDeferredMoves(); } movesDeferred_ = value; } else { /* Call base class call its method (if we have our parameters check this here) */ status = asynMotorController::writeInt32(pasynUser, value); } /* Do callbacks so higher layers see any changes */ pAxis->callParamCallbacks(); if (status) asynPrint(pasynUser, ASYN_TRACE_ERROR, "%s:%s: error, status=%d function=%d, value=%d\n", driverName, functionName, status, function, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, value=%d\n", driverName, functionName, function, value); return status; }
static int motorAxisSetDouble( AXIS_HDL pAxis, motorAxisParam_t function, double value ) { int status = MOTOR_AXIS_OK; if (pAxis == NULL) return MOTOR_AXIS_ERROR; else { epicsMutexLock(pAxis->axisMutex); switch (function) { case motorAxisPosition: { pAxis->enc_offset = value - pAxis->nextpoint.axis[0].p; pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d to position %f", pAxis->card, pAxis->axis, value ); break; } case motorAxisResolution: { pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d resolution to %f", pAxis->card, pAxis->axis, value ); break; } case motorAxisEncoderRatio: { pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d to enc. ratio to %f", pAxis->card, pAxis->axis, value ); break; } case motorAxisLowLimit: { pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d low limit to %f", pAxis->card, pAxis->axis, value ); break; } case motorAxisHighLimit: { pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d high limit to %f", pAxis->card, pAxis->axis, value ); break; } case motorAxisPGain: { pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d pgain to %f", pAxis->card, pAxis->axis, value ); break; } case motorAxisIGain: { pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d igain to %f", pAxis->card, pAxis->axis, value ); break; } case motorAxisDGain: { pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d dgain to %f", pAxis->card, pAxis->axis, value ); break; } case motorAxisClosedLoop: { pAxis->print( pAxis->logParam, TRACE_FLOW, "Set card %d, axis %d closed loop to %s", pAxis->card, pAxis->axis, (value!=0?"ON":"OFF") ); break; } case motorAxisDeferMoves: { pAxis->print( pAxis->logParam, TRACE_FLOW, "%sing Deferred Move flag on PMAC card %d\n", value != 0.0?"Sett":"Clear",pAxis->card); if (value == 0.0 && pAxis->pDrv->movesDeferred != 0) { processDeferredMoves(pAxis->pDrv); } pAxis->pDrv->movesDeferred = (int)value; break; } default: status = MOTOR_AXIS_ERROR; break; } if (status == MOTOR_AXIS_OK ) { motorParam->setDouble(pAxis->params, function, value); motorParam->callCallback(pAxis->params); } epicsMutexUnlock(pAxis->axisMutex); } return status; }