Fixed Nanotex driver to work with the real HW and the simulation
This commit is contained in:
@ -36,4 +36,5 @@ STD=/usr/local/epics/support/std-3-1
|
|||||||
ANC=/usr/local/epics/anc350v17
|
ANC=/usr/local/epics/anc350v17
|
||||||
STREAMS=/usr/local/epics/support/StreamDevice-2-6
|
STREAMS=/usr/local/epics/support/StreamDevice-2-6
|
||||||
LAKESHORE336=/usr/local/epics/support/lakeshore336
|
LAKESHORE336=/usr/local/epics/support/lakeshore336
|
||||||
BUSY=/usr/local/epics/support/busy-1-4
|
BUSY=/usr/local/epics/support/busy-1-4
|
||||||
|
OXINSTCRYOJET=/usr/local/epics/support/OxInstCryojet-2-18-3
|
||||||
|
@ -2,5 +2,5 @@ file "$(MOTOR)/db/basic_asyn_motor.db"
|
|||||||
{
|
{
|
||||||
pattern
|
pattern
|
||||||
{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT}
|
{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT}
|
||||||
{KM36:nano:, 1, "m$(N)", "asynMotor", nano, 1, "m1", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, .001, 3, 180, -180, "1"}
|
{KM36:nano:, 1, "rd", "asynMotor", nano, 1, "rd", mm, Pos, 2.0, 0.1, .2, 0, 1, .2, .0001, 3, 220, 0, "1"}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,9 @@ sinqEPICS_registerRecordDeviceDriver pdbbase
|
|||||||
|
|
||||||
#---------- load Nanotec motor controller
|
#---------- load Nanotec motor controller
|
||||||
#drvAsynIPPortConfigure("serial1", "narziss-ts:3002",0,0,0)
|
#drvAsynIPPortConfigure("serial1", "narziss-ts:3002",0,0,0)
|
||||||
drvAsynIPPortConfigure("serial1", "boa-ts:3013",0,0,0)
|
drvAsynIPPortConfigure("serial1", "boa-ts:3014",0,0,0)
|
||||||
NanotecCreateController("nano","serial1","1","4");
|
#drvAsynIPPortConfigure("serial1", "localhost:2020",0,0,0)
|
||||||
|
NanotecCreateController("nano","serial1","1","11");
|
||||||
|
|
||||||
### Motors
|
### Motors
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ July 2015
|
|||||||
|
|
||||||
#define IDLEPOLL 60
|
#define IDLEPOLL 60
|
||||||
|
|
||||||
|
#define ABS(x) (x < 0 ? -(x) : (x))
|
||||||
|
|
||||||
/** Creates a new NanotecController object.
|
/** Creates a new NanotecController object.
|
||||||
* \param[in] portName The name of the asyn port that will be created for this driver
|
* \param[in] portName The name of the asyn port that will be created for this driver
|
||||||
@ -206,6 +207,9 @@ asynStatus NanotecAxis::move(double position, int relative, double minVelocity,
|
|||||||
}
|
}
|
||||||
|
|
||||||
homing = 0;
|
homing = 0;
|
||||||
|
setIntegerParam(pC_->motorStatusAtHome_, false);
|
||||||
|
setIntegerParam(pC_->motorStatusHighLimit_, false);
|
||||||
|
setIntegerParam(pC_->motorStatusLowLimit_, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
set mode
|
set mode
|
||||||
@ -244,15 +248,8 @@ asynStatus NanotecAxis::home(double minVelocity, double maxVelocity, double acce
|
|||||||
//static const char *functionName = "NanotecAxis::home";
|
//static const char *functionName = "NanotecAxis::home";
|
||||||
char command[COMLEN], reply[COMLEN];
|
char command[COMLEN], reply[COMLEN];
|
||||||
|
|
||||||
/*
|
setIntegerParam(pC_->motorStatusAtHome_, false);
|
||||||
set mode
|
|
||||||
*/
|
|
||||||
snprintf(command,sizeof(command),"#%dp4",busAddress);
|
|
||||||
status = pC_->transactController(command,reply);
|
|
||||||
if(status != asynSuccess){
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
reset positioning errors
|
reset positioning errors
|
||||||
*/
|
*/
|
||||||
@ -261,6 +258,16 @@ asynStatus NanotecAxis::home(double minVelocity, double maxVelocity, double acce
|
|||||||
if(status != asynSuccess){
|
if(status != asynSuccess){
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
set mode
|
||||||
|
*/
|
||||||
|
snprintf(command,sizeof(command),"#%dp4",busAddress);
|
||||||
|
status = pC_->transactController(command,reply);
|
||||||
|
if(status != asynSuccess){
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
set direction
|
set direction
|
||||||
@ -362,6 +369,7 @@ asynStatus NanotecAxis::poll(bool *moving)
|
|||||||
char command[COMLEN], reply[COMLEN];
|
char command[COMLEN], reply[COMLEN];
|
||||||
char *pPtr;
|
char *pPtr;
|
||||||
int posVal, statVal;
|
int posVal, statVal;
|
||||||
|
double lowLim, highLim;
|
||||||
|
|
||||||
|
|
||||||
// protect against excessive polling
|
// protect against excessive polling
|
||||||
@ -397,13 +405,16 @@ asynStatus NanotecAxis::poll(bool *moving)
|
|||||||
|
|
||||||
setIntegerParam(pC_->motorStatusDone_, false);
|
setIntegerParam(pC_->motorStatusDone_, false);
|
||||||
*moving = true;
|
*moving = true;
|
||||||
|
pC_->getDoubleParam(axisNo_,pC_->motorLowLimit_,&lowLim);
|
||||||
|
pC_->getDoubleParam(axisNo_,pC_->motorHighLimit_,&highLim);
|
||||||
|
|
||||||
if(homing){
|
if(homing){
|
||||||
|
/*
|
||||||
|
code for homing
|
||||||
|
*/
|
||||||
switch(statVal) {
|
switch(statVal) {
|
||||||
case 164:
|
|
||||||
setPosition(.0);
|
|
||||||
break;
|
|
||||||
case 163:
|
case 163:
|
||||||
case 161:
|
setPosition(lowLim);
|
||||||
*moving = false;
|
*moving = false;
|
||||||
setIntegerParam(pC_->motorStatusAtHome_, true);
|
setIntegerParam(pC_->motorStatusAtHome_, true);
|
||||||
setIntegerParam(pC_->motorStatusDone_, true);
|
setIntegerParam(pC_->motorStatusDone_, true);
|
||||||
@ -417,10 +428,23 @@ asynStatus NanotecAxis::poll(bool *moving)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/*
|
||||||
|
code for normal movement
|
||||||
|
*/
|
||||||
if(statVal & 1) {
|
if(statVal & 1) {
|
||||||
*moving = false;
|
*moving = false;
|
||||||
setIntegerParam(pC_->motorStatusDone_, true);
|
setIntegerParam(pC_->motorStatusDone_, true);
|
||||||
}
|
} else if (statVal & 4) {
|
||||||
|
setIntegerParam(pC_->motorStatusDone_, true);
|
||||||
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
|
errlogSevPrintf(errlogMajor, "Limit or other positioning problem at %d", axisNo_);
|
||||||
|
if(ABS(posVal - lowLim) < ABS(posVal - highLim)){
|
||||||
|
setIntegerParam(pC_->motorStatusLowLimit_, true);
|
||||||
|
} else {
|
||||||
|
setIntegerParam(pC_->motorStatusHighLimit_, true);
|
||||||
|
}
|
||||||
|
*moving = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*moving == true){
|
if(*moving == true){
|
||||||
|
Reference in New Issue
Block a user