diff --git a/configure/RELEASE b/configure/RELEASE index 38e15fc..d80c2fd 100644 --- a/configure/RELEASE +++ b/configure/RELEASE @@ -36,4 +36,5 @@ STD=/usr/local/epics/support/std-3-1 ANC=/usr/local/epics/anc350v17 STREAMS=/usr/local/epics/support/StreamDevice-2-6 LAKESHORE336=/usr/local/epics/support/lakeshore336 -BUSY=/usr/local/epics/support/busy-1-4 \ No newline at end of file +BUSY=/usr/local/epics/support/busy-1-4 +OXINSTCRYOJET=/usr/local/epics/support/OxInstCryojet-2-18-3 diff --git a/iocBoot/iocsinqEPICS/motor.substitutions.nanoboa b/iocBoot/iocsinqEPICS/motor.substitutions.nanoboa index 895f512..1dc20e6 100644 --- a/iocBoot/iocsinqEPICS/motor.substitutions.nanoboa +++ b/iocBoot/iocsinqEPICS/motor.substitutions.nanoboa @@ -2,5 +2,5 @@ file "$(MOTOR)/db/basic_asyn_motor.db" { pattern {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"} } diff --git a/iocBoot/iocsinqEPICS/nanotestboa.cmd b/iocBoot/iocsinqEPICS/nanotestboa.cmd index 7543380..43fc8de 100755 --- a/iocBoot/iocsinqEPICS/nanotestboa.cmd +++ b/iocBoot/iocsinqEPICS/nanotestboa.cmd @@ -19,8 +19,9 @@ sinqEPICS_registerRecordDeviceDriver pdbbase #---------- load Nanotec motor controller #drvAsynIPPortConfigure("serial1", "narziss-ts:3002",0,0,0) -drvAsynIPPortConfigure("serial1", "boa-ts:3013",0,0,0) -NanotecCreateController("nano","serial1","1","4"); +drvAsynIPPortConfigure("serial1", "boa-ts:3014",0,0,0) +#drvAsynIPPortConfigure("serial1", "localhost:2020",0,0,0) +NanotecCreateController("nano","serial1","1","11"); ### Motors diff --git a/sinqEPICSApp/src/NanotecDriver.cpp b/sinqEPICSApp/src/NanotecDriver.cpp index 45c2c40..855425c 100644 --- a/sinqEPICSApp/src/NanotecDriver.cpp +++ b/sinqEPICSApp/src/NanotecDriver.cpp @@ -36,6 +36,7 @@ July 2015 #define IDLEPOLL 60 +#define ABS(x) (x < 0 ? -(x) : (x)) /** Creates a new NanotecController object. * \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; + setIntegerParam(pC_->motorStatusAtHome_, false); + setIntegerParam(pC_->motorStatusHighLimit_, false); + setIntegerParam(pC_->motorStatusLowLimit_, false); /* set mode @@ -244,15 +248,8 @@ asynStatus NanotecAxis::home(double minVelocity, double maxVelocity, double acce //static const char *functionName = "NanotecAxis::home"; char command[COMLEN], reply[COMLEN]; - /* - set mode - */ - snprintf(command,sizeof(command),"#%dp4",busAddress); - status = pC_->transactController(command,reply); - if(status != asynSuccess){ - return status; - } - + setIntegerParam(pC_->motorStatusAtHome_, false); + /* reset positioning errors */ @@ -261,6 +258,16 @@ asynStatus NanotecAxis::home(double minVelocity, double maxVelocity, double acce if(status != asynSuccess){ return status; } + + /* + set mode + */ + snprintf(command,sizeof(command),"#%dp4",busAddress); + status = pC_->transactController(command,reply); + if(status != asynSuccess){ + return status; + } + /* set direction @@ -362,6 +369,7 @@ asynStatus NanotecAxis::poll(bool *moving) char command[COMLEN], reply[COMLEN]; char *pPtr; int posVal, statVal; + double lowLim, highLim; // protect against excessive polling @@ -397,13 +405,16 @@ asynStatus NanotecAxis::poll(bool *moving) setIntegerParam(pC_->motorStatusDone_, false); *moving = true; + pC_->getDoubleParam(axisNo_,pC_->motorLowLimit_,&lowLim); + pC_->getDoubleParam(axisNo_,pC_->motorHighLimit_,&highLim); + if(homing){ + /* + code for homing + */ switch(statVal) { - case 164: - setPosition(.0); - break; case 163: - case 161: + setPosition(lowLim); *moving = false; setIntegerParam(pC_->motorStatusAtHome_, true); setIntegerParam(pC_->motorStatusDone_, true); @@ -417,10 +428,23 @@ asynStatus NanotecAxis::poll(bool *moving) break; } } else { + /* + code for normal movement + */ if(statVal & 1) { *moving = false; 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){