From dfa946fce7ca5ea6c4d98bb7d7a906b5860340c5 Mon Sep 17 00:00:00 2001 From: timmmooney Date: Thu, 28 Aug 2014 18:15:18 +0000 Subject: [PATCH] don't use variable named "time". Conflicts with time(). make seq_pvGet() call sensitive to seq version number --- motorApp/OmsSrc/MAX_trajectoryScan.st | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/motorApp/OmsSrc/MAX_trajectoryScan.st b/motorApp/OmsSrc/MAX_trajectoryScan.st index 1e245e1e..f312ae25 100644 --- a/motorApp/OmsSrc/MAX_trajectoryScan.st +++ b/motorApp/OmsSrc/MAX_trajectoryScan.st @@ -25,6 +25,10 @@ program MAX_trajectoryScan("P=13IDC:,R=traj1,M1=M1,M2=M2,M3=M3,M4=M4,M5=M5,M6=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)) + #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MIN(a,b) ((a) > (b) ? (b) : (a)) #define NINT(f) (int)((f)>0 ? (f)+0.5 : (f)-0.5) @@ -354,7 +358,7 @@ ss maxTrajectoryScan { /* If time mode is TIME_MODE_TOTAL then construct timeTrajectory and post it */ /* Note that timeTrajectory[i] is the time to go from motorTrajectory[i] to motorTrajectory[i+1] */ if (timeMode == TIME_MODE_TOTAL) { - dtime = time/(nelements-1); + dtime = time_PV/(nelements-1); for (i=0; inumAxes; j++) { +#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; } @@ -1011,14 +1019,22 @@ 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]; +#if LT_SEQ_VERSION(2,2) seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0); +#else + seq_pvPut(ssId, pVar->motorCurrentIndex[j], 0, DEFAULT_TIMEOUT); +#endif } if (pVar->debugLevel >= 1) printf("waitEpicsMotors: m1=%f\n", pVar->epicsMotorPos[0]); epicsThreadSleep(POLL_INTERVAL); } for (j=0; jnumAxes; j++) { pVar->motorCurrent[j] = pVar->epicsMotorPos[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); } @@ -1036,7 +1052,7 @@ static int buildTrajectory(SS_ID ssId, struct UserVar *pVar, double *realTimeTra double *accelDist, double *decelDist) { - double dp, dt, v_ideal, v_lin, accel_p, accel_v, time; + double dp, dt, v_ideal, v_lin, accel_p, accel_v, thisTime; double x0; int i, dir; @@ -1135,13 +1151,13 @@ static int buildTrajectory(SS_ID ssId, struct UserVar *pVar, double *realTimeTra } for (i=0; idebugLevel >= 1) printf("%10.2f %10d %10d %10d %10d\n", time, position[i], NINT(x0), velocity[i], acceleration[i]); + if (pVar->debugLevel >= 1) printf("%10.2f %10d %10d %10d %10d\n", thisTime, position[i], NINT(x0), velocity[i], acceleration[i]); } if (pVar->addAccelDecel) {