- Fixed reference run for Phytron

- Added brake handling to phytron
- Added code to set speed for phytron
- Removed scaling on Selene pmac limits
- Removed enabling on Selene pmac axis
This commit is contained in:
2020-07-09 14:15:26 +02:00
parent d1d74f4db3
commit c9e7830274
5 changed files with 164 additions and 17 deletions

View File

@@ -211,7 +211,7 @@ PhytronAxis::PhytronAxis(PhytronController *pC, int axisNo, int enc)
brakeIO = -1;
}
PhytronAxis::setBrake(int brakeNO)
int PhytronAxis::setBrake(int brakeNO)
{
if(brakeNO < 1 || brakeNO > 8) {
return 0;
@@ -248,6 +248,9 @@ asynStatus PhytronAxis::move(double position, int relative, double minVelocity,
updateMsgTxtFromDriver("");
/*
deal with brake
*/
if(haveBrake) {
sprintf(command,"%sA%dS", pC_->selector, brakeIO);
status = pC_->transactController(axisNo_,command,reply);
@@ -259,6 +262,21 @@ asynStatus PhytronAxis::move(double position, int relative, double minVelocity,
}
}
/*
set speed
*/
sprintf(command, "%s%cP14S%f", pC_->selector, phytronChar, maxVelocity);
status = pC_->transactController(axisNo_,command,reply);
if(strstr(reply,"NACK") != NULL){
errlogSevPrintf(errlogMajor, "Speed not accepted on %d", axisNo_);
updateMsgTxtFromDriver("Invalid speed");
setIntegerParam(pC_->motorStatusProblem_, true);
return asynError;
}
/*
actually send a move command
*/
if (relative) {
position += this->position;
}
@@ -283,6 +301,9 @@ asynStatus PhytronAxis::home(double minVelocity, double maxVelocity, double acce
updateMsgTxtFromDriver("");
/*
handle the fucking brake
*/
if(haveBrake) {
sprintf(command,"%sA%dS", pC_->selector, brakeIO);
status = pC_->transactController(axisNo_,command,reply);
@@ -294,10 +315,23 @@ asynStatus PhytronAxis::home(double minVelocity, double maxVelocity, double acce
}
}
/*
set speed
*/
sprintf(command, "%s%cP14S%f", pC_->selector, phytronChar, maxVelocity);
status = pC_->transactController(axisNo_,command,reply);
if(strstr(reply,"NACK") != NULL){
errlogSevPrintf(errlogMajor, "Speed not accepted on %d", axisNo_);
updateMsgTxtFromDriver("Invalid speed");
setIntegerParam(pC_->motorStatusProblem_, true);
return asynError;
}
homing_direction = forwards;
if(forwards){
sprintf(command, "%s%cO+",pC_->selector,phytronChar);
sprintf(command, "%s%c0+",pC_->selector,phytronChar);
} else {
sprintf(command, "%s%cO-",pC_->selector,phytronChar);
sprintf(command, "%s%c0-",pC_->selector,phytronChar);
}
homing = 1;
next_poll= -1;
@@ -448,7 +482,7 @@ asynStatus PhytronAxis::poll(bool *moving)
if(haveBrake) {
sprintf(command,"%sA%dR", pC_->selector, brakeIO);
status = pC_->transactController(axisNo_,command,reply);
comStatus = pC_->transactController(axisNo_,command,reply);
if(strstr(reply,"NACK") != NULL){
errlogSevPrintf(errlogMajor, "Failed to set brake on %d", axisNo_);
updateMsgTxtFromDriver("Failed to set brake");
@@ -461,7 +495,11 @@ asynStatus PhytronAxis::poll(bool *moving)
if(!*moving) {
if(homing){
pC_->getDoubleParam(axisNo_,pC_->motorLowLimit_,&lowlim);
if(homing_direction) {
pC_->getDoubleParam(axisNo_,pC_->motorHighLimit_,&lowlim);
} else {
pC_->getDoubleParam(axisNo_,pC_->motorLowLimit_,&lowlim);
}
setPosition(lowlim);
setIntegerParam(pC_->motorStatusAtHome_, true);
} else {
@@ -544,7 +582,7 @@ extern "C" asynStatus PhytronConfBrake(const char *port, /* specify whic
pC = (PhytronController*) findAsynPortDriver(port);
if (!pC) {
printf("%s:%s: Error port %s not found\n",
driverName, functionName, port);
"PhytronDriver", functionName, port);
return asynError;
}
@@ -553,8 +591,8 @@ extern "C" asynStatus PhytronConfBrake(const char *port, /* specify whic
status = pAxis->setBrake(brakeNO);
pC->unlock();
if(!status) {
printf("%s:%s: requested brake IO out of range\n",
driverName, functionName, port);
printf("%s:%s:%s requested brake IO out of range\n",
"PhytronDriver", functionName, port);
return asynError;
}
return asynSuccess;
@@ -579,7 +617,7 @@ static void PhytronCreateContollerCallFunc(const iocshArgBuf *args)
/* PhytronConfigureBrake */
static const iocshArg phytronBrake0 = {"Controller port name", iocshArgString};
static const iocshArg phytronBrakeArg0 = {"Controller port name", iocshArgString};
static const iocshArg phytronBrakeArg1 = {"Axis number", iocshArgInt};
static const iocshArg phytronBrakeArg2 = {"Brake IO number", iocshArgInt};
static const iocshArg * const phytronBrakeArgs[] = {&phytronBrakeArg0,