From a4373ca87b0576e0aca79810c245873dbf49e8d4 Mon Sep 17 00:00:00 2001 From: timmmooney Date: Fri, 12 Sep 2014 21:36:33 +0000 Subject: [PATCH] changes for compatibility with either seq-2-1-16 or seq-2-2-0 --- motorApp/NewportSrc/MM4005_trajectoryScan.st | 24 ++++++++++-- motorApp/NewportSrc/XPS_trajectoryScan.st | 39 +++++++++++++++++--- motorApp/NewportSrc/trajectoryScan.h | 4 +- 3 files changed, 55 insertions(+), 12 deletions(-) diff --git a/motorApp/NewportSrc/MM4005_trajectoryScan.st b/motorApp/NewportSrc/MM4005_trajectoryScan.st index 26962bb4..1fb82392 100644 --- a/motorApp/NewportSrc/MM4005_trajectoryScan.st +++ b/motorApp/NewportSrc/MM4005_trajectoryScan.st @@ -15,6 +15,10 @@ program MM4005_trajectoryScan("P=13IDC:,R=traj1,M1=M1,M2=M2,M3=M3,M4=M4,M5=M5,M6 %% #include %% #include +#include /* definition of MAGIC */ +#define VERSION_INT(MAJ,MIN) ((MAJ)*1000000+(MIN)*1000) +#define LT_SEQ_VERSION(MAJ,MIN) ((MAGIC) < VERSION_INT(MAJ,MIN)) + /* This program must be compiled with the recursive option */ option +r; @@ -203,7 +207,7 @@ ss trajectoryScan { /* If time mode is TIME_MODE_TOTAL then construct timeTrajectory * and post it */ if (timeMode == TIME_MODE_TOTAL) { - dtime = time/nelements; + dtime = time_PV/nelements; for (i=0; inumAxes; j++) { - seq_pvGet(ssId, pVar->epicsMotorDoneIndex[j], 0); +#if LT_SEQ_VERSION(2,2) + seq_pvGet(ssId, pVar->epicsMotorDoneIndex[j], 0); +#else + seq_pvGet(ssId, pVar->epicsMotorDoneIndex[j], 0, DEFAULT_TIMEOUT); +#endif if (pVar->epicsMotorDone[j] == 0) result |= mask; mask = mask << 1; } @@ -661,13 +669,21 @@ static int waitEpicsMotors(SS_ID ssId, struct UserVar *pVar) /* Get the current motor positions, post them */ for (j=0; jnumAxes; j++) { pVar->motorCurrent[j] = pVar->epicsMotorPos[j]; - seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); +#if LT_SEQ_VERSION(2,2) + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); +#else + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0, DEFAULT_TIMEOUT); +#endif } epicsThreadSleep(POLL_INTERVAL); } for (j=0; jnumAxes; j++) { pVar->motorCurrent[j] = pVar->epicsMotorPos[j]; - seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); +#if LT_SEQ_VERSION(2,2) + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); +#else + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0, DEFAULT_TIMEOUT); +#endif } return(0); } diff --git a/motorApp/NewportSrc/XPS_trajectoryScan.st b/motorApp/NewportSrc/XPS_trajectoryScan.st index 49aee691..42e85191 100644 --- a/motorApp/NewportSrc/XPS_trajectoryScan.st +++ b/motorApp/NewportSrc/XPS_trajectoryScan.st @@ -25,6 +25,9 @@ program XPS_trajectoryScan("P=13BMC:,R=traj1,IPADDR=164.54.160.34,PORT=5001," %% #include "Socket.h" %% #include "xps_ftp.h" +#include /* definition of MAGIC */ +#define VERSION_INT(MAJ,MIN) ((MAJ)*1000000+(MIN)*1000) +#define LT_SEQ_VERSION(MAJ,MIN) ((MAGIC) < VERSION_INT(MAJ,MIN)) /* This program must be compiled with the recursive option */ option +r; @@ -256,7 +259,7 @@ ss xpsTrajectoryScan { /* If total time mode, calc time per element and write, else use the array timeTraj */ if (timeMode == TIME_MODE_TOTAL) { - dtime = time/npoints; + dtime = time_PV/npoints; for (i=0; inumAxes; j++) { - seq_pvGet(ssId, pVar->epicsMotorDoneIndex[j], 0); +#if LT_SEQ_VERSION(2,2) + seq_pvGet(ssId, pVar->epicsMotorDoneIndex[j], 0); +#else + seq_pvGet(ssId, pVar->epicsMotorDoneIndex[j], 0, DEFAULT_TIMEOUT); +#endif if (pVar->epicsMotorDone[j] == 0) result |= mask; mask = mask << 1; } @@ -714,11 +721,23 @@ static int waitMotors(SS_ID ssId, struct UserVar *pVar) while(getMotorMoving(ssId, pVar)) { /* Get the current motor positions, post them */ getMotorPositions(ssId, pVar, pVar->motorCurrent); - for (j=0; jnumAxes; j++) seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); + for (j=0; jnumAxes; j++) { +#if LT_SEQ_VERSION(2,2) + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); +#else + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0, DEFAULT_TIMEOUT); +#endif + } epicsThreadSleep(POLL_INTERVAL); } getMotorPositions(ssId, pVar, pVar->motorCurrent); - for (j=0; jnumAxes; j++) seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); + for (j=0; jnumAxes; j++) { +#if LT_SEQ_VERSION(2,2) + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); +#else + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0, DEFAULT_TIMEOUT); +#endif + } return(0); } @@ -734,13 +753,21 @@ static int waitEpicsMotors(SS_ID ssId, struct UserVar *pVar) /* Get the current motor positions, post them */ for (j=0; jnumAxes; j++) { pVar->motorCurrent[j] = pVar->epicsMotorPos[j]; - seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); +#if LT_SEQ_VERSION(2,2) + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); +#else + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0, DEFAULT_TIMEOUT); +#endif } epicsThreadSleep(POLL_INTERVAL); } for (j=0; jnumAxes; j++) { pVar->motorCurrent[j] = pVar->epicsMotorPos[j]; - seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); +#if LT_SEQ_VERSION(2,2) + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); +#else + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0, DEFAULT_TIMEOUT); +#endif } return(0); } diff --git a/motorApp/NewportSrc/trajectoryScan.h b/motorApp/NewportSrc/trajectoryScan.h index c431593b..dafa5cdb 100644 --- a/motorApp/NewportSrc/trajectoryScan.h +++ b/motorApp/NewportSrc/trajectoryScan.h @@ -52,8 +52,8 @@ monitor endPulses; int nactual; assign nactual to "{P}{R}Nactual.VAL"; int moveMode; assign moveMode to "{P}{R}MoveMode.VAL"; monitor moveMode; -double time; assign time to "{P}{R}Time.VAL"; -monitor time; +double time_PV; assign time_PV to "{P}{R}Time.VAL"; +monitor time_PV; double timeScale; assign timeScale to "{P}{R}TimeScale.VAL"; monitor timeScale; int timeMode; assign timeMode to "{P}{R}TimeMode.VAL";