|
|
|
@ -5,32 +5,63 @@
|
|
|
|
|
|
|
|
|
|
sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
|
|
|
|
|
: asynMotorAxis((asynMotorController *)pC, axisNo), pC_(pC) {
|
|
|
|
|
asynStatus status = asynSuccess;
|
|
|
|
|
|
|
|
|
|
initial_poll_ = true;
|
|
|
|
|
watchdogMovActive_ = false;
|
|
|
|
|
init_poll_counter_ = 0;
|
|
|
|
|
scaleMovTimeout_ = 2.0;
|
|
|
|
|
offsetMovTimeout_ = 30;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
asynStatus sinqAxis::atFirstPoll() {
|
|
|
|
|
asynStatus status = asynSuccess;
|
|
|
|
|
int variableSpeed = 0;
|
|
|
|
|
|
|
|
|
|
// Motor is assumed to be enabled
|
|
|
|
|
status = pC_->setIntegerParam(axisNo_, pC_->motorEnableRBV_, 1);
|
|
|
|
|
if (status != asynSuccess) {
|
|
|
|
|
return pC_->paramLibAccessFailed(status, "motorEnableRBV_",
|
|
|
|
|
__PRETTY_FUNCTION__, __LINE__);
|
|
|
|
|
asynPrint(
|
|
|
|
|
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
|
|
|
|
"%s => line %d:\nFATAL ERROR (setting a parameter value failed "
|
|
|
|
|
"with %s)\n. Terminating IOC",
|
|
|
|
|
__PRETTY_FUNCTION__, __LINE__, pC_->stringifyAsynStatus(status));
|
|
|
|
|
exit(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// By default, motors cannot be disabled
|
|
|
|
|
status = pC_->setIntegerParam(axisNo_, pC_->motorCanDisable_, 0);
|
|
|
|
|
if (status != asynSuccess) {
|
|
|
|
|
return pC_->paramLibAccessFailed(status, "motorCanDisable_",
|
|
|
|
|
__PRETTY_FUNCTION__, __LINE__);
|
|
|
|
|
asynPrint(
|
|
|
|
|
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
|
|
|
|
"%s => line %d:\nFATAL ERROR (setting a parameter value failed "
|
|
|
|
|
"with %s)\n. Terminating IOC",
|
|
|
|
|
__PRETTY_FUNCTION__, __LINE__, pC_->stringifyAsynStatus(status));
|
|
|
|
|
exit(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Provide a default value for the motor position.
|
|
|
|
|
status = pC_->setDoubleParam(axisNo_, pC_->motorPosition_, 0.0);
|
|
|
|
|
if (status != asynSuccess) {
|
|
|
|
|
asynPrint(
|
|
|
|
|
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
|
|
|
|
"%s => line %d:\nFATAL ERROR (setting a parameter value failed "
|
|
|
|
|
"with %s)\n. Terminating IOC",
|
|
|
|
|
__PRETTY_FUNCTION__, __LINE__, pC_->stringifyAsynStatus(status));
|
|
|
|
|
exit(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// We assume that the motor has no status problems initially
|
|
|
|
|
status = pC_->setIntegerParam(axisNo_, pC_->motorStatusProblem_, 0);
|
|
|
|
|
if (status != asynSuccess) {
|
|
|
|
|
asynPrint(
|
|
|
|
|
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
|
|
|
|
"%s => line %d:\nFATAL ERROR (setting a parameter value failed "
|
|
|
|
|
"with %s)\n. Terminating IOC",
|
|
|
|
|
__PRETTY_FUNCTION__, __LINE__, pC_->stringifyAsynStatus(status));
|
|
|
|
|
exit(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
asynStatus sinqAxis::atFirstPoll() {
|
|
|
|
|
asynStatus status = asynSuccess;
|
|
|
|
|
int variableSpeed = 0;
|
|
|
|
|
|
|
|
|
|
status =
|
|
|
|
|
pC_->getIntegerParam(axisNo_, pC_->motorCanSetSpeed_, &variableSpeed);
|
|
|
|
|
if (status != asynSuccess) {
|
|
|
|
|