/* C code for program wireCalibrate, generated by snc from ../wirecalibrate.st */ #include #include #include #include #include "seq_snc.h" /* Variable declarations */ struct seqg_vars { # line 39 "../wirecalibrate.st" unsigned int zeroResetFlag; # line 44 "../wirecalibrate.st" int wasReset; # line 45 "../wirecalibrate.st" int endOfProfile; # line 46 "../wirecalibrate.st" double totalRange; # line 47 "../wirecalibrate.st" double newFoundLow; # line 48 "../wirecalibrate.st" double newFoundHigh; # line 49 "../wirecalibrate.st" double originalLower; # line 50 "../wirecalibrate.st" double originalUpper; # line 51 "../wirecalibrate.st" double originalVelocity; # line 52 "../wirecalibrate.st" double originalBaseVelocity; # line 54 "../wirecalibrate.st" unsigned int AutoFindZero; # line 55 "../wirecalibrate.st" unsigned int StartCalProf; # line 56 "../wirecalibrate.st" string CalibText; # line 58 "../wirecalibrate.st" int CalibProgress; # line 59 "../wirecalibrate.st" int SetupLock; # line 60 "../wirecalibrate.st" int SetupMode; # line 62 "../wirecalibrate.st" double ZeroOffset; # line 63 "../wirecalibrate.st" double LowerLimit; # line 64 "../wirecalibrate.st" double UpperLimit; # line 65 "../wirecalibrate.st" double LowerMarker; # line 66 "../wirecalibrate.st" double UpperMarker; # line 67 "../wirecalibrate.st" double BaseVelocity; # line 68 "../wirecalibrate.st" double Position; # line 69 "../wirecalibrate.st" double RequestPos; # line 70 "../wirecalibrate.st" double Velocity; # line 71 "../wirecalibrate.st" unsigned int IsMoving; # line 72 "../wirecalibrate.st" unsigned int AtLoLimit; # line 73 "../wirecalibrate.st" unsigned int AtHiLimit; # line 74 "../wirecalibrate.st" unsigned int Stop; # line 75 "../wirecalibrate.st" unsigned int RelMove; # line 77 "../wirecalibrate.st" unsigned int WaitForEvent; # line 78 "../wirecalibrate.st" unsigned int CalStepSize; # line 79 "../wirecalibrate.st" double CalDelayTime; # line 80 "../wirecalibrate.st" int InsertCircBuf; # line 82 "../wirecalibrate.st" int PushOffset; # line 84 "../wirecalibrate.st" int CalDirection; # line 85 "../wirecalibrate.st" int SlowVelocity; # line 86 "../wirecalibrate.st" int TotalTravel; # line 87 "../wirecalibrate.st" int BackOffLimit; # line 88 "../wirecalibrate.st" int LVDTRatioMode; # line 89 "../wirecalibrate.st" int LVDTSetCycles; # line 90 "../wirecalibrate.st" int FillMotionBuf; # line 91 "../wirecalibrate.st" int FillLVDTBuf; # line 92 "../wirecalibrate.st" short ResetLVDTProf; # line 93 "../wirecalibrate.st" short ResetMotionProf; # line 94 "../wirecalibrate.st" double MidpointOffset; }; /* Function declarations */ #define seqg_var (*(struct seqg_vars *const *)seqg_env) /* Program init func */ static void seqg_init(PROG_ID seqg_env) { } /****** Code for state "INIT" in state set "ZeroReset" ******/ /* Event function for state "INIT" in state set "ZeroReset" */ static seqBool seqg_event_ZeroReset_0_INIT(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 106 "../wirecalibrate.st" if (seqg_var->zeroResetFlag > 0.0) { *seqg_pnst = 0; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "INIT" in state set "ZeroReset" */ static void seqg_action_ZeroReset_0_INIT(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 108 "../wirecalibrate.st" seqg_var->zeroResetFlag = 0.0; # line 109 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 0/*zeroResetFlag*/, SYNC, DEFAULT_TIMEOUT); # line 111 "../wirecalibrate.st" seqg_var->SetupLock = 0; # line 112 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 5/*SetupLock*/, SYNC, DEFAULT_TIMEOUT); # line 113 "../wirecalibrate.st" seqg_var->SetupMode = 1; # line 114 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 6/*SetupMode*/, SYNC, DEFAULT_TIMEOUT); # line 116 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 13/*Position*/, DEFAULT, DEFAULT_TIMEOUT); # line 117 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 7/*ZeroOffset*/, DEFAULT, DEFAULT_TIMEOUT); # line 119 "../wirecalibrate.st" seqg_var->ZeroOffset -= seqg_var->Position; # line 120 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 7/*ZeroOffset*/, SYNC, DEFAULT_TIMEOUT); # line 122 "../wirecalibrate.st" seqg_var->SetupMode = 0; # line 123 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 6/*SetupMode*/, SYNC, DEFAULT_TIMEOUT); # line 124 "../wirecalibrate.st" seqg_var->SetupLock = 1; # line 125 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 5/*SetupLock*/, SYNC, DEFAULT_TIMEOUT); # line 131 "../wirecalibrate.st" seqg_var->PushOffset = 1; # line 132 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 25/*PushOffset*/, SYNC, DEFAULT_TIMEOUT); # line 134 "../wirecalibrate.st" printf("*** Reset ZERO point; motor was at %g, offset was already %g.\n", seqg_var->Position, seqg_var->ZeroOffset); } return; } } /****** Code for state "INIT" in state set "FindZero" ******/ /* Event function for state "INIT" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_INIT(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { if (TRUE) { *seqg_pnst = 1; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "INIT" in state set "FindZero" */ static void seqg_action_FindZero_1_INIT(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 151 "../wirecalibrate.st" seqg_var->wasReset = 0; # line 153 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Normal Operating Mode"); # line 154 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 156 "../wirecalibrate.st" seqg_var->CalibProgress = 0; # line 157 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "READY_TO_START" in state set "FindZero" ******/ /* Event function for state "READY_TO_START" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_READY_TO_START(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 164 "../wirecalibrate.st" if (seqg_var->AutoFindZero > 0.0) { *seqg_pnst = 2; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "READY_TO_START" in state set "FindZero" */ static void seqg_action_FindZero_1_READY_TO_START(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 166 "../wirecalibrate.st" printf("*** STARTING Calibration\n"); # line 168 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "STARTING Phase 1. Finding Center..."); # line 169 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 171 "../wirecalibrate.st" seqg_var->CalibProgress = 0; # line 172 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 174 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 9/*UpperLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 175 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 8/*LowerLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 176 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 28/*TotalTravel*/, DEFAULT, DEFAULT_TIMEOUT); # line 177 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 26/*CalDirection*/, DEFAULT, DEFAULT_TIMEOUT); # line 182 "../wirecalibrate.st" seqg_var->totalRange = seqg_var->TotalTravel; # line 183 "../wirecalibrate.st" printf("*** LIMITS for Calibration are %g to %g\n", seqg_var->LowerLimit, seqg_var->UpperLimit); # line 185 "../wirecalibrate.st" seqg_var->originalLower = seqg_var->LowerLimit; # line 186 "../wirecalibrate.st" seqg_var->originalUpper = seqg_var->UpperLimit; # line 188 "../wirecalibrate.st" seqg_var->UpperLimit += seqg_var->totalRange; # line 189 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 9/*UpperLimit*/, SYNC, DEFAULT_TIMEOUT); # line 190 "../wirecalibrate.st" seqg_var->UpperMarker = seqg_var->UpperLimit; # line 191 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 11/*UpperMarker*/, SYNC, DEFAULT_TIMEOUT); # line 193 "../wirecalibrate.st" seqg_var->LowerLimit -= seqg_var->totalRange; # line 194 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 8/*LowerLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 195 "../wirecalibrate.st" seqg_var->LowerMarker = seqg_var->LowerLimit; # line 196 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 10/*LowerMarker*/, DEFAULT, DEFAULT_TIMEOUT); # line 198 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 199 "../wirecalibrate.st" seqg_var->originalVelocity = seqg_var->Velocity; # line 201 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 12/*BaseVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 202 "../wirecalibrate.st" seqg_var->originalBaseVelocity = seqg_var->BaseVelocity; # line 204 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 27/*SlowVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 209 "../wirecalibrate.st" seqg_var->Velocity /= 4; # line 210 "../wirecalibrate.st" if (seqg_var->Velocity < seqg_var->BaseVelocity) # line 211 "../wirecalibrate.st" seqg_var->Velocity = seqg_var->BaseVelocity; # line 213 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 215 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "SEARCHING for First Limit Switch..."); # line 216 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 218 "../wirecalibrate.st" seqg_var->CalibProgress = 25; # line 219 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 221 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) # line 222 "../wirecalibrate.st" seqg_var->RequestPos = seqg_var->LowerLimit; else # line 224 "../wirecalibrate.st" seqg_var->RequestPos = seqg_var->UpperLimit; # line 225 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 14/*RequestPos*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "MOVING_TO_FIRST_LIMIT" in state set "FindZero" ******/ /* Event function for state "MOVING_TO_FIRST_LIMIT" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_MOVING_TO_FIRST_LIMIT(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 233 "../wirecalibrate.st" if (seqg_var->AutoFindZero <= 0.0) { *seqg_pnst = 10; *seqg_ptrn = 0; return TRUE; } # line 245 "../wirecalibrate.st" if (!seqg_var->IsMoving) { *seqg_pnst = 3; *seqg_ptrn = 1; return TRUE; } # line 264 "../wirecalibrate.st" if (seq_delay(seqg_env, 200.0)) { *seqg_pnst = 10; *seqg_ptrn = 2; return TRUE; } return FALSE; } /* Action function for state "MOVING_TO_FIRST_LIMIT" in state set "FindZero" */ static void seqg_action_FindZero_1_MOVING_TO_FIRST_LIMIT(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 235 "../wirecalibrate.st" seqg_var->Stop = 1; # line 236 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 237 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 238 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 240 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 241 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 247 "../wirecalibrate.st" printf("*** FINISHED moving; FOUND first limit, ready to back away.\n"); # line 252 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 29/*BackOffLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 254 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) # line 255 "../wirecalibrate.st" seqg_var->RelMove = seqg_var->BackOffLimit; else # line 257 "../wirecalibrate.st" seqg_var->RelMove = -seqg_var->BackOffLimit; # line 258 "../wirecalibrate.st" printf(" *** (1) back away %d from first limit.\n", seqg_var->RelMove); # line 260 "../wirecalibrate.st" if (seqg_var->RelMove != 0) # line 261 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 20/*RelMove*/, SYNC, DEFAULT_TIMEOUT); } return; case 2: { # line 266 "../wirecalibrate.st" seqg_var->Stop = 1; # line 267 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 269 "../wirecalibrate.st" seqg_var->AutoFindZero = 0; # line 270 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 1/*AutoFindZero*/, DEFAULT, DEFAULT_TIMEOUT); # line 272 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 273 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 274 "../wirecalibrate.st" printf("*** CALIBRATION FAILED. Cannot find first limit switch.\n"); # line 276 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "FAILED; Cannot find first Limit in 40 secs."); # line 277 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "BACKOFF_AND_RETRY" in state set "FindZero" ******/ /* Event function for state "BACKOFF_AND_RETRY" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_BACKOFF_AND_RETRY(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 285 "../wirecalibrate.st" if (seqg_var->AutoFindZero <= 0.0) { *seqg_pnst = 10; *seqg_ptrn = 0; return TRUE; } # line 297 "../wirecalibrate.st" if (!seqg_var->IsMoving) { *seqg_pnst = 4; *seqg_ptrn = 1; return TRUE; } # line 325 "../wirecalibrate.st" if (seq_delay(seqg_env, 30.0)) { *seqg_pnst = 10; *seqg_ptrn = 2; return TRUE; } return FALSE; } /* Action function for state "BACKOFF_AND_RETRY" in state set "FindZero" */ static void seqg_action_FindZero_1_BACKOFF_AND_RETRY(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 287 "../wirecalibrate.st" seqg_var->Stop = 1; # line 288 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 289 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 290 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 292 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 293 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 299 "../wirecalibrate.st" printf("*** FINISHED moving; backed away and resetting first switch.\n"); # line 301 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Resetting First Limit Switch..."); # line 302 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 304 "../wirecalibrate.st" seqg_var->CalibProgress = 25; # line 305 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 311 "../wirecalibrate.st" seqg_var->BaseVelocity = seqg_var->SlowVelocity; # line 312 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 12/*BaseVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 314 "../wirecalibrate.st" seqg_var->Velocity = seqg_var->SlowVelocity; # line 315 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 317 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) # line 318 "../wirecalibrate.st" seqg_var->RequestPos = seqg_var->LowerLimit; else # line 320 "../wirecalibrate.st" seqg_var->RequestPos = seqg_var->UpperLimit; # line 321 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 14/*RequestPos*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 2: { # line 327 "../wirecalibrate.st" seqg_var->Stop = 1; # line 328 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 330 "../wirecalibrate.st" seqg_var->AutoFindZero = 0; # line 331 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 1/*AutoFindZero*/, DEFAULT, DEFAULT_TIMEOUT); # line 333 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 334 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 335 "../wirecalibrate.st" printf("*** CALIBRATION FAILED. Cannot recalibrate outer limit.\n"); # line 337 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "FAILED; Cannot escape Outer Limit in 30 secs."); # line 338 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "RESET_FIRST_LIMIT" in state set "FindZero" ******/ /* Event function for state "RESET_FIRST_LIMIT" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_RESET_FIRST_LIMIT(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 345 "../wirecalibrate.st" if (seqg_var->AutoFindZero <= 0.0) { *seqg_pnst = 10; *seqg_ptrn = 0; return TRUE; } # line 357 "../wirecalibrate.st" if (!seqg_var->IsMoving) { *seqg_pnst = 5; *seqg_ptrn = 1; return TRUE; } # line 386 "../wirecalibrate.st" if (seq_delay(seqg_env, 200.0)) { *seqg_pnst = 10; *seqg_ptrn = 2; return TRUE; } return FALSE; } /* Action function for state "RESET_FIRST_LIMIT" in state set "FindZero" */ static void seqg_action_FindZero_1_RESET_FIRST_LIMIT(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 347 "../wirecalibrate.st" seqg_var->Stop = 1; # line 348 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 349 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 350 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 352 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 353 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 359 "../wirecalibrate.st" printf("*** FINISHED moving; backing away from first limit.\n"); # line 364 "../wirecalibrate.st" seqg_var->Velocity = seqg_var->originalVelocity; # line 365 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 367 "../wirecalibrate.st" seqg_var->BaseVelocity = seqg_var->originalBaseVelocity; # line 368 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 12/*BaseVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 373 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 29/*BackOffLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 374 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) # line 375 "../wirecalibrate.st" seqg_var->RelMove = seqg_var->BackOffLimit; else # line 377 "../wirecalibrate.st" seqg_var->RelMove = -seqg_var->BackOffLimit; # line 378 "../wirecalibrate.st" printf(" *** (2) back away %d from first limit.\n", seqg_var->RelMove); # line 379 "../wirecalibrate.st" if (seqg_var->RelMove != 0) # line 380 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 20/*RelMove*/, SYNC, DEFAULT_TIMEOUT); # line 382 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Outer Limit Switch is Calibrated..."); # line 383 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 2: { # line 388 "../wirecalibrate.st" seqg_var->Stop = 1; # line 389 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 391 "../wirecalibrate.st" seqg_var->AutoFindZero = 0; # line 392 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 1/*AutoFindZero*/, DEFAULT, DEFAULT_TIMEOUT); # line 394 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 395 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 396 "../wirecalibrate.st" printf("*** CALIBRATION FAILED. Cannot find low limit.\n"); # line 398 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "FAILED; Cannot Find Low Limit in 90 secs."); # line 399 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "BACK_OFF_FIRST_LIMIT" in state set "FindZero" ******/ /* Event function for state "BACK_OFF_FIRST_LIMIT" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_BACK_OFF_FIRST_LIMIT(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 407 "../wirecalibrate.st" if (seqg_var->AutoFindZero <= 0.0) { *seqg_pnst = 10; *seqg_ptrn = 0; return TRUE; } # line 419 "../wirecalibrate.st" if (!seqg_var->IsMoving) { *seqg_pnst = 6; *seqg_ptrn = 1; return TRUE; } # line 450 "../wirecalibrate.st" if (seq_delay(seqg_env, 30.0)) { *seqg_pnst = 10; *seqg_ptrn = 2; return TRUE; } return FALSE; } /* Action function for state "BACK_OFF_FIRST_LIMIT" in state set "FindZero" */ static void seqg_action_FindZero_1_BACK_OFF_FIRST_LIMIT(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 409 "../wirecalibrate.st" seqg_var->Stop = 1; # line 410 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 411 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 412 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 414 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 415 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 421 "../wirecalibrate.st" printf("*** FINISHED moving; BACKED AWAY from outer limit.\n"); # line 423 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 13/*Position*/, DEFAULT, DEFAULT_TIMEOUT); # line 430 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) { # line 432 "../wirecalibrate.st" seqg_var->newFoundLow = seqg_var->Position; # line 433 "../wirecalibrate.st" seqg_var->RelMove = seqg_var->TotalTravel * 0.80; } else { # line 437 "../wirecalibrate.st" seqg_var->newFoundHigh = seqg_var->Position; # line 438 "../wirecalibrate.st" seqg_var->RelMove = seqg_var->TotalTravel * -0.80; } # line 441 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 20/*RelMove*/, DEFAULT, DEFAULT_TIMEOUT); # line 443 "../wirecalibrate.st" printf("*** MOTION for Calibration CONTINUES... Moving fast towards the second Limit.\n"); # line 445 "../wirecalibrate.st" seqg_var->CalibProgress = 40; # line 446 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 2: { # line 452 "../wirecalibrate.st" seqg_var->Stop = 1; # line 453 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 455 "../wirecalibrate.st" seqg_var->AutoFindZero = 0; # line 456 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 1/*AutoFindZero*/, DEFAULT, DEFAULT_TIMEOUT); # line 458 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 459 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 460 "../wirecalibrate.st" printf("*** CALIBRATION FAILED. Cannot Back away from low limit.\n"); # line 462 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "FAILED; Cannot Back away from Low Limit in 30 secs."); # line 463 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "TOWARDS_SECOND_LIMIT" in state set "FindZero" ******/ /* Event function for state "TOWARDS_SECOND_LIMIT" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_TOWARDS_SECOND_LIMIT(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 470 "../wirecalibrate.st" if (seqg_var->AutoFindZero <= 0.0) { *seqg_pnst = 10; *seqg_ptrn = 0; return TRUE; } # line 482 "../wirecalibrate.st" if (!seqg_var->IsMoving) { *seqg_pnst = 7; *seqg_ptrn = 1; return TRUE; } # line 517 "../wirecalibrate.st" if (seq_delay(seqg_env, 200.0)) { *seqg_pnst = 10; *seqg_ptrn = 2; return TRUE; } return FALSE; } /* Action function for state "TOWARDS_SECOND_LIMIT" in state set "FindZero" */ static void seqg_action_FindZero_1_TOWARDS_SECOND_LIMIT(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 472 "../wirecalibrate.st" seqg_var->Stop = 1; # line 473 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 474 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 475 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 477 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 478 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 484 "../wirecalibrate.st" printf("*** FINISHED moving towards second limit.\n"); # line 490 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 27/*SlowVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 491 "../wirecalibrate.st" seqg_var->BaseVelocity = seqg_var->SlowVelocity; # line 492 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 12/*BaseVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 494 "../wirecalibrate.st" seqg_var->Velocity = seqg_var->SlowVelocity; # line 495 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 497 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Stepping towards second Limit..."); # line 498 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 500 "../wirecalibrate.st" seqg_var->CalibProgress = 60; # line 501 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 508 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) # line 509 "../wirecalibrate.st" seqg_var->RelMove = seqg_var->TotalTravel * 0.25; else # line 511 "../wirecalibrate.st" seqg_var->RelMove = seqg_var->TotalTravel * -0.25; # line 512 "../wirecalibrate.st" if (seqg_var->RelMove != 0) # line 513 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 20/*RelMove*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 2: { # line 519 "../wirecalibrate.st" seqg_var->Stop = 1; # line 520 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 522 "../wirecalibrate.st" seqg_var->AutoFindZero = 0; # line 523 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 1/*AutoFindZero*/, DEFAULT, DEFAULT_TIMEOUT); # line 525 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 526 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 528 "../wirecalibrate.st" printf("*** CALIBRATION FAILED. Cannot approach high limit.\n"); # line 529 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "FAILED; Cannot move towards Inner Limit in 60 secs."); # line 530 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "FOUND_SECOND_LIMIT" in state set "FindZero" ******/ /* Event function for state "FOUND_SECOND_LIMIT" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_FOUND_SECOND_LIMIT(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 537 "../wirecalibrate.st" if (seqg_var->AutoFindZero <= 0.0) { *seqg_pnst = 10; *seqg_ptrn = 0; return TRUE; } # line 548 "../wirecalibrate.st" if (!seqg_var->IsMoving) { *seqg_pnst = 8; *seqg_ptrn = 1; return TRUE; } # line 567 "../wirecalibrate.st" if (seq_delay(seqg_env, 200.0)) { *seqg_pnst = 10; *seqg_ptrn = 2; return TRUE; } return FALSE; } /* Action function for state "FOUND_SECOND_LIMIT" in state set "FindZero" */ static void seqg_action_FindZero_1_FOUND_SECOND_LIMIT(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 539 "../wirecalibrate.st" seqg_var->Stop = 1; # line 540 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 541 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 542 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 544 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 545 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 551 "../wirecalibrate.st" printf("*** FINISHED moving; FOUND Inner limit.\n"); # line 556 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 29/*BackOffLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 558 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) # line 559 "../wirecalibrate.st" seqg_var->RelMove = -seqg_var->BackOffLimit; else # line 561 "../wirecalibrate.st" seqg_var->RelMove = seqg_var->BackOffLimit; # line 562 "../wirecalibrate.st" printf(" *** (3) back away %d from second limit.\n", seqg_var->RelMove); # line 563 "../wirecalibrate.st" if (seqg_var->RelMove != 0) # line 564 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 20/*RelMove*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 2: { # line 569 "../wirecalibrate.st" seqg_var->Stop = 1; # line 570 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 572 "../wirecalibrate.st" seqg_var->AutoFindZero = 0; # line 573 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 1/*AutoFindZero*/, DEFAULT, DEFAULT_TIMEOUT); # line 575 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 576 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 578 "../wirecalibrate.st" printf("*** CALIBRATION FAILED. Cannot find high limit.\n"); # line 579 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "FAILED; Cannot Find High Limit in 60 secs."); # line 580 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "BACK_OFF_SECOND_LIMIT" in state set "FindZero" ******/ /* Event function for state "BACK_OFF_SECOND_LIMIT" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_BACK_OFF_SECOND_LIMIT(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 588 "../wirecalibrate.st" if (seqg_var->AutoFindZero <= 0.0) { *seqg_pnst = 10; *seqg_ptrn = 0; return TRUE; } # line 599 "../wirecalibrate.st" if (!seqg_var->IsMoving) { *seqg_pnst = 9; *seqg_ptrn = 1; return TRUE; } # line 642 "../wirecalibrate.st" if (seq_delay(seqg_env, 200.0)) { *seqg_pnst = 10; *seqg_ptrn = 2; return TRUE; } return FALSE; } /* Action function for state "BACK_OFF_SECOND_LIMIT" in state set "FindZero" */ static void seqg_action_FindZero_1_BACK_OFF_SECOND_LIMIT(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 590 "../wirecalibrate.st" seqg_var->Stop = 1; # line 591 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 592 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 593 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 595 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 596 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 602 "../wirecalibrate.st" printf("*** FINISHED moving; BACKED AWAY from second limit.\n"); # line 604 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "MOVING to Zero Point..."); # line 605 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 607 "../wirecalibrate.st" seqg_var->CalibProgress = 80; # line 608 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 610 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 13/*Position*/, DEFAULT, DEFAULT_TIMEOUT); # line 612 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) # line 613 "../wirecalibrate.st" seqg_var->newFoundHigh = seqg_var->Position; else # line 615 "../wirecalibrate.st" seqg_var->newFoundLow = seqg_var->Position; # line 617 "../wirecalibrate.st" seqg_var->BaseVelocity = seqg_var->originalBaseVelocity; # line 618 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 12/*BaseVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 620 "../wirecalibrate.st" seqg_var->Velocity = seqg_var->originalVelocity; # line 621 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 629 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 36/*MidpointOffset*/, DEFAULT, DEFAULT_TIMEOUT); # line 631 "../wirecalibrate.st" seqg_var->RequestPos = ((seqg_var->newFoundHigh - seqg_var->newFoundLow) / 2.0) + seqg_var->newFoundLow; # line 632 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) # line 633 "../wirecalibrate.st" seqg_var->RequestPos += seqg_var->MidpointOffset; else # line 635 "../wirecalibrate.st" seqg_var->RequestPos -= seqg_var->MidpointOffset; # line 637 "../wirecalibrate.st" printf("*** MOTION for Calibration CONTINUES... Moving to Center point at %g.\n", seqg_var->RequestPos); # line 638 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 14/*RequestPos*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 2: { # line 644 "../wirecalibrate.st" seqg_var->Stop = 1; # line 645 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 647 "../wirecalibrate.st" seqg_var->AutoFindZero = 0; # line 648 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 1/*AutoFindZero*/, DEFAULT, DEFAULT_TIMEOUT); # line 650 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 651 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 653 "../wirecalibrate.st" printf("*** CALIBRATION FAILED. Cannot back away from high limit.\n"); # line 654 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "FAILED; Cannot Back Away from High Limit in 30 secs."); # line 655 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "FOUND_CENTER" in state set "FindZero" ******/ /* Event function for state "FOUND_CENTER" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_FOUND_CENTER(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 662 "../wirecalibrate.st" if (seqg_var->AutoFindZero <= 0.0) { *seqg_pnst = 10; *seqg_ptrn = 0; return TRUE; } # line 675 "../wirecalibrate.st" if (!seqg_var->IsMoving) { *seqg_pnst = 11; *seqg_ptrn = 1; return TRUE; } # line 741 "../wirecalibrate.st" if (seq_delay(seqg_env, 200.0)) { *seqg_pnst = 10; *seqg_ptrn = 2; return TRUE; } return FALSE; } /* Action function for state "FOUND_CENTER" in state set "FindZero" */ static void seqg_action_FindZero_1_FOUND_CENTER(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 664 "../wirecalibrate.st" seqg_var->Stop = 1; # line 665 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 667 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 668 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 670 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 671 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 677 "../wirecalibrate.st" printf("*** FINISHED moving; FOUND Center position.\n"); # line 679 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "ADJUSTING Parameters to Zero..."); # line 680 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 687 "../wirecalibrate.st" seqg_var->LowerLimit = seqg_var->newFoundLow; # line 688 "../wirecalibrate.st" seqg_var->UpperLimit = seqg_var->newFoundHigh; # line 690 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 9/*UpperLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 691 "../wirecalibrate.st" seqg_var->UpperMarker = seqg_var->UpperLimit; # line 692 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 11/*UpperMarker*/, DEFAULT, DEFAULT_TIMEOUT); # line 694 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 8/*LowerLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 695 "../wirecalibrate.st" seqg_var->LowerMarker = seqg_var->LowerLimit; # line 696 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 10/*LowerMarker*/, DEFAULT, DEFAULT_TIMEOUT); # line 702 "../wirecalibrate.st" seqg_var->SetupLock = 0; # line 703 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 5/*SetupLock*/, SYNC, DEFAULT_TIMEOUT); # line 704 "../wirecalibrate.st" seqg_var->SetupMode = 1; # line 705 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 6/*SetupMode*/, SYNC, DEFAULT_TIMEOUT); # line 707 "../wirecalibrate.st" printf("*** Calibrating position as Zero point.\n"); # line 709 "../wirecalibrate.st" seqg_var->RequestPos = 0.0; # line 710 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 14/*RequestPos*/, SYNC, DEFAULT_TIMEOUT); # line 712 "../wirecalibrate.st" seqg_var->BaseVelocity = seqg_var->originalBaseVelocity; # line 713 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 12/*BaseVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 715 "../wirecalibrate.st" seqg_var->Velocity = seqg_var->originalVelocity; # line 716 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 718 "../wirecalibrate.st" seqg_var->SetupMode = 0; # line 719 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 6/*SetupMode*/, SYNC, DEFAULT_TIMEOUT); # line 720 "../wirecalibrate.st" seqg_var->SetupLock = 1; # line 721 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 5/*SetupLock*/, SYNC, DEFAULT_TIMEOUT); # line 727 "../wirecalibrate.st" seqg_var->PushOffset = 1; # line 728 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 25/*PushOffset*/, SYNC, DEFAULT_TIMEOUT); # line 730 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 731 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 733 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration Successful."); # line 734 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 736 "../wirecalibrate.st" seqg_var->AutoFindZero = 0; # line 737 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 1/*AutoFindZero*/, SYNC, DEFAULT_TIMEOUT); } return; case 2: { # line 743 "../wirecalibrate.st" seqg_var->Stop = 1; # line 744 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 746 "../wirecalibrate.st" seqg_var->AutoFindZero = 0; # line 747 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 1/*AutoFindZero*/, DEFAULT, DEFAULT_TIMEOUT); # line 749 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 750 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 752 "../wirecalibrate.st" printf("*** CALIBRATION FAILED. Cannot find center of travel.\n"); # line 754 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "FAILED; Cannot Recalibrate in 40 secs."); # line 755 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "CANCELLED" in state set "FindZero" ******/ /* Event function for state "CANCELLED" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_CANCELLED(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 762 "../wirecalibrate.st" if (seqg_var->wasReset == 0) { *seqg_pnst = 10; *seqg_ptrn = 0; return TRUE; } # line 790 "../wirecalibrate.st" if (seq_delay(seqg_env, 10.0)) { *seqg_pnst = 0; *seqg_ptrn = 1; return TRUE; } return FALSE; } /* Action function for state "CANCELLED" in state set "FindZero" */ static void seqg_action_FindZero_1_CANCELLED(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 764 "../wirecalibrate.st" seqg_var->LowerLimit = seqg_var->originalLower; # line 765 "../wirecalibrate.st" seqg_var->UpperLimit = seqg_var->originalUpper; # line 767 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 9/*UpperLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 768 "../wirecalibrate.st" seqg_var->UpperMarker = seqg_var->UpperLimit; # line 769 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 11/*UpperMarker*/, DEFAULT, DEFAULT_TIMEOUT); # line 771 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 8/*LowerLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 772 "../wirecalibrate.st" seqg_var->LowerMarker = seqg_var->LowerLimit; # line 773 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 10/*LowerMarker*/, DEFAULT, DEFAULT_TIMEOUT); # line 775 "../wirecalibrate.st" seqg_var->Velocity = seqg_var->originalVelocity; # line 776 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 778 "../wirecalibrate.st" seqg_var->BaseVelocity = seqg_var->originalBaseVelocity; # line 779 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 12/*BaseVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 781 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 782 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 784 "../wirecalibrate.st" seqg_var->AutoFindZero = 0; # line 785 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 1/*AutoFindZero*/, DEFAULT, DEFAULT_TIMEOUT); # line 786 "../wirecalibrate.st" seqg_var->wasReset = 1; } return; case 1: { # line 792 "../wirecalibrate.st" seqg_var->AutoFindZero = 0; # line 793 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 1/*AutoFindZero*/, DEFAULT, DEFAULT_TIMEOUT); # line 794 "../wirecalibrate.st" printf("*** CALIBRATION CANCELLED.\n"); } return; } } /****** Code for state "COMPLETE" in state set "FindZero" ******/ /* Event function for state "COMPLETE" in state set "FindZero" */ static seqBool seqg_event_FindZero_1_COMPLETE(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 800 "../wirecalibrate.st" if (seq_delay(seqg_env, 5.0)) { *seqg_pnst = 0; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "COMPLETE" in state set "FindZero" */ static void seqg_action_FindZero_1_COMPLETE(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 802 "../wirecalibrate.st" printf("*** CALIBRATION COMPLETE.\n"); } return; } } /****** Code for state "INIT_PROFILE" in state set "AcquireMotionProfile" ******/ /* Event function for state "INIT_PROFILE" in state set "AcquireMotionProfile" */ static seqBool seqg_event_AcquireMotionProfile_2_INIT_PROFILE(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { if (TRUE) { *seqg_pnst = 1; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "INIT_PROFILE" in state set "AcquireMotionProfile" */ static void seqg_action_AcquireMotionProfile_2_INIT_PROFILE(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 813 "../wirecalibrate.st" seqg_var->wasReset = 0; # line 814 "../wirecalibrate.st" seqg_var->endOfProfile = 0; # line 816 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Normal Operating Mode"); # line 817 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 819 "../wirecalibrate.st" seqg_var->CalibProgress = 0; # line 820 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "READY_TO_PROFILE" in state set "AcquireMotionProfile" ******/ /* Event function for state "READY_TO_PROFILE" in state set "AcquireMotionProfile" */ static seqBool seqg_event_AcquireMotionProfile_2_READY_TO_PROFILE(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 827 "../wirecalibrate.st" if (seqg_var->StartCalProf > 0.0) { *seqg_pnst = 2; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "READY_TO_PROFILE" in state set "AcquireMotionProfile" */ static void seqg_action_AcquireMotionProfile_2_READY_TO_PROFILE(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 829 "../wirecalibrate.st" printf("*** 1: STARTING Calibration\n"); # line 831 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "STARTING Phase 2. Measuring Profile..."); # line 832 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 838 "../wirecalibrate.st" seqg_var->PushOffset = 1; # line 839 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 25/*PushOffset*/, SYNC, DEFAULT_TIMEOUT); # line 841 "../wirecalibrate.st" seqg_var->CalibProgress = 0; # line 842 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 844 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 26/*CalDirection*/, DEFAULT, DEFAULT_TIMEOUT); # line 846 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 9/*UpperLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 847 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 8/*LowerLimit*/, DEFAULT, DEFAULT_TIMEOUT); # line 848 "../wirecalibrate.st" seqg_var->totalRange = seqg_var->UpperLimit - seqg_var->LowerLimit; # line 850 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 23/*CalDelayTime*/, DEFAULT, DEFAULT_TIMEOUT); # line 852 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 853 "../wirecalibrate.st" seqg_var->originalVelocity = seqg_var->Velocity; # line 855 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 12/*BaseVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 856 "../wirecalibrate.st" seqg_var->originalBaseVelocity = seqg_var->BaseVelocity; # line 858 "../wirecalibrate.st" printf("*** 2: MOTION for Calibration is STARTING. Moving to first Limit.\n"); # line 859 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "MOVING to first Limit..."); # line 860 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 862 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) # line 863 "../wirecalibrate.st" seqg_var->RequestPos = seqg_var->UpperLimit; else # line 865 "../wirecalibrate.st" seqg_var->RequestPos = seqg_var->LowerLimit; # line 867 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 14/*RequestPos*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "FOUND_PROFILE_START" in state set "AcquireMotionProfile" ******/ /* Event function for state "FOUND_PROFILE_START" in state set "AcquireMotionProfile" */ static seqBool seqg_event_AcquireMotionProfile_2_FOUND_PROFILE_START(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 873 "../wirecalibrate.st" if (seqg_var->StartCalProf <= 0.0) { *seqg_pnst = 7; *seqg_ptrn = 0; return TRUE; } # line 885 "../wirecalibrate.st" if (!seqg_var->IsMoving) { *seqg_pnst = 4; *seqg_ptrn = 1; return TRUE; } # line 919 "../wirecalibrate.st" if (seq_delay(seqg_env, 200.0)) { *seqg_pnst = 7; *seqg_ptrn = 2; return TRUE; } return FALSE; } /* Action function for state "FOUND_PROFILE_START" in state set "AcquireMotionProfile" */ static void seqg_action_AcquireMotionProfile_2_FOUND_PROFILE_START(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 875 "../wirecalibrate.st" seqg_var->Stop = 1; # line 876 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 877 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 878 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 880 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 881 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 887 "../wirecalibrate.st" printf("*** 3: FINISHED moving; AT first limit.\n"); # line 889 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "ACQUIRING Motion Profile..."); # line 890 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 892 "../wirecalibrate.st" seqg_var->CalibProgress = 10; # line 893 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 895 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 27/*SlowVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 896 "../wirecalibrate.st" seqg_var->BaseVelocity = seqg_var->SlowVelocity; # line 897 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 12/*BaseVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 899 "../wirecalibrate.st" seqg_var->Velocity = seqg_var->SlowVelocity; # line 900 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 902 "../wirecalibrate.st" seqg_var->LVDTRatioMode = 1; # line 903 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 30/*LVDTRatioMode*/, DEFAULT, DEFAULT_TIMEOUT); # line 905 "../wirecalibrate.st" seqg_var->LVDTSetCycles = 3; # line 906 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 31/*LVDTSetCycles*/, DEFAULT, DEFAULT_TIMEOUT); # line 911 "../wirecalibrate.st" seqg_var->ResetMotionProf = 1; # line 912 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 35/*ResetMotionProf*/, SYNC, DEFAULT_TIMEOUT); # line 914 "../wirecalibrate.st" seqg_var->ResetLVDTProf = 1; # line 915 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 34/*ResetLVDTProf*/, SYNC, DEFAULT_TIMEOUT); } return; case 2: { # line 921 "../wirecalibrate.st" seqg_var->StartCalProf = 0; # line 922 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 2/*StartCalProf*/, DEFAULT, DEFAULT_TIMEOUT); # line 924 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 925 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 926 "../wirecalibrate.st" printf("*** 4: CALIBRATION FAILED. Cannot find low limit.\n"); # line 928 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "FAILED; Cannot Find Low Limit in 60 secs."); # line 929 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "NEXT_PROFILE_READ" in state set "AcquireMotionProfile" ******/ /* Event function for state "NEXT_PROFILE_READ" in state set "AcquireMotionProfile" */ static seqBool seqg_event_AcquireMotionProfile_2_NEXT_PROFILE_READ(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 936 "../wirecalibrate.st" if (seqg_var->StartCalProf <= 0.0) { *seqg_pnst = 7; *seqg_ptrn = 0; return TRUE; } # line 948 "../wirecalibrate.st" if (seqg_var->endOfProfile == 1) { *seqg_pnst = 6; *seqg_ptrn = 1; return TRUE; } # line 959 "../wirecalibrate.st" if (seqg_var->AtLoLimit || seqg_var->AtHiLimit) { *seqg_pnst = 7; *seqg_ptrn = 2; return TRUE; } # line 970 "../wirecalibrate.st" if (!seqg_var->IsMoving) { *seqg_pnst = 4; *seqg_ptrn = 3; return TRUE; } # line 974 "../wirecalibrate.st" if (seq_delay(seqg_env, 200.0)) { *seqg_pnst = 7; *seqg_ptrn = 4; return TRUE; } return FALSE; } /* Action function for state "NEXT_PROFILE_READ" in state set "AcquireMotionProfile" */ static void seqg_action_AcquireMotionProfile_2_NEXT_PROFILE_READ(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 938 "../wirecalibrate.st" seqg_var->Stop = 1; # line 939 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 940 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 941 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 943 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 944 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 951 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Reached end of Travel. Preparing Data..."); # line 952 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 954 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 955 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 2: { # line 961 "../wirecalibrate.st" printf("*** 5: LIMIT SWITCH encountered invalid calibration sequence.\n"); # line 962 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Hit Limit Switch. Profile Cancelled."); # line 963 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 965 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 966 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 3: { } return; case 4: { # line 976 "../wirecalibrate.st" seqg_var->StartCalProf = 0; # line 977 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 2/*StartCalProf*/, DEFAULT, DEFAULT_TIMEOUT); # line 979 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 980 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 981 "../wirecalibrate.st" printf("*** 6: CALIBRATION FAILED. Cannot step to next data point.\n"); # line 983 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "FAILED; Cannot Step in 20 secs."); # line 984 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "NEXT_PROFILE_WAIT" in state set "AcquireMotionProfile" ******/ /* Event function for state "NEXT_PROFILE_WAIT" in state set "AcquireMotionProfile" */ static seqBool seqg_event_AcquireMotionProfile_2_NEXT_PROFILE_WAIT(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 991 "../wirecalibrate.st" if (seqg_var->StartCalProf <= 0.0) { *seqg_pnst = 7; *seqg_ptrn = 0; return TRUE; } # line 1003 "../wirecalibrate.st" if (seq_delay(seqg_env, seqg_var->CalDelayTime)) { *seqg_pnst = 5; *seqg_ptrn = 1; return TRUE; } return FALSE; } /* Action function for state "NEXT_PROFILE_WAIT" in state set "AcquireMotionProfile" */ static void seqg_action_AcquireMotionProfile_2_NEXT_PROFILE_WAIT(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 993 "../wirecalibrate.st" seqg_var->Stop = 1; # line 994 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 995 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 996 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 998 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 999 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 1016 "../wirecalibrate.st" seqg_var->InsertCircBuf = 1; # line 1017 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 24/*InsertCircBuf*/, SYNC, DEFAULT_TIMEOUT); } return; } } /****** Code for state "NEXT_PROFILE_MOTION" in state set "AcquireMotionProfile" ******/ /* Event function for state "NEXT_PROFILE_MOTION" in state set "AcquireMotionProfile" */ static seqBool seqg_event_AcquireMotionProfile_2_NEXT_PROFILE_MOTION(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 1023 "../wirecalibrate.st" if (seqg_var->StartCalProf <= 0.0) { *seqg_pnst = 7; *seqg_ptrn = 0; return TRUE; } # line 1035 "../wirecalibrate.st" if (!seqg_var->WaitForEvent) { *seqg_pnst = 3; *seqg_ptrn = 1; return TRUE; } # line 1099 "../wirecalibrate.st" if (seq_delay(seqg_env, 20.0)) { *seqg_pnst = 7; *seqg_ptrn = 2; return TRUE; } return FALSE; } /* Action function for state "NEXT_PROFILE_MOTION" in state set "AcquireMotionProfile" */ static void seqg_action_AcquireMotionProfile_2_NEXT_PROFILE_MOTION(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 1025 "../wirecalibrate.st" seqg_var->Stop = 1; # line 1026 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 19/*Stop*/, DEFAULT, DEFAULT_TIMEOUT); # line 1027 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Calibration CANCELLED."); # line 1028 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 1030 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 1031 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 1: { # line 1038 "../wirecalibrate.st" printf("*** 7: Next Calibration Step [%g]\n", seqg_var->Position); # line 1039 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 22/*CalStepSize*/, DEFAULT, DEFAULT_TIMEOUT); # line 1040 "../wirecalibrate.st" seq_pvGetTmo(seqg_env, 13/*Position*/, DEFAULT, DEFAULT_TIMEOUT); # line 1046 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) # line 1047 "../wirecalibrate.st" seqg_var->CalibProgress = (seqg_var->Position - seqg_var->LowerLimit) / seqg_var->totalRange; else # line 1049 "../wirecalibrate.st" seqg_var->CalibProgress = (seqg_var->UpperLimit - seqg_var->Position) / seqg_var->totalRange; # line 1051 "../wirecalibrate.st" seqg_var->CalibProgress *= (95.0 - 10.0); # line 1052 "../wirecalibrate.st" seqg_var->CalibProgress += 10.0; # line 1054 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 1056 "../wirecalibrate.st" if (seqg_var->CalDirection != 0) { # line 1058 "../wirecalibrate.st" seqg_var->RelMove = -seqg_var->CalStepSize; # line 1059 "../wirecalibrate.st" if (seqg_var->Position - seqg_var->CalStepSize > seqg_var->LowerLimit) # line 1060 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 20/*RelMove*/, DEFAULT, DEFAULT_TIMEOUT); else { # line 1068 "../wirecalibrate.st" printf("*** 8: Found END: Position is %g, Step is %d, second limit is %g.\n", seqg_var->Position, seqg_var->CalStepSize, seqg_var->LowerLimit); # line 1069 "../wirecalibrate.st" seqg_var->endOfProfile = 1; # line 1070 "../wirecalibrate.st" if (seqg_var->Position != seqg_var->LowerLimit) { # line 1072 "../wirecalibrate.st" seqg_var->RequestPos = seqg_var->LowerLimit; # line 1073 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 14/*RequestPos*/, DEFAULT, DEFAULT_TIMEOUT); } } } else { # line 1082 "../wirecalibrate.st" seqg_var->RelMove = seqg_var->CalStepSize; # line 1083 "../wirecalibrate.st" if (seqg_var->Position + seqg_var->CalStepSize < seqg_var->UpperLimit) # line 1084 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 20/*RelMove*/, DEFAULT, DEFAULT_TIMEOUT); else { # line 1087 "../wirecalibrate.st" printf("*** 9: Found END: Position is %g, Step is %d, second limit is %g.\n", seqg_var->Position, seqg_var->CalStepSize, seqg_var->UpperLimit); # line 1088 "../wirecalibrate.st" seqg_var->endOfProfile = 1; # line 1089 "../wirecalibrate.st" if (seqg_var->Position != seqg_var->UpperLimit) { # line 1091 "../wirecalibrate.st" seqg_var->RequestPos = seqg_var->UpperLimit; # line 1092 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 14/*RequestPos*/, DEFAULT, DEFAULT_TIMEOUT); } } } } return; case 2: { # line 1101 "../wirecalibrate.st" seqg_var->StartCalProf = 0; # line 1102 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 2/*StartCalProf*/, DEFAULT, DEFAULT_TIMEOUT); # line 1104 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 1105 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 1106 "../wirecalibrate.st" printf("*** 10: CALIBRATION FAILED. Cannot step to next data point.\n"); # line 1108 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "FAILED; Cannot Step in 20 secs."); # line 1109 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "PROFILE_COMPLETE" in state set "AcquireMotionProfile" ******/ /* Event function for state "PROFILE_COMPLETE" in state set "AcquireMotionProfile" */ static seqBool seqg_event_AcquireMotionProfile_2_PROFILE_COMPLETE(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { if (TRUE) { *seqg_pnst = 8; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "PROFILE_COMPLETE" in state set "AcquireMotionProfile" */ static void seqg_action_AcquireMotionProfile_2_PROFILE_COMPLETE(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 1118 "../wirecalibrate.st" printf("*** 11: FINISHED moving; Profiles acquired.\n"); # line 1120 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "SAVING Motion Profiles..."); # line 1121 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 1127 "../wirecalibrate.st" seqg_var->FillMotionBuf = 1; # line 1128 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 32/*FillMotionBuf*/, SYNC, DEFAULT_TIMEOUT); # line 1130 "../wirecalibrate.st" seqg_var->FillLVDTBuf = 1; # line 1131 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 33/*FillLVDTBuf*/, SYNC, DEFAULT_TIMEOUT); # line 1137 "../wirecalibrate.st" seqg_var->Velocity = seqg_var->originalVelocity; # line 1138 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 1140 "../wirecalibrate.st" seqg_var->BaseVelocity = seqg_var->originalBaseVelocity; # line 1141 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 12/*BaseVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 1143 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 1144 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 1146 "../wirecalibrate.st" strcpy(seqg_var->CalibText, "Acquisition Successful."); # line 1147 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 3/*CalibText*/, DEFAULT, DEFAULT_TIMEOUT); # line 1149 "../wirecalibrate.st" seqg_var->StartCalProf = 0; # line 1150 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 2/*StartCalProf*/, SYNC, DEFAULT_TIMEOUT); # line 1152 "../wirecalibrate.st" seqg_var->RequestPos = 0.0; # line 1153 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 14/*RequestPos*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "PROFILE_CANCELLED" in state set "AcquireMotionProfile" ******/ /* Event function for state "PROFILE_CANCELLED" in state set "AcquireMotionProfile" */ static seqBool seqg_event_AcquireMotionProfile_2_PROFILE_CANCELLED(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 1161 "../wirecalibrate.st" if (seqg_var->wasReset == 0) { *seqg_pnst = 7; *seqg_ptrn = 0; return TRUE; } # line 1179 "../wirecalibrate.st" if (seq_delay(seqg_env, 5.0)) { *seqg_pnst = 0; *seqg_ptrn = 1; return TRUE; } return FALSE; } /* Action function for state "PROFILE_CANCELLED" in state set "AcquireMotionProfile" */ static void seqg_action_AcquireMotionProfile_2_PROFILE_CANCELLED(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 1163 "../wirecalibrate.st" seqg_var->Velocity = seqg_var->originalVelocity; # line 1164 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 15/*Velocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 1166 "../wirecalibrate.st" seqg_var->BaseVelocity = seqg_var->originalBaseVelocity; # line 1167 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 12/*BaseVelocity*/, DEFAULT, DEFAULT_TIMEOUT); # line 1169 "../wirecalibrate.st" seqg_var->CalibProgress = 100; # line 1170 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 4/*CalibProgress*/, DEFAULT, DEFAULT_TIMEOUT); # line 1172 "../wirecalibrate.st" seqg_var->StartCalProf = 0; # line 1173 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 2/*StartCalProf*/, DEFAULT, DEFAULT_TIMEOUT); # line 1175 "../wirecalibrate.st" seqg_var->wasReset = 1; } return; case 1: { # line 1181 "../wirecalibrate.st" seqg_var->StartCalProf = 0; # line 1182 "../wirecalibrate.st" seq_pvPutTmo(seqg_env, 2/*StartCalProf*/, DEFAULT, DEFAULT_TIMEOUT); # line 1183 "../wirecalibrate.st" printf("*** 12: CALIBRATION CANCELLED.\n"); } return; } } /****** Code for state "PROFILE_ACQUIRED" in state set "AcquireMotionProfile" ******/ /* Event function for state "PROFILE_ACQUIRED" in state set "AcquireMotionProfile" */ static seqBool seqg_event_AcquireMotionProfile_2_PROFILE_ACQUIRED(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 1190 "../wirecalibrate.st" if (seq_delay(seqg_env, 5.0)) { *seqg_pnst = 0; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "PROFILE_ACQUIRED" in state set "AcquireMotionProfile" */ static void seqg_action_AcquireMotionProfile_2_PROFILE_ACQUIRED(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 1192 "../wirecalibrate.st" printf("*** 13: PROFILE ACQUISITION COMPLETE.\n"); } return; } } #undef seqg_var /************************ Tables ************************/ /* Channel table */ static seqChan seqg_chans[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"{motor}:ZEROSET", offsetof(struct seqg_vars, zeroResetFlag), "zeroResetFlag", P_UINT, 1, 1, 0, 1, 0, 0}, {"{motor}:FINDZERO", offsetof(struct seqg_vars, AutoFindZero), "AutoFindZero", P_UINT, 1, 2, 0, 1, 0, 0}, {"{motor}:STARTCALPROF", offsetof(struct seqg_vars, StartCalProf), "StartCalProf", P_UINT, 1, 3, 0, 1, 0, 0}, {"{motor}:CALTEXT", offsetof(struct seqg_vars, CalibText), "CalibText", P_STRING, 1, 4, 0, 0, 0, 0}, {"{motor}:CALPROGRESS", offsetof(struct seqg_vars, CalibProgress), "CalibProgress", P_INT, 1, 5, 0, 0, 0, 0}, {"{motor}:MOTR.FOFF", offsetof(struct seqg_vars, SetupLock), "SetupLock", P_INT, 1, 6, 0, 1, 0, 0}, {"{motor}:MOTR.SET", offsetof(struct seqg_vars, SetupMode), "SetupMode", P_INT, 1, 7, 0, 1, 0, 0}, {"{motor}:MOTR.OFF", offsetof(struct seqg_vars, ZeroOffset), "ZeroOffset", P_DOUBLE, 1, 8, 0, 1, 0, 0}, {"{motor}:MOTR.LLM", offsetof(struct seqg_vars, LowerLimit), "LowerLimit", P_DOUBLE, 1, 9, 0, 1, 0, 0}, {"{motor}:MOTR.HLM", offsetof(struct seqg_vars, UpperLimit), "UpperLimit", P_DOUBLE, 1, 10, 0, 1, 0, 0}, {"{motor}:MOTR.LOPR", offsetof(struct seqg_vars, LowerMarker), "LowerMarker", P_DOUBLE, 1, 11, 0, 0, 0, 0}, {"{motor}:MOTR.HOPR", offsetof(struct seqg_vars, UpperMarker), "UpperMarker", P_DOUBLE, 1, 12, 0, 0, 0, 0}, {"{motor}:MOTR.VBAS", offsetof(struct seqg_vars, BaseVelocity), "BaseVelocity", P_DOUBLE, 1, 13, 0, 1, 0, 0}, {"{motor}:MOTR.RBV", offsetof(struct seqg_vars, Position), "Position", P_DOUBLE, 1, 14, 0, 1, 0, 0}, {"{motor}:MOTR.VAL", offsetof(struct seqg_vars, RequestPos), "RequestPos", P_DOUBLE, 1, 15, 0, 1, 0, 0}, {"{motor}:MOTR.VELO", offsetof(struct seqg_vars, Velocity), "Velocity", P_DOUBLE, 1, 16, 0, 1, 0, 0}, {"{motor}:MOTR.MOVN", offsetof(struct seqg_vars, IsMoving), "IsMoving", P_UINT, 1, 17, 0, 1, 0, 0}, {"{motor}:MOTR.LLS", offsetof(struct seqg_vars, AtLoLimit), "AtLoLimit", P_UINT, 1, 18, 0, 1, 0, 0}, {"{motor}:MOTR.HLS", offsetof(struct seqg_vars, AtHiLimit), "AtHiLimit", P_UINT, 1, 19, 0, 1, 0, 0}, {"{motor}:MOTR.STOP", offsetof(struct seqg_vars, Stop), "Stop", P_UINT, 1, 20, 0, 1, 0, 0}, {"{motor}:MOTR.RLV", offsetof(struct seqg_vars, RelMove), "RelMove", P_UINT, 1, 21, 0, 1, 0, 0}, {"{motor}:CALIBSYNC", offsetof(struct seqg_vars, WaitForEvent), "WaitForEvent", P_UINT, 1, 22, 0, 1, 0, 0}, {"{motor}:CALSTEPSIZE", offsetof(struct seqg_vars, CalStepSize), "CalStepSize", P_UINT, 1, 23, 0, 1, 0, 0}, {"{motor}:CALDELAYTIME", offsetof(struct seqg_vars, CalDelayTime), "CalDelayTime", P_DOUBLE, 1, 24, 0, 0, 0, 0}, {"{motor}:SYNCMOTPROFILE.PROC", offsetof(struct seqg_vars, InsertCircBuf), "InsertCircBuf", P_INT, 1, 25, 0, 0, 0, 0}, {"{motor}:NEWOFFS.PROC", offsetof(struct seqg_vars, PushOffset), "PushOffset", P_INT, 1, 26, 0, 0, 0, 0}, {"{motor}:CALDIRECTION", offsetof(struct seqg_vars, CalDirection), "CalDirection", P_INT, 1, 27, 0, 0, 0, 0}, {"{motor}:CALSLOWVEL", offsetof(struct seqg_vars, SlowVelocity), "SlowVelocity", P_INT, 1, 28, 0, 0, 0, 0}, {"{motor}:CALTOTTRAV", offsetof(struct seqg_vars, TotalTravel), "TotalTravel", P_INT, 1, 29, 0, 0, 0, 0}, {"{motor}:CALSOFTLIM", offsetof(struct seqg_vars, BackOffLimit), "BackOffLimit", P_INT, 1, 30, 0, 0, 0, 0}, {"{motor}:LVRATIOMODE", offsetof(struct seqg_vars, LVDTRatioMode), "LVDTRatioMode", P_INT, 1, 31, 0, 0, 0, 0}, {"{motor}:LVSETCYCLES", offsetof(struct seqg_vars, LVDTSetCycles), "LVDTSetCycles", P_INT, 1, 32, 0, 0, 0, 0}, {"{motor}:PMOTPROFILE.PROC", offsetof(struct seqg_vars, FillMotionBuf), "FillMotionBuf", P_INT, 1, 33, 0, 0, 0, 0}, {"{motor}:PLVDTPROFILE.PROC", offsetof(struct seqg_vars, FillLVDTBuf), "FillLVDTBuf", P_INT, 1, 34, 0, 0, 0, 0}, {"{motor}:LVDTPROFILE.RES", offsetof(struct seqg_vars, ResetLVDTProf), "ResetLVDTProf", P_SHORT, 1, 35, 0, 0, 0, 0}, {"{motor}:MOTPROFILE.RES", offsetof(struct seqg_vars, ResetMotionProf), "ResetMotionProf", P_SHORT, 1, 36, 0, 0, 0, 0}, {"{motor}:CALMIDOFFSET", offsetof(struct seqg_vars, MidpointOffset), "MidpointOffset", P_DOUBLE, 1, 37, 0, 0, 0, 0}, }; /* Event masks for state set "ZeroReset" */ static const seqMask seqg_mask_ZeroReset_0_INIT[] = { 0x00000002, 0x00000000, }; /* State table for state set "ZeroReset" */ static seqState seqg_states_ZeroReset[] = { { /* state name */ "INIT", /* action function */ seqg_action_ZeroReset_0_INIT, /* event function */ seqg_event_ZeroReset_0_INIT, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_ZeroReset_0_INIT, /* state options */ (0) }, }; /* Event masks for state set "FindZero" */ static const seqMask seqg_mask_FindZero_1_INIT[] = { 0x00000000, 0x00000000, }; static const seqMask seqg_mask_FindZero_1_READY_TO_START[] = { 0x00000004, 0x00000000, }; static const seqMask seqg_mask_FindZero_1_MOVING_TO_FIRST_LIMIT[] = { 0x00020004, 0x00000000, }; static const seqMask seqg_mask_FindZero_1_BACKOFF_AND_RETRY[] = { 0x00020004, 0x00000000, }; static const seqMask seqg_mask_FindZero_1_RESET_FIRST_LIMIT[] = { 0x00020004, 0x00000000, }; static const seqMask seqg_mask_FindZero_1_BACK_OFF_FIRST_LIMIT[] = { 0x00020004, 0x00000000, }; static const seqMask seqg_mask_FindZero_1_TOWARDS_SECOND_LIMIT[] = { 0x00020004, 0x00000000, }; static const seqMask seqg_mask_FindZero_1_FOUND_SECOND_LIMIT[] = { 0x00020004, 0x00000000, }; static const seqMask seqg_mask_FindZero_1_BACK_OFF_SECOND_LIMIT[] = { 0x00020004, 0x00000000, }; static const seqMask seqg_mask_FindZero_1_FOUND_CENTER[] = { 0x00020004, 0x00000000, }; static const seqMask seqg_mask_FindZero_1_CANCELLED[] = { 0x00000000, 0x00000000, }; static const seqMask seqg_mask_FindZero_1_COMPLETE[] = { 0x00000000, 0x00000000, }; /* State table for state set "FindZero" */ static seqState seqg_states_FindZero[] = { { /* state name */ "INIT", /* action function */ seqg_action_FindZero_1_INIT, /* event function */ seqg_event_FindZero_1_INIT, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_INIT, /* state options */ (0) }, { /* state name */ "READY_TO_START", /* action function */ seqg_action_FindZero_1_READY_TO_START, /* event function */ seqg_event_FindZero_1_READY_TO_START, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_READY_TO_START, /* state options */ (0) }, { /* state name */ "MOVING_TO_FIRST_LIMIT", /* action function */ seqg_action_FindZero_1_MOVING_TO_FIRST_LIMIT, /* event function */ seqg_event_FindZero_1_MOVING_TO_FIRST_LIMIT, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_MOVING_TO_FIRST_LIMIT, /* state options */ (0) }, { /* state name */ "BACKOFF_AND_RETRY", /* action function */ seqg_action_FindZero_1_BACKOFF_AND_RETRY, /* event function */ seqg_event_FindZero_1_BACKOFF_AND_RETRY, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_BACKOFF_AND_RETRY, /* state options */ (0) }, { /* state name */ "RESET_FIRST_LIMIT", /* action function */ seqg_action_FindZero_1_RESET_FIRST_LIMIT, /* event function */ seqg_event_FindZero_1_RESET_FIRST_LIMIT, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_RESET_FIRST_LIMIT, /* state options */ (0) }, { /* state name */ "BACK_OFF_FIRST_LIMIT", /* action function */ seqg_action_FindZero_1_BACK_OFF_FIRST_LIMIT, /* event function */ seqg_event_FindZero_1_BACK_OFF_FIRST_LIMIT, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_BACK_OFF_FIRST_LIMIT, /* state options */ (0) }, { /* state name */ "TOWARDS_SECOND_LIMIT", /* action function */ seqg_action_FindZero_1_TOWARDS_SECOND_LIMIT, /* event function */ seqg_event_FindZero_1_TOWARDS_SECOND_LIMIT, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_TOWARDS_SECOND_LIMIT, /* state options */ (0) }, { /* state name */ "FOUND_SECOND_LIMIT", /* action function */ seqg_action_FindZero_1_FOUND_SECOND_LIMIT, /* event function */ seqg_event_FindZero_1_FOUND_SECOND_LIMIT, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_FOUND_SECOND_LIMIT, /* state options */ (0) }, { /* state name */ "BACK_OFF_SECOND_LIMIT", /* action function */ seqg_action_FindZero_1_BACK_OFF_SECOND_LIMIT, /* event function */ seqg_event_FindZero_1_BACK_OFF_SECOND_LIMIT, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_BACK_OFF_SECOND_LIMIT, /* state options */ (0) }, { /* state name */ "FOUND_CENTER", /* action function */ seqg_action_FindZero_1_FOUND_CENTER, /* event function */ seqg_event_FindZero_1_FOUND_CENTER, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_FOUND_CENTER, /* state options */ (0) }, { /* state name */ "CANCELLED", /* action function */ seqg_action_FindZero_1_CANCELLED, /* event function */ seqg_event_FindZero_1_CANCELLED, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_CANCELLED, /* state options */ (0) }, { /* state name */ "COMPLETE", /* action function */ seqg_action_FindZero_1_COMPLETE, /* event function */ seqg_event_FindZero_1_COMPLETE, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_FindZero_1_COMPLETE, /* state options */ (0) }, }; /* Event masks for state set "AcquireMotionProfile" */ static const seqMask seqg_mask_AcquireMotionProfile_2_INIT_PROFILE[] = { 0x00000000, 0x00000000, }; static const seqMask seqg_mask_AcquireMotionProfile_2_READY_TO_PROFILE[] = { 0x00000008, 0x00000000, }; static const seqMask seqg_mask_AcquireMotionProfile_2_FOUND_PROFILE_START[] = { 0x00020008, 0x00000000, }; static const seqMask seqg_mask_AcquireMotionProfile_2_NEXT_PROFILE_READ[] = { 0x000e0008, 0x00000000, }; static const seqMask seqg_mask_AcquireMotionProfile_2_NEXT_PROFILE_WAIT[] = { 0x01000008, 0x00000000, }; static const seqMask seqg_mask_AcquireMotionProfile_2_NEXT_PROFILE_MOTION[] = { 0x00400008, 0x00000000, }; static const seqMask seqg_mask_AcquireMotionProfile_2_PROFILE_COMPLETE[] = { 0x00000000, 0x00000000, }; static const seqMask seqg_mask_AcquireMotionProfile_2_PROFILE_CANCELLED[] = { 0x00000000, 0x00000000, }; static const seqMask seqg_mask_AcquireMotionProfile_2_PROFILE_ACQUIRED[] = { 0x00000000, 0x00000000, }; /* State table for state set "AcquireMotionProfile" */ static seqState seqg_states_AcquireMotionProfile[] = { { /* state name */ "INIT_PROFILE", /* action function */ seqg_action_AcquireMotionProfile_2_INIT_PROFILE, /* event function */ seqg_event_AcquireMotionProfile_2_INIT_PROFILE, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_AcquireMotionProfile_2_INIT_PROFILE, /* state options */ (0) }, { /* state name */ "READY_TO_PROFILE", /* action function */ seqg_action_AcquireMotionProfile_2_READY_TO_PROFILE, /* event function */ seqg_event_AcquireMotionProfile_2_READY_TO_PROFILE, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_AcquireMotionProfile_2_READY_TO_PROFILE, /* state options */ (0) }, { /* state name */ "FOUND_PROFILE_START", /* action function */ seqg_action_AcquireMotionProfile_2_FOUND_PROFILE_START, /* event function */ seqg_event_AcquireMotionProfile_2_FOUND_PROFILE_START, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_AcquireMotionProfile_2_FOUND_PROFILE_START, /* state options */ (0) }, { /* state name */ "NEXT_PROFILE_READ", /* action function */ seqg_action_AcquireMotionProfile_2_NEXT_PROFILE_READ, /* event function */ seqg_event_AcquireMotionProfile_2_NEXT_PROFILE_READ, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_AcquireMotionProfile_2_NEXT_PROFILE_READ, /* state options */ (0) }, { /* state name */ "NEXT_PROFILE_WAIT", /* action function */ seqg_action_AcquireMotionProfile_2_NEXT_PROFILE_WAIT, /* event function */ seqg_event_AcquireMotionProfile_2_NEXT_PROFILE_WAIT, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_AcquireMotionProfile_2_NEXT_PROFILE_WAIT, /* state options */ (0) }, { /* state name */ "NEXT_PROFILE_MOTION", /* action function */ seqg_action_AcquireMotionProfile_2_NEXT_PROFILE_MOTION, /* event function */ seqg_event_AcquireMotionProfile_2_NEXT_PROFILE_MOTION, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_AcquireMotionProfile_2_NEXT_PROFILE_MOTION, /* state options */ (0) }, { /* state name */ "PROFILE_COMPLETE", /* action function */ seqg_action_AcquireMotionProfile_2_PROFILE_COMPLETE, /* event function */ seqg_event_AcquireMotionProfile_2_PROFILE_COMPLETE, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_AcquireMotionProfile_2_PROFILE_COMPLETE, /* state options */ (0) }, { /* state name */ "PROFILE_CANCELLED", /* action function */ seqg_action_AcquireMotionProfile_2_PROFILE_CANCELLED, /* event function */ seqg_event_AcquireMotionProfile_2_PROFILE_CANCELLED, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_AcquireMotionProfile_2_PROFILE_CANCELLED, /* state options */ (0) }, { /* state name */ "PROFILE_ACQUIRED", /* action function */ seqg_action_AcquireMotionProfile_2_PROFILE_ACQUIRED, /* event function */ seqg_event_AcquireMotionProfile_2_PROFILE_ACQUIRED, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_AcquireMotionProfile_2_PROFILE_ACQUIRED, /* state options */ (0) }, }; /* State set table */ static seqSS seqg_statesets[] = { { /* state set name */ "ZeroReset", /* states */ seqg_states_ZeroReset, /* number of states */ 1 }, { /* state set name */ "FindZero", /* states */ seqg_states_FindZero, /* number of states */ 12 }, { /* state set name */ "AcquireMotionProfile", /* states */ seqg_states_AcquireMotionProfile, /* number of states */ 9 }, }; /* Program table (global) */ seqProgram wireCalibrate = { /* magic number */ 2002004, /* program name */ "wireCalibrate", /* channels */ seqg_chans, /* num. channels */ 37, /* state sets */ seqg_statesets, /* num. state sets */ 3, /* user var size */ sizeof(struct seqg_vars), /* param */ "", /* num. event flags */ 0, /* encoded options */ (0 | OPT_CONN | OPT_DEBUG | OPT_NEWEF | OPT_REENT), /* init func */ seqg_init, /* entry func */ 0, /* exit func */ 0, /* num. queues */ 0 }; /* Register sequencer commands and program */ #include "epicsExport.h" static void wireCalibrateRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&wireCalibrate); } epicsExportRegistrar(wireCalibrateRegistrar);