From adcb1b52c9be266a651baf796f5a0a32b6370436 Mon Sep 17 00:00:00 2001 From: cbteeple Date: Tue, 12 Oct 2021 17:11:25 -0400 Subject: [PATCH] reset current live position when zeroing the origin, and improved comments --- .../2021_07_20_high_accuracy.dmc | 81 ++++++++++++++++++- 1 file changed, 78 insertions(+), 3 deletions(-) diff --git a/galil_stage_program/2021_07_20_high_accuracy.dmc b/galil_stage_program/2021_07_20_high_accuracy.dmc index 963cac3..33135dc 100644 --- a/galil_stage_program/2021_07_20_high_accuracy.dmc +++ b/galil_stage_program/2021_07_20_high_accuracy.dmc @@ -75,6 +75,8 @@ joyhzone = 0.90 debug=0 ' ' +' +'=========================================== #LOOP JG ;' Make sure we are in jog mode. xangle=(@AN[1]-2.69)/2.38;' Calculate the joystick's x-axis position @@ -135,6 +137,8 @@ JP#SETORIG,@IN[6]=0 JP#HOME,@IN[17]=0 ' ' +' +'=========================================== #PADLOOP a3=@AN[3] IF (a3<0) @@ -197,8 +201,11 @@ BG X,Y JP#LOOP ' ' -' MOVE TO HOME POSITION IN LASER VIEW +' +'=========================================== #HOMELAS +' Move to the home position in laser view +' homedx=deltax homedy=deltay JS#HOMEMOV @@ -207,8 +214,11 @@ CB 1 ;' Turn off the "CAM VIEW" light. EN ' ' -' MOVE TO HOME POSITION IN CAMERA VIEW +' +'=========================================== #HOMECAM +' Move to the home position in camera view +' homedx=0 homedy=0 JS#HOMEMOV @@ -217,7 +227,12 @@ SB 1 ;' Turn on the "CAM VIEW" light EN ' ' +' +'=========================================== #HOMEMOV +' Move home via a series of overshooting moves +' (This leads to more-precise motion) +' 'LM XY VS 400000;VA 1000000;VD 1000000; overx=-500 @@ -271,8 +286,11 @@ limithit=0 EN ' ' -' MOVE HOME WITH SOME OFFSET +' +'=========================================== #HOMESTP +' Move home with some distance offset +' MC ;' Wait for motion to stop actx=_TPA ;' Save current position. acty=_TPB @@ -308,7 +326,13 @@ ENDIF EN ' ' +' +'=========================================== #HOME +' Move the stage to the home position. If the +' HOME button is pressed for longer than 2 seconds, +' Perform the homing proedure (#HOMEXY) +' btntime=TIME ST MC @@ -336,12 +360,18 @@ BG X,Y JP#LOOP ' ' +' +'=========================================== #HOMEXY +' Perform homing procedure. Move the stage in +' the negative direction until an endstop is hit. +' homing=1 JG ;' Make sure we are in jog mode. JP#LOOP,@IN[17]=0 JG -400000,0; BG X,Y +' If the endstop is not hit, keep moving JP#HOMEXY,limithit=0 MG "X-Axis is homed" ST @@ -350,6 +380,8 @@ LM XY cury=_TPB DP xcamhome,0 DE xcamhome,0 +' +' Move to the camera view JS#HOMECAM homing=0 limithit=0 @@ -359,7 +391,15 @@ BG X,Y JP#LOOP ' ' +' +'=========================================== #SETORIG +' Zero the origin to the current position. If the +' ZERO ORIGIN button is pressed for longer than 2 +' seconds, set the origin offsets (#SETDEL) +' +currposx=0 ;' Reset the relative position +currposy=0 ;' Reset the relative position btntime=TIME ST MC @@ -386,7 +426,11 @@ usermove=0 loopnum=0 ' ' +' +'=========================================== #FLASH +' Flash some lights in response to actions +' bit2=@OUT[2] bit3=@OUT[3] SB 2;SB 3 @@ -405,7 +449,12 @@ JP#LOOP EN ' ' +' +'=========================================== #FLASH2 +' Flash some lights quickly to indicate +' action complete. +' bit2=@OUT[2] bit3=@OUT[3] SB 2;SB 3 @@ -420,7 +469,12 @@ WT 300 EN ' ' +' +'=========================================== #FLASH3 +' Flash some lights slowly to indicate +' error state. +' bit2=@OUT[2] bit3=@OUT[3] SB 2;SB 3 @@ -435,7 +489,11 @@ WT 300 EN ' ' +' +'=========================================== #FLASHX +' Flash the x-endstop light. +' bit2=@OUT[2] SB 2 WT 300 @@ -448,7 +506,11 @@ WT 300 EN ' ' +' +'=========================================== #FLASHY +' Flash the y-endstop light. +' bit3=@OUT[3] SB 3 WT 300 @@ -461,7 +523,12 @@ WT 300 EN ' ' +' +'=========================================== #FLASHAL +' Flash both lights slowy to indicate +' error state. +' bit2=@OUT[2] bit3=@OUT[3] SB 1;SB 2;SB 3 @@ -476,7 +543,11 @@ WT 300 EN ' ' +' +'=========================================== #SETDEL +' Set the values of the origin offset deltas +' curx=_TPA ;' Save current position. cury=_TPB MG "" @@ -497,7 +568,11 @@ EN ' ' ' +'=========================================== #LIMSWI +' Handle limit switch hits (stop the stage +' and bounce back) +' limithit=1 VS 400000;VA 4000000;VD 4000000; DC 10000000,10000000