From 3193d36a3d7484a5f5ada22f757c3519340f0d96 Mon Sep 17 00:00:00 2001 From: dpslwk Date: Fri, 1 Dec 2023 12:37:13 +0000 Subject: [PATCH] Subroutines: improve abort messages, especially 'tool not in carousel' --- configs/atc_sim/macros_sim_inch/clamptool.ngc | 2 +- configs/atc_sim/macros_sim_inch/extendatc.ngc | 2 +- configs/atc_sim/macros_sim_inch/m10.ngc | 5 ++- configs/atc_sim/macros_sim_inch/m11.ngc | 5 ++- configs/atc_sim/macros_sim_inch/m12.ngc | 5 ++- configs/atc_sim/macros_sim_inch/m13.ngc | 5 ++- configs/atc_sim/macros_sim_inch/m21.ngc | 5 ++- configs/atc_sim/macros_sim_inch/m22.ngc | 7 ++-- configs/atc_sim/macros_sim_inch/m24.ngc | 1 + configs/atc_sim/macros_sim_inch/m25.ngc | 3 +- .../atc_sim/macros_sim_inch/retractatc.ngc | 2 +- .../atc_sim/macros_sim_inch/toolchange.ngc | 41 +++++++++++++++---- .../atc_sim/macros_sim_inch/unclamptool.ngc | 2 +- .../atc_sim/macros_sim_metric/clamptool.ngc | 2 +- .../atc_sim/macros_sim_metric/extendatc.ngc | 2 +- configs/atc_sim/macros_sim_metric/m10.ngc | 5 ++- configs/atc_sim/macros_sim_metric/m11.ngc | 5 ++- configs/atc_sim/macros_sim_metric/m12.ngc | 5 ++- configs/atc_sim/macros_sim_metric/m13.ngc | 5 ++- configs/atc_sim/macros_sim_metric/m21.ngc | 5 ++- configs/atc_sim/macros_sim_metric/m22.ngc | 7 ++-- configs/atc_sim/macros_sim_metric/m24.ngc | 1 + configs/atc_sim/macros_sim_metric/m25.ngc | 3 +- .../atc_sim/macros_sim_metric/retractatc.ngc | 2 +- .../atc_sim/macros_sim_metric/toolchange.ngc | 41 +++++++++++++++---- .../atc_sim/macros_sim_metric/unclamptool.ngc | 2 +- configs/probe_basic/subroutines/clamptool.ngc | 2 +- configs/probe_basic/subroutines/extendatc.ngc | 2 +- configs/probe_basic/subroutines/m10.ngc | 5 ++- configs/probe_basic/subroutines/m11.ngc | 5 ++- configs/probe_basic/subroutines/m12.ngc | 5 ++- configs/probe_basic/subroutines/m13.ngc | 5 ++- configs/probe_basic/subroutines/m21.ngc | 5 ++- configs/probe_basic/subroutines/m22.ngc | 7 ++-- configs/probe_basic/subroutines/m24.ngc | 3 +- configs/probe_basic/subroutines/m25.ngc | 3 +- .../probe_basic/subroutines/retractatc.ngc | 2 +- .../probe_basic/subroutines/toolchange.ngc | 41 +++++++++++++++---- .../probe_basic/subroutines/unclamptool.ngc | 2 +- .../subroutines/clamptool.ngc | 2 +- .../subroutines/extendatc.ngc | 2 +- configs/probe_basic_lathe/subroutines/m10.ngc | 5 ++- configs/probe_basic_lathe/subroutines/m11.ngc | 5 ++- configs/probe_basic_lathe/subroutines/m12.ngc | 5 ++- configs/probe_basic_lathe/subroutines/m13.ngc | 5 ++- configs/probe_basic_lathe/subroutines/m21.ngc | 5 ++- configs/probe_basic_lathe/subroutines/m22.ngc | 7 ++-- configs/probe_basic_lathe/subroutines/m24.ngc | 3 +- configs/probe_basic_lathe/subroutines/m25.ngc | 3 +- .../subroutines/retractatc.ngc | 2 +- .../subroutines/toolchange.ngc | 41 +++++++++++++++---- .../subroutines/unclamptool.ngc | 2 +- 52 files changed, 234 insertions(+), 110 deletions(-) diff --git a/configs/atc_sim/macros_sim_inch/clamptool.ngc b/configs/atc_sim/macros_sim_inch/clamptool.ngc index a167d778..8b1a7b1b 100644 --- a/configs/atc_sim/macros_sim_inch/clamptool.ngc +++ b/configs/atc_sim/macros_sim_inch/clamptool.ngc @@ -4,7 +4,7 @@ M65 P2 ; clamp the tool M66 P5 L3 Q2 ; check the clamped tool sensor o100 if [#5399 LT 0] - (abort, failed to release tool) ; abort if the sensor does not activate in 2 seconds + (abort, Failed to release tool) ; abort if the sensor does not activate in 2 seconds o100 endif o endsub [1] diff --git a/configs/atc_sim/macros_sim_inch/extendatc.ngc b/configs/atc_sim/macros_sim_inch/extendatc.ngc index b16d6413..95828367 100644 --- a/configs/atc_sim/macros_sim_inch/extendatc.ngc +++ b/configs/atc_sim/macros_sim_inch/extendatc.ngc @@ -20,7 +20,7 @@ M64 P0 ; Move Carousel OUT M66 P1 L3 Q5 ; check for carousel out position sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif o endsub [1] diff --git a/configs/atc_sim/macros_sim_inch/m10.ngc b/configs/atc_sim/macros_sim_inch/m10.ngc index c02e0788..2562672e 100644 --- a/configs/atc_sim/macros_sim_inch/m10.ngc +++ b/configs/atc_sim/macros_sim_inch/m10.ngc @@ -4,7 +4,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] M13 @@ -17,7 +17,7 @@ o101 if [EXISTS[#<_ini[atc]pockets>]] o101 endif # = [#3990 - #

] -(PRINT, o P#

, steps=#) +(PRINT, o P#

, steps=#) o110 if [# GT [# / 2]] #=[# - #] o110 endif @@ -31,6 +31,7 @@ o130 elseif [# LT 0] M11 P[#] o130 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_inch/m11.ngc b/configs/atc_sim/macros_sim_inch/m11.ngc index 096f578b..3db74563 100644 --- a/configs/atc_sim/macros_sim_inch/m11.ngc +++ b/configs/atc_sim/macros_sim_inch/m11.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] (PRINT, atc not homed, homing) @@ -34,7 +34,7 @@ o120 do M66 P4 L1 Q3 ; wait for rising edge on rotation index o130 if [#5399 LT 0] M65 P4 ; Stop atc motor - (abort, failed to get rotation index) + (abort, Failed to get rotation index) o130 endif #3990 = [[[#3990+2] MOD #]-1] ; Pocket is no.1-# # = [#-1] @@ -44,6 +44,7 @@ M65 P4 ; Stop motor #<_my_current_pocket> = #3990 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_inch/m12.ngc b/configs/atc_sim/macros_sim_inch/m12.ngc index c1d4c3ca..34f2d6f3 100644 --- a/configs/atc_sim/macros_sim_inch/m12.ngc +++ b/configs/atc_sim/macros_sim_inch/m12.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] (PRINT, atc not homed, homing) @@ -34,7 +34,7 @@ o120 do M66 P4 L1 Q3 ; wait for rising edge on rotation index o130 if [#5399 LT 0] M65 P3 ; Stop atc motor - (abort, failed to get rotation index) + (abort, Failed to get rotation index) o130 endif #3990 = [[[#3990-2] MOD #]+1] ; Pocket is no.1-# # = [#-1] @@ -44,6 +44,7 @@ M65 P3 ; Stop motor #<_my_current_pocket> = #3990 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_inch/m13.ngc b/configs/atc_sim/macros_sim_inch/m13.ngc index 06da95e4..ede03334 100644 --- a/configs/atc_sim/macros_sim_inch/m13.ngc +++ b/configs/atc_sim/macros_sim_inch/m13.ngc @@ -4,7 +4,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o) +(PRINT, o) (DEBUG, EVAL[vcp.getWidget{"dynatc"}.atc_message{"REFERENCING"}]) @@ -12,7 +12,7 @@ M64 P3 ; Move Motor FWD M66 P3 L1 Q20 ; wait for rising edge on home index o100 if [#5399 LT 0] M65 P3 ; stop motor - (abort, failed to home carousel) + (abort, Failed to home carousel) o100 endif #3990 = 1 @@ -36,6 +36,7 @@ o120 endwhile M61 Q#3991 G43 H#3991 #5210 = 0 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_inch/m21.ngc b/configs/atc_sim/macros_sim_inch/m21.ngc index 9bffddd1..2ec9daea 100644 --- a/configs/atc_sim/macros_sim_inch/m21.ngc +++ b/configs/atc_sim/macros_sim_inch/m21.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3991 is used to track the current tool loaded it in the spindle (persistently) ; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) ; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o) # = -3.9000 o101 if [EXISTS[#<_ini[atc]z_tool_change_height>]] @@ -29,7 +29,7 @@ M64 P0 ; Move Carousel out M66 P1 L3 Q5 ; check for carousel out sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif M24 ; activate drawbar, release the tool @@ -39,6 +39,7 @@ G0 G53 Z# ; move z to clear height #3991 = 0; save fact there is now no tool in the spindle +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_inch/m22.ngc b/configs/atc_sim/macros_sim_inch/m22.ngc index 825713fa..2e87c9a5 100644 --- a/configs/atc_sim/macros_sim_inch/m22.ngc +++ b/configs/atc_sim/macros_sim_inch/m22.ngc @@ -4,7 +4,7 @@ o sub ; after loading any tool in the current pocket to the spindle ; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) ; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o) # = -3.9000 o101 if [EXISTS[#<_ini[atc]z_tool_change_height>]] @@ -24,18 +24,19 @@ M65 P2 ; release the drawbar to clamp the tool M5 M66 P5 L3 Q1 ; check the tool clamped sensor o100 if [#5399 LT 0] - (abort, failed to reclamp tool) + (abort, Failed to reclamp tool) o100 endif M65 P0 ; Move Carousel home M66 P0 L3 Q4 ; check carousel in position sensor o110 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o110 endif ;M65 P1 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_inch/m24.ngc b/configs/atc_sim/macros_sim_inch/m24.ngc index 484fc11b..37454968 100644 --- a/configs/atc_sim/macros_sim_inch/m24.ngc +++ b/configs/atc_sim/macros_sim_inch/m24.ngc @@ -8,6 +8,7 @@ o100 if [#5399 LT 0] (abort, failed to release tool) ; abort if the sensor does not activate in 3 seconds o100 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_inch/m25.ngc b/configs/atc_sim/macros_sim_inch/m25.ngc index dc55c0f5..a1a7ac98 100644 --- a/configs/atc_sim/macros_sim_inch/m25.ngc +++ b/configs/atc_sim/macros_sim_inch/m25.ngc @@ -6,9 +6,10 @@ M64 P0 ; Move Carousel out M66 P1 L3 Q5 ; check for carousel out sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_inch/retractatc.ngc b/configs/atc_sim/macros_sim_inch/retractatc.ngc index 43c31da6..f9d400fe 100644 --- a/configs/atc_sim/macros_sim_inch/retractatc.ngc +++ b/configs/atc_sim/macros_sim_inch/retractatc.ngc @@ -6,7 +6,7 @@ M64 P1 ; Move Carousel IN M66 P0 L3 Q5 ; check carousel in position sensor o100 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o100 endif M65 P1 diff --git a/configs/atc_sim/macros_sim_inch/toolchange.ngc b/configs/atc_sim/macros_sim_inch/toolchange.ngc index de63b409..21d39094 100644 --- a/configs/atc_sim/macros_sim_inch/toolchange.ngc +++ b/configs/atc_sim/macros_sim_inch/toolchange.ngc @@ -6,8 +6,10 @@ o sub ; Parameters #4001 to #4024 are used to track which tool is in which pocket (persistently) ; Parameter #4000 is not populated just used in the maths to calculate the above numbers ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> +; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) +; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o selected_tool: #, tool_in_spindle: #, selected_pocket: #, current_pocket: #, task: #<_task>) o100 if [#<_task> EQ 0] (DEBUG, Task is null) @@ -20,28 +22,46 @@ o101 if [EXISTS[#<_ini[atc]pockets>]] # = #<_ini[atc]pockets> o101 endif +# = -3.9000 +o102 if [EXISTS[#<_ini[atc]z_tool_change_height>]] + # = #<_ini[atc]z_tool_change_height> +o102 endif +# = [#<_ini[AXIS_Z]MAX_LIMIT>-0.1] +o103 if [EXISTS[#<_ini[atc]z_tool_clearance_height>]] + # = #<_ini[atc]z_tool_clearance_height> +o103 endif + ; assign the programmable coolant parameters # = #1 (=0) # = #2 (=0) # = #3 (=0) # = #4 (=0) -; assign the variables passed by M6 to some parameters +; assign the variables passed by M6 change_prolog to some parameters #100 = # #110 = # #120 = # +#121 = # +; NOTE: +; The legacy names *selected_pocket* and *current_pocket* actually reference +; a sequential tooldata index for tool items loaded from a tool +; table ([EMCIO]TOOL_TABLE) or via a tooldata database ([EMCIO]DB_PROGRAM) -o110 if [#100 EQ #110] ; checks if tool in the spindle is same as requested +o110 if [# EQ #] ; checks if tool in the spindle is same as requested o endsub [1] M2 o110 endif +o111 if [#3991 NE #] + (PRINT, o tool_in_spindle does not match 3991) +o111 endif + # = 0 ; assigns 0 to the next pocket for a later check if the tool is found in the carousel # = 0 #130 = # ; assign test parameter the number of pockets in the carousel o120 do - o121 if [#[4000 + #130] EQ #100] ; checks all pockets to see if it contains tool number requested as the new tool + o121 if [#[4000 + #130] EQ #] ; checks all pockets to see if it contains tool number requested as the new tool # = #130 ; if tool is found in pocket, assigns the next pocket o121 endif o122 if [#[4000 + #130] EQ 0] ; checks if the pocket is empty, last pocket checked will be the lowest empty pocket number, for putting tool in spindle away. @@ -50,7 +70,7 @@ o120 do #130 = [#130 - 1] o120 while [#130 GT 0] o130 if [# EQ 0] ; if tool is not found, aborts and sends a message - (abort, tool not in carousel) + (abort, Tool T%d# not found in carousel) o130 endif ; now we know which pocket the next tool is sitting in @@ -59,7 +79,7 @@ o130 endif o140 if [# GT 0] ; checks if there is a valid tool in the spindle o141 if [# EQ 0] ; If there is a tool in the spindle, checks if there is an open pocket - (abort, carousel is full, cant put away tool in into carousel) + (abort, Carousel is full, cant put away tool T# in into carousel) o141 endif M10 P[#] ; move carousel to an open pocket M21 ; puts the tool in spindle away into the open pocket @@ -67,10 +87,12 @@ o140 if [# GT 0] ; checks if there is a valid tool in the spind #140 = # #[4000 + #140] = # ; save tool number in pocket #3991 = 0 ; empty tool in the spindle + M61 Q0 + G49 o140 endif G90 -G0 G53 Z0 +G0 G53 Z# ; move z to clear height o150 if [# GT 0] ; selected tool is not tool0 M10 P# ; set the carousel to move to the right pocket for the selected tool @@ -79,7 +101,7 @@ o150 if [# GT 0] ; selected tool is not tool0 M66 P1 L3 Q5 ; check carousel out position sensor o151 if [#5399 LT 0] M65 P0 ; turn off the solenoid to send atc to tool change - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o151 endif M65 P0 @@ -95,7 +117,7 @@ o150 else M66 P0 L3 Q4 ; check carousel in position sensor o152 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o152 endif M65 P1 o150 endif @@ -112,6 +134,7 @@ o170 if [# EQ 1] o call [#][#][#][#] o170 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_inch/unclamptool.ngc b/configs/atc_sim/macros_sim_inch/unclamptool.ngc index 1bf17ec5..ac9c3798 100644 --- a/configs/atc_sim/macros_sim_inch/unclamptool.ngc +++ b/configs/atc_sim/macros_sim_inch/unclamptool.ngc @@ -4,7 +4,7 @@ M64 P2 ; unclamp the tool M66 P2 L3 Q2 ; check the unclamped tool sensor o100 if [#5399 LT 0] - (abort, failed to release tool) ; abort if the sensor does not activate in 2 seconds + (abort, Failed to release tool) ; abort if the sensor does not activate in 2 seconds o100 endif o endsub [1] diff --git a/configs/atc_sim/macros_sim_metric/clamptool.ngc b/configs/atc_sim/macros_sim_metric/clamptool.ngc index a167d778..8b1a7b1b 100644 --- a/configs/atc_sim/macros_sim_metric/clamptool.ngc +++ b/configs/atc_sim/macros_sim_metric/clamptool.ngc @@ -4,7 +4,7 @@ M65 P2 ; clamp the tool M66 P5 L3 Q2 ; check the clamped tool sensor o100 if [#5399 LT 0] - (abort, failed to release tool) ; abort if the sensor does not activate in 2 seconds + (abort, Failed to release tool) ; abort if the sensor does not activate in 2 seconds o100 endif o endsub [1] diff --git a/configs/atc_sim/macros_sim_metric/extendatc.ngc b/configs/atc_sim/macros_sim_metric/extendatc.ngc index b16d6413..95828367 100644 --- a/configs/atc_sim/macros_sim_metric/extendatc.ngc +++ b/configs/atc_sim/macros_sim_metric/extendatc.ngc @@ -20,7 +20,7 @@ M64 P0 ; Move Carousel OUT M66 P1 L3 Q5 ; check for carousel out position sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif o endsub [1] diff --git a/configs/atc_sim/macros_sim_metric/m10.ngc b/configs/atc_sim/macros_sim_metric/m10.ngc index c02e0788..2562672e 100644 --- a/configs/atc_sim/macros_sim_metric/m10.ngc +++ b/configs/atc_sim/macros_sim_metric/m10.ngc @@ -4,7 +4,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] M13 @@ -17,7 +17,7 @@ o101 if [EXISTS[#<_ini[atc]pockets>]] o101 endif # = [#3990 - #

] -(PRINT, o P#

, steps=#) +(PRINT, o P#

, steps=#) o110 if [# GT [# / 2]] #=[# - #] o110 endif @@ -31,6 +31,7 @@ o130 elseif [# LT 0] M11 P[#] o130 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_metric/m11.ngc b/configs/atc_sim/macros_sim_metric/m11.ngc index 096f578b..3db74563 100644 --- a/configs/atc_sim/macros_sim_metric/m11.ngc +++ b/configs/atc_sim/macros_sim_metric/m11.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] (PRINT, atc not homed, homing) @@ -34,7 +34,7 @@ o120 do M66 P4 L1 Q3 ; wait for rising edge on rotation index o130 if [#5399 LT 0] M65 P4 ; Stop atc motor - (abort, failed to get rotation index) + (abort, Failed to get rotation index) o130 endif #3990 = [[[#3990+2] MOD #]-1] ; Pocket is no.1-# # = [#-1] @@ -44,6 +44,7 @@ M65 P4 ; Stop motor #<_my_current_pocket> = #3990 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_metric/m12.ngc b/configs/atc_sim/macros_sim_metric/m12.ngc index c1d4c3ca..34f2d6f3 100644 --- a/configs/atc_sim/macros_sim_metric/m12.ngc +++ b/configs/atc_sim/macros_sim_metric/m12.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] (PRINT, atc not homed, homing) @@ -34,7 +34,7 @@ o120 do M66 P4 L1 Q3 ; wait for rising edge on rotation index o130 if [#5399 LT 0] M65 P3 ; Stop atc motor - (abort, failed to get rotation index) + (abort, Failed to get rotation index) o130 endif #3990 = [[[#3990-2] MOD #]+1] ; Pocket is no.1-# # = [#-1] @@ -44,6 +44,7 @@ M65 P3 ; Stop motor #<_my_current_pocket> = #3990 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_metric/m13.ngc b/configs/atc_sim/macros_sim_metric/m13.ngc index 06da95e4..ede03334 100644 --- a/configs/atc_sim/macros_sim_metric/m13.ngc +++ b/configs/atc_sim/macros_sim_metric/m13.ngc @@ -4,7 +4,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o) +(PRINT, o) (DEBUG, EVAL[vcp.getWidget{"dynatc"}.atc_message{"REFERENCING"}]) @@ -12,7 +12,7 @@ M64 P3 ; Move Motor FWD M66 P3 L1 Q20 ; wait for rising edge on home index o100 if [#5399 LT 0] M65 P3 ; stop motor - (abort, failed to home carousel) + (abort, Failed to home carousel) o100 endif #3990 = 1 @@ -36,6 +36,7 @@ o120 endwhile M61 Q#3991 G43 H#3991 #5210 = 0 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_metric/m21.ngc b/configs/atc_sim/macros_sim_metric/m21.ngc index 9bffddd1..2ec9daea 100644 --- a/configs/atc_sim/macros_sim_metric/m21.ngc +++ b/configs/atc_sim/macros_sim_metric/m21.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3991 is used to track the current tool loaded it in the spindle (persistently) ; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) ; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o) # = -3.9000 o101 if [EXISTS[#<_ini[atc]z_tool_change_height>]] @@ -29,7 +29,7 @@ M64 P0 ; Move Carousel out M66 P1 L3 Q5 ; check for carousel out sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif M24 ; activate drawbar, release the tool @@ -39,6 +39,7 @@ G0 G53 Z# ; move z to clear height #3991 = 0; save fact there is now no tool in the spindle +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_metric/m22.ngc b/configs/atc_sim/macros_sim_metric/m22.ngc index 825713fa..2e87c9a5 100644 --- a/configs/atc_sim/macros_sim_metric/m22.ngc +++ b/configs/atc_sim/macros_sim_metric/m22.ngc @@ -4,7 +4,7 @@ o sub ; after loading any tool in the current pocket to the spindle ; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) ; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o) # = -3.9000 o101 if [EXISTS[#<_ini[atc]z_tool_change_height>]] @@ -24,18 +24,19 @@ M65 P2 ; release the drawbar to clamp the tool M5 M66 P5 L3 Q1 ; check the tool clamped sensor o100 if [#5399 LT 0] - (abort, failed to reclamp tool) + (abort, Failed to reclamp tool) o100 endif M65 P0 ; Move Carousel home M66 P0 L3 Q4 ; check carousel in position sensor o110 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o110 endif ;M65 P1 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_metric/m24.ngc b/configs/atc_sim/macros_sim_metric/m24.ngc index 484fc11b..37454968 100644 --- a/configs/atc_sim/macros_sim_metric/m24.ngc +++ b/configs/atc_sim/macros_sim_metric/m24.ngc @@ -8,6 +8,7 @@ o100 if [#5399 LT 0] (abort, failed to release tool) ; abort if the sensor does not activate in 3 seconds o100 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_metric/m25.ngc b/configs/atc_sim/macros_sim_metric/m25.ngc index dc55c0f5..a1a7ac98 100644 --- a/configs/atc_sim/macros_sim_metric/m25.ngc +++ b/configs/atc_sim/macros_sim_metric/m25.ngc @@ -6,9 +6,10 @@ M64 P0 ; Move Carousel out M66 P1 L3 Q5 ; check for carousel out sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_metric/retractatc.ngc b/configs/atc_sim/macros_sim_metric/retractatc.ngc index 43c31da6..f9d400fe 100644 --- a/configs/atc_sim/macros_sim_metric/retractatc.ngc +++ b/configs/atc_sim/macros_sim_metric/retractatc.ngc @@ -6,7 +6,7 @@ M64 P1 ; Move Carousel IN M66 P0 L3 Q5 ; check carousel in position sensor o100 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o100 endif M65 P1 diff --git a/configs/atc_sim/macros_sim_metric/toolchange.ngc b/configs/atc_sim/macros_sim_metric/toolchange.ngc index de63b409..21d39094 100644 --- a/configs/atc_sim/macros_sim_metric/toolchange.ngc +++ b/configs/atc_sim/macros_sim_metric/toolchange.ngc @@ -6,8 +6,10 @@ o sub ; Parameters #4001 to #4024 are used to track which tool is in which pocket (persistently) ; Parameter #4000 is not populated just used in the maths to calculate the above numbers ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> +; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) +; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o selected_tool: #, tool_in_spindle: #, selected_pocket: #, current_pocket: #, task: #<_task>) o100 if [#<_task> EQ 0] (DEBUG, Task is null) @@ -20,28 +22,46 @@ o101 if [EXISTS[#<_ini[atc]pockets>]] # = #<_ini[atc]pockets> o101 endif +# = -3.9000 +o102 if [EXISTS[#<_ini[atc]z_tool_change_height>]] + # = #<_ini[atc]z_tool_change_height> +o102 endif +# = [#<_ini[AXIS_Z]MAX_LIMIT>-0.1] +o103 if [EXISTS[#<_ini[atc]z_tool_clearance_height>]] + # = #<_ini[atc]z_tool_clearance_height> +o103 endif + ; assign the programmable coolant parameters # = #1 (=0) # = #2 (=0) # = #3 (=0) # = #4 (=0) -; assign the variables passed by M6 to some parameters +; assign the variables passed by M6 change_prolog to some parameters #100 = # #110 = # #120 = # +#121 = # +; NOTE: +; The legacy names *selected_pocket* and *current_pocket* actually reference +; a sequential tooldata index for tool items loaded from a tool +; table ([EMCIO]TOOL_TABLE) or via a tooldata database ([EMCIO]DB_PROGRAM) -o110 if [#100 EQ #110] ; checks if tool in the spindle is same as requested +o110 if [# EQ #] ; checks if tool in the spindle is same as requested o endsub [1] M2 o110 endif +o111 if [#3991 NE #] + (PRINT, o tool_in_spindle does not match 3991) +o111 endif + # = 0 ; assigns 0 to the next pocket for a later check if the tool is found in the carousel # = 0 #130 = # ; assign test parameter the number of pockets in the carousel o120 do - o121 if [#[4000 + #130] EQ #100] ; checks all pockets to see if it contains tool number requested as the new tool + o121 if [#[4000 + #130] EQ #] ; checks all pockets to see if it contains tool number requested as the new tool # = #130 ; if tool is found in pocket, assigns the next pocket o121 endif o122 if [#[4000 + #130] EQ 0] ; checks if the pocket is empty, last pocket checked will be the lowest empty pocket number, for putting tool in spindle away. @@ -50,7 +70,7 @@ o120 do #130 = [#130 - 1] o120 while [#130 GT 0] o130 if [# EQ 0] ; if tool is not found, aborts and sends a message - (abort, tool not in carousel) + (abort, Tool T%d# not found in carousel) o130 endif ; now we know which pocket the next tool is sitting in @@ -59,7 +79,7 @@ o130 endif o140 if [# GT 0] ; checks if there is a valid tool in the spindle o141 if [# EQ 0] ; If there is a tool in the spindle, checks if there is an open pocket - (abort, carousel is full, cant put away tool in into carousel) + (abort, Carousel is full, cant put away tool T# in into carousel) o141 endif M10 P[#] ; move carousel to an open pocket M21 ; puts the tool in spindle away into the open pocket @@ -67,10 +87,12 @@ o140 if [# GT 0] ; checks if there is a valid tool in the spind #140 = # #[4000 + #140] = # ; save tool number in pocket #3991 = 0 ; empty tool in the spindle + M61 Q0 + G49 o140 endif G90 -G0 G53 Z0 +G0 G53 Z# ; move z to clear height o150 if [# GT 0] ; selected tool is not tool0 M10 P# ; set the carousel to move to the right pocket for the selected tool @@ -79,7 +101,7 @@ o150 if [# GT 0] ; selected tool is not tool0 M66 P1 L3 Q5 ; check carousel out position sensor o151 if [#5399 LT 0] M65 P0 ; turn off the solenoid to send atc to tool change - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o151 endif M65 P0 @@ -95,7 +117,7 @@ o150 else M66 P0 L3 Q4 ; check carousel in position sensor o152 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o152 endif M65 P1 o150 endif @@ -112,6 +134,7 @@ o170 if [# EQ 1] o call [#][#][#][#] o170 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/atc_sim/macros_sim_metric/unclamptool.ngc b/configs/atc_sim/macros_sim_metric/unclamptool.ngc index 1bf17ec5..ac9c3798 100644 --- a/configs/atc_sim/macros_sim_metric/unclamptool.ngc +++ b/configs/atc_sim/macros_sim_metric/unclamptool.ngc @@ -4,7 +4,7 @@ M64 P2 ; unclamp the tool M66 P2 L3 Q2 ; check the unclamped tool sensor o100 if [#5399 LT 0] - (abort, failed to release tool) ; abort if the sensor does not activate in 2 seconds + (abort, Failed to release tool) ; abort if the sensor does not activate in 2 seconds o100 endif o endsub [1] diff --git a/configs/probe_basic/subroutines/clamptool.ngc b/configs/probe_basic/subroutines/clamptool.ngc index 3d1a69ab..abc300bb 100644 --- a/configs/probe_basic/subroutines/clamptool.ngc +++ b/configs/probe_basic/subroutines/clamptool.ngc @@ -4,7 +4,7 @@ M65 P2 ; clamp the tool M66 P5 L3 Q1 ; check the clamped tool sensor o100 if [#5399 LT 0] - (abort, failed to release tool) ; abort if the sensor does not activate in 2 seconds + (abort, Failed to release tool) ; abort if the sensor does not activate in 2 seconds o100 endif o endsub [1] diff --git a/configs/probe_basic/subroutines/extendatc.ngc b/configs/probe_basic/subroutines/extendatc.ngc index b16d6413..95828367 100644 --- a/configs/probe_basic/subroutines/extendatc.ngc +++ b/configs/probe_basic/subroutines/extendatc.ngc @@ -20,7 +20,7 @@ M64 P0 ; Move Carousel OUT M66 P1 L3 Q5 ; check for carousel out position sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif o endsub [1] diff --git a/configs/probe_basic/subroutines/m10.ngc b/configs/probe_basic/subroutines/m10.ngc index c02e0788..2562672e 100644 --- a/configs/probe_basic/subroutines/m10.ngc +++ b/configs/probe_basic/subroutines/m10.ngc @@ -4,7 +4,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] M13 @@ -17,7 +17,7 @@ o101 if [EXISTS[#<_ini[atc]pockets>]] o101 endif # = [#3990 - #

] -(PRINT, o P#

, steps=#) +(PRINT, o P#

, steps=#) o110 if [# GT [# / 2]] #=[# - #] o110 endif @@ -31,6 +31,7 @@ o130 elseif [# LT 0] M11 P[#] o130 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic/subroutines/m11.ngc b/configs/probe_basic/subroutines/m11.ngc index 096f578b..3db74563 100644 --- a/configs/probe_basic/subroutines/m11.ngc +++ b/configs/probe_basic/subroutines/m11.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] (PRINT, atc not homed, homing) @@ -34,7 +34,7 @@ o120 do M66 P4 L1 Q3 ; wait for rising edge on rotation index o130 if [#5399 LT 0] M65 P4 ; Stop atc motor - (abort, failed to get rotation index) + (abort, Failed to get rotation index) o130 endif #3990 = [[[#3990+2] MOD #]-1] ; Pocket is no.1-# # = [#-1] @@ -44,6 +44,7 @@ M65 P4 ; Stop motor #<_my_current_pocket> = #3990 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic/subroutines/m12.ngc b/configs/probe_basic/subroutines/m12.ngc index c1d4c3ca..34f2d6f3 100644 --- a/configs/probe_basic/subroutines/m12.ngc +++ b/configs/probe_basic/subroutines/m12.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] (PRINT, atc not homed, homing) @@ -34,7 +34,7 @@ o120 do M66 P4 L1 Q3 ; wait for rising edge on rotation index o130 if [#5399 LT 0] M65 P3 ; Stop atc motor - (abort, failed to get rotation index) + (abort, Failed to get rotation index) o130 endif #3990 = [[[#3990-2] MOD #]+1] ; Pocket is no.1-# # = [#-1] @@ -44,6 +44,7 @@ M65 P3 ; Stop motor #<_my_current_pocket> = #3990 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic/subroutines/m13.ngc b/configs/probe_basic/subroutines/m13.ngc index 06da95e4..ede03334 100644 --- a/configs/probe_basic/subroutines/m13.ngc +++ b/configs/probe_basic/subroutines/m13.ngc @@ -4,7 +4,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o) +(PRINT, o) (DEBUG, EVAL[vcp.getWidget{"dynatc"}.atc_message{"REFERENCING"}]) @@ -12,7 +12,7 @@ M64 P3 ; Move Motor FWD M66 P3 L1 Q20 ; wait for rising edge on home index o100 if [#5399 LT 0] M65 P3 ; stop motor - (abort, failed to home carousel) + (abort, Failed to home carousel) o100 endif #3990 = 1 @@ -36,6 +36,7 @@ o120 endwhile M61 Q#3991 G43 H#3991 #5210 = 0 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic/subroutines/m21.ngc b/configs/probe_basic/subroutines/m21.ngc index 17152078..72481562 100644 --- a/configs/probe_basic/subroutines/m21.ngc +++ b/configs/probe_basic/subroutines/m21.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3991 is used to track the current tool loaded it in the spindle (persistently) ; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) ; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o) # = -3.1900 o101 if [EXISTS[#<_ini[atc]z_tool_change_height>]] @@ -29,7 +29,7 @@ M64 P0 ; Move Carousel out M66 P1 L3 Q5 ; check for carousel out sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif M24 ; activate drawbar, release the tool @@ -39,6 +39,7 @@ G0 G53 Z# ; move z to clear height #3991 = 0; save fact there is now no tool in the spindle +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic/subroutines/m22.ngc b/configs/probe_basic/subroutines/m22.ngc index 3150f732..2de79912 100644 --- a/configs/probe_basic/subroutines/m22.ngc +++ b/configs/probe_basic/subroutines/m22.ngc @@ -4,7 +4,7 @@ o sub ; after loading any tool in the current pocket to the spindle ; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) ; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o) # = -3.1900 o101 if [EXISTS[#<_ini[atc]z_tool_change_height>]] @@ -24,18 +24,19 @@ M65 P2 ; release the drawbar to clamp the tool M5 M66 P5 L3 Q1 ; check the tool clamped sensor o100 if [#5399 LT 0] - (abort, failed to reclamp tool) + (abort, Failed to reclamp tool) o100 endif M65 P0 ; Move Carousel home M66 P0 L3 Q4 ; check carousel in position sensor o110 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o110 endif ;M65 P1 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic/subroutines/m24.ngc b/configs/probe_basic/subroutines/m24.ngc index 263b5278..37454968 100644 --- a/configs/probe_basic/subroutines/m24.ngc +++ b/configs/probe_basic/subroutines/m24.ngc @@ -2,12 +2,13 @@ o sub (PRINT, o) M64 P2 ; unclamp the tool -M66 P2 L3 Q3 ; check the unclamped tool sensor +M66 P2 L3 Q2 ; check the unclamped tool sensor o100 if [#5399 LT 0] M65 P2 ; turn off the drawbar (abort, failed to release tool) ; abort if the sensor does not activate in 3 seconds o100 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic/subroutines/m25.ngc b/configs/probe_basic/subroutines/m25.ngc index dc55c0f5..a1a7ac98 100644 --- a/configs/probe_basic/subroutines/m25.ngc +++ b/configs/probe_basic/subroutines/m25.ngc @@ -6,9 +6,10 @@ M64 P0 ; Move Carousel out M66 P1 L3 Q5 ; check for carousel out sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic/subroutines/retractatc.ngc b/configs/probe_basic/subroutines/retractatc.ngc index 717324b9..4219ca38 100644 --- a/configs/probe_basic/subroutines/retractatc.ngc +++ b/configs/probe_basic/subroutines/retractatc.ngc @@ -6,7 +6,7 @@ M64 P1 ; Move Carousel IN M66 P0 L3 Q4 ; check carousel in position sensor o100 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o100 endif M65 P1 diff --git a/configs/probe_basic/subroutines/toolchange.ngc b/configs/probe_basic/subroutines/toolchange.ngc index de63b409..b8cfb5ef 100644 --- a/configs/probe_basic/subroutines/toolchange.ngc +++ b/configs/probe_basic/subroutines/toolchange.ngc @@ -6,8 +6,10 @@ o sub ; Parameters #4001 to #4024 are used to track which tool is in which pocket (persistently) ; Parameter #4000 is not populated just used in the maths to calculate the above numbers ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> +; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) +; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o selected_tool: #, tool_in_spindle: #, selected_pocket: #, current_pocket: #, task: #<_task>) o100 if [#<_task> EQ 0] (DEBUG, Task is null) @@ -20,28 +22,46 @@ o101 if [EXISTS[#<_ini[atc]pockets>]] # = #<_ini[atc]pockets> o101 endif +# = -3.1900 +o102 if [EXISTS[#<_ini[atc]z_tool_change_height>]] + # = #<_ini[atc]z_tool_change_height> +o102 endif +# = [#<_ini[AXIS_Z]MAX_LIMIT>-0.1] +o103 if [EXISTS[#<_ini[atc]z_tool_clearance_height>]] + # = #<_ini[atc]z_tool_clearance_height> +o103 endif + ; assign the programmable coolant parameters # = #1 (=0) # = #2 (=0) # = #3 (=0) # = #4 (=0) -; assign the variables passed by M6 to some parameters +; assign the variables passed by M6 change_prolog to some parameters #100 = # #110 = # #120 = # +#121 = # +; NOTE: +; The legacy names *selected_pocket* and *current_pocket* actually reference +; a sequential tooldata index for tool items loaded from a tool +; table ([EMCIO]TOOL_TABLE) or via a tooldata database ([EMCIO]DB_PROGRAM) -o110 if [#100 EQ #110] ; checks if tool in the spindle is same as requested +o110 if [# EQ #] ; checks if tool in the spindle is same as requested o endsub [1] M2 o110 endif +o111 if [#3991 NE #] + (PRINT, o tool_in_spindle does not match 3991) +o111 endif + # = 0 ; assigns 0 to the next pocket for a later check if the tool is found in the carousel # = 0 #130 = # ; assign test parameter the number of pockets in the carousel o120 do - o121 if [#[4000 + #130] EQ #100] ; checks all pockets to see if it contains tool number requested as the new tool + o121 if [#[4000 + #130] EQ #] ; checks all pockets to see if it contains tool number requested as the new tool # = #130 ; if tool is found in pocket, assigns the next pocket o121 endif o122 if [#[4000 + #130] EQ 0] ; checks if the pocket is empty, last pocket checked will be the lowest empty pocket number, for putting tool in spindle away. @@ -50,7 +70,7 @@ o120 do #130 = [#130 - 1] o120 while [#130 GT 0] o130 if [# EQ 0] ; if tool is not found, aborts and sends a message - (abort, tool not in carousel) + (abort, Tool T%d# not found in carousel) o130 endif ; now we know which pocket the next tool is sitting in @@ -59,7 +79,7 @@ o130 endif o140 if [# GT 0] ; checks if there is a valid tool in the spindle o141 if [# EQ 0] ; If there is a tool in the spindle, checks if there is an open pocket - (abort, carousel is full, cant put away tool in into carousel) + (abort, Carousel is full, cant put away tool T# in into carousel) o141 endif M10 P[#] ; move carousel to an open pocket M21 ; puts the tool in spindle away into the open pocket @@ -67,10 +87,12 @@ o140 if [# GT 0] ; checks if there is a valid tool in the spind #140 = # #[4000 + #140] = # ; save tool number in pocket #3991 = 0 ; empty tool in the spindle + M61 Q0 + G49 o140 endif G90 -G0 G53 Z0 +G0 G53 Z# ; move z to clear height o150 if [# GT 0] ; selected tool is not tool0 M10 P# ; set the carousel to move to the right pocket for the selected tool @@ -79,7 +101,7 @@ o150 if [# GT 0] ; selected tool is not tool0 M66 P1 L3 Q5 ; check carousel out position sensor o151 if [#5399 LT 0] M65 P0 ; turn off the solenoid to send atc to tool change - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o151 endif M65 P0 @@ -95,7 +117,7 @@ o150 else M66 P0 L3 Q4 ; check carousel in position sensor o152 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o152 endif M65 P1 o150 endif @@ -112,6 +134,7 @@ o170 if [# EQ 1] o call [#][#][#][#] o170 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic/subroutines/unclamptool.ngc b/configs/probe_basic/subroutines/unclamptool.ngc index 1bf17ec5..ac9c3798 100644 --- a/configs/probe_basic/subroutines/unclamptool.ngc +++ b/configs/probe_basic/subroutines/unclamptool.ngc @@ -4,7 +4,7 @@ M64 P2 ; unclamp the tool M66 P2 L3 Q2 ; check the unclamped tool sensor o100 if [#5399 LT 0] - (abort, failed to release tool) ; abort if the sensor does not activate in 2 seconds + (abort, Failed to release tool) ; abort if the sensor does not activate in 2 seconds o100 endif o endsub [1] diff --git a/configs/probe_basic_lathe/subroutines/clamptool.ngc b/configs/probe_basic_lathe/subroutines/clamptool.ngc index a167d778..8b1a7b1b 100644 --- a/configs/probe_basic_lathe/subroutines/clamptool.ngc +++ b/configs/probe_basic_lathe/subroutines/clamptool.ngc @@ -4,7 +4,7 @@ M65 P2 ; clamp the tool M66 P5 L3 Q2 ; check the clamped tool sensor o100 if [#5399 LT 0] - (abort, failed to release tool) ; abort if the sensor does not activate in 2 seconds + (abort, Failed to release tool) ; abort if the sensor does not activate in 2 seconds o100 endif o endsub [1] diff --git a/configs/probe_basic_lathe/subroutines/extendatc.ngc b/configs/probe_basic_lathe/subroutines/extendatc.ngc index b16d6413..95828367 100644 --- a/configs/probe_basic_lathe/subroutines/extendatc.ngc +++ b/configs/probe_basic_lathe/subroutines/extendatc.ngc @@ -20,7 +20,7 @@ M64 P0 ; Move Carousel OUT M66 P1 L3 Q5 ; check for carousel out position sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif o endsub [1] diff --git a/configs/probe_basic_lathe/subroutines/m10.ngc b/configs/probe_basic_lathe/subroutines/m10.ngc index c02e0788..2562672e 100644 --- a/configs/probe_basic_lathe/subroutines/m10.ngc +++ b/configs/probe_basic_lathe/subroutines/m10.ngc @@ -4,7 +4,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] M13 @@ -17,7 +17,7 @@ o101 if [EXISTS[#<_ini[atc]pockets>]] o101 endif # = [#3990 - #

] -(PRINT, o P#

, steps=#) +(PRINT, o P#

, steps=#) o110 if [# GT [# / 2]] #=[# - #] o110 endif @@ -31,6 +31,7 @@ o130 elseif [# LT 0] M11 P[#] o130 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic_lathe/subroutines/m11.ngc b/configs/probe_basic_lathe/subroutines/m11.ngc index 096f578b..3db74563 100644 --- a/configs/probe_basic_lathe/subroutines/m11.ngc +++ b/configs/probe_basic_lathe/subroutines/m11.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] (PRINT, atc not homed, homing) @@ -34,7 +34,7 @@ o120 do M66 P4 L1 Q3 ; wait for rising edge on rotation index o130 if [#5399 LT 0] M65 P4 ; Stop atc motor - (abort, failed to get rotation index) + (abort, Failed to get rotation index) o130 endif #3990 = [[[#3990+2] MOD #]-1] ; Pocket is no.1-# # = [#-1] @@ -44,6 +44,7 @@ M65 P4 ; Stop motor #<_my_current_pocket> = #3990 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic_lathe/subroutines/m12.ngc b/configs/probe_basic_lathe/subroutines/m12.ngc index c1d4c3ca..34f2d6f3 100644 --- a/configs/probe_basic_lathe/subroutines/m12.ngc +++ b/configs/probe_basic_lathe/subroutines/m12.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o P#

) +(PRINT, o P#

) o100 if [#3989 NE 1] (PRINT, atc not homed, homing) @@ -34,7 +34,7 @@ o120 do M66 P4 L1 Q3 ; wait for rising edge on rotation index o130 if [#5399 LT 0] M65 P3 ; Stop atc motor - (abort, failed to get rotation index) + (abort, Failed to get rotation index) o130 endif #3990 = [[[#3990-2] MOD #]+1] ; Pocket is no.1-# # = [#-1] @@ -44,6 +44,7 @@ M65 P3 ; Stop motor #<_my_current_pocket> = #3990 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic_lathe/subroutines/m13.ngc b/configs/probe_basic_lathe/subroutines/m13.ngc index 06da95e4..ede03334 100644 --- a/configs/probe_basic_lathe/subroutines/m13.ngc +++ b/configs/probe_basic_lathe/subroutines/m13.ngc @@ -4,7 +4,7 @@ o sub ; Parameter #3989 is used to track if the carousel is homed (M13) (volatile) ; Parameter #3990 is used to track the current tool pocket (persistently) ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> -(PRINT, o) +(PRINT, o) (DEBUG, EVAL[vcp.getWidget{"dynatc"}.atc_message{"REFERENCING"}]) @@ -12,7 +12,7 @@ M64 P3 ; Move Motor FWD M66 P3 L1 Q20 ; wait for rising edge on home index o100 if [#5399 LT 0] M65 P3 ; stop motor - (abort, failed to home carousel) + (abort, Failed to home carousel) o100 endif #3990 = 1 @@ -36,6 +36,7 @@ o120 endwhile M61 Q#3991 G43 H#3991 #5210 = 0 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic_lathe/subroutines/m21.ngc b/configs/probe_basic_lathe/subroutines/m21.ngc index 9bffddd1..2ec9daea 100644 --- a/configs/probe_basic_lathe/subroutines/m21.ngc +++ b/configs/probe_basic_lathe/subroutines/m21.ngc @@ -5,7 +5,7 @@ o sub ; Parameter #3991 is used to track the current tool loaded it in the spindle (persistently) ; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) ; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o) # = -3.9000 o101 if [EXISTS[#<_ini[atc]z_tool_change_height>]] @@ -29,7 +29,7 @@ M64 P0 ; Move Carousel out M66 P1 L3 Q5 ; check for carousel out sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif M24 ; activate drawbar, release the tool @@ -39,6 +39,7 @@ G0 G53 Z# ; move z to clear height #3991 = 0; save fact there is now no tool in the spindle +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic_lathe/subroutines/m22.ngc b/configs/probe_basic_lathe/subroutines/m22.ngc index 825713fa..2e87c9a5 100644 --- a/configs/probe_basic_lathe/subroutines/m22.ngc +++ b/configs/probe_basic_lathe/subroutines/m22.ngc @@ -4,7 +4,7 @@ o sub ; after loading any tool in the current pocket to the spindle ; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) ; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o) # = -3.9000 o101 if [EXISTS[#<_ini[atc]z_tool_change_height>]] @@ -24,18 +24,19 @@ M65 P2 ; release the drawbar to clamp the tool M5 M66 P5 L3 Q1 ; check the tool clamped sensor o100 if [#5399 LT 0] - (abort, failed to reclamp tool) + (abort, Failed to reclamp tool) o100 endif M65 P0 ; Move Carousel home M66 P0 L3 Q4 ; check carousel in position sensor o110 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o110 endif ;M65 P1 +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic_lathe/subroutines/m24.ngc b/configs/probe_basic_lathe/subroutines/m24.ngc index 263b5278..37454968 100644 --- a/configs/probe_basic_lathe/subroutines/m24.ngc +++ b/configs/probe_basic_lathe/subroutines/m24.ngc @@ -2,12 +2,13 @@ o sub (PRINT, o) M64 P2 ; unclamp the tool -M66 P2 L3 Q3 ; check the unclamped tool sensor +M66 P2 L3 Q2 ; check the unclamped tool sensor o100 if [#5399 LT 0] M65 P2 ; turn off the drawbar (abort, failed to release tool) ; abort if the sensor does not activate in 3 seconds o100 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic_lathe/subroutines/m25.ngc b/configs/probe_basic_lathe/subroutines/m25.ngc index dc55c0f5..a1a7ac98 100644 --- a/configs/probe_basic_lathe/subroutines/m25.ngc +++ b/configs/probe_basic_lathe/subroutines/m25.ngc @@ -6,9 +6,10 @@ M64 P0 ; Move Carousel out M66 P1 L3 Q5 ; check for carousel out sensor o100 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid - (abort, atc not in position) + (abort, ATC not in position) o100 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic_lathe/subroutines/retractatc.ngc b/configs/probe_basic_lathe/subroutines/retractatc.ngc index 43c31da6..f9d400fe 100644 --- a/configs/probe_basic_lathe/subroutines/retractatc.ngc +++ b/configs/probe_basic_lathe/subroutines/retractatc.ngc @@ -6,7 +6,7 @@ M64 P1 ; Move Carousel IN M66 P0 L3 Q5 ; check carousel in position sensor o100 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o100 endif M65 P1 diff --git a/configs/probe_basic_lathe/subroutines/toolchange.ngc b/configs/probe_basic_lathe/subroutines/toolchange.ngc index de63b409..21d39094 100644 --- a/configs/probe_basic_lathe/subroutines/toolchange.ngc +++ b/configs/probe_basic_lathe/subroutines/toolchange.ngc @@ -6,8 +6,10 @@ o sub ; Parameters #4001 to #4024 are used to track which tool is in which pocket (persistently) ; Parameter #4000 is not populated just used in the maths to calculate the above numbers ; #: The number of pockets in the ATC is automaticity pulled from the INI via #<_ini[atc]pockets> +; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) +; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) -(PRINT, o) +(PRINT, o selected_tool: #, tool_in_spindle: #, selected_pocket: #, current_pocket: #, task: #<_task>) o100 if [#<_task> EQ 0] (DEBUG, Task is null) @@ -20,28 +22,46 @@ o101 if [EXISTS[#<_ini[atc]pockets>]] # = #<_ini[atc]pockets> o101 endif +# = -3.9000 +o102 if [EXISTS[#<_ini[atc]z_tool_change_height>]] + # = #<_ini[atc]z_tool_change_height> +o102 endif +# = [#<_ini[AXIS_Z]MAX_LIMIT>-0.1] +o103 if [EXISTS[#<_ini[atc]z_tool_clearance_height>]] + # = #<_ini[atc]z_tool_clearance_height> +o103 endif + ; assign the programmable coolant parameters # = #1 (=0) # = #2 (=0) # = #3 (=0) # = #4 (=0) -; assign the variables passed by M6 to some parameters +; assign the variables passed by M6 change_prolog to some parameters #100 = # #110 = # #120 = # +#121 = # +; NOTE: +; The legacy names *selected_pocket* and *current_pocket* actually reference +; a sequential tooldata index for tool items loaded from a tool +; table ([EMCIO]TOOL_TABLE) or via a tooldata database ([EMCIO]DB_PROGRAM) -o110 if [#100 EQ #110] ; checks if tool in the spindle is same as requested +o110 if [# EQ #] ; checks if tool in the spindle is same as requested o endsub [1] M2 o110 endif +o111 if [#3991 NE #] + (PRINT, o tool_in_spindle does not match 3991) +o111 endif + # = 0 ; assigns 0 to the next pocket for a later check if the tool is found in the carousel # = 0 #130 = # ; assign test parameter the number of pockets in the carousel o120 do - o121 if [#[4000 + #130] EQ #100] ; checks all pockets to see if it contains tool number requested as the new tool + o121 if [#[4000 + #130] EQ #] ; checks all pockets to see if it contains tool number requested as the new tool # = #130 ; if tool is found in pocket, assigns the next pocket o121 endif o122 if [#[4000 + #130] EQ 0] ; checks if the pocket is empty, last pocket checked will be the lowest empty pocket number, for putting tool in spindle away. @@ -50,7 +70,7 @@ o120 do #130 = [#130 - 1] o120 while [#130 GT 0] o130 if [# EQ 0] ; if tool is not found, aborts and sends a message - (abort, tool not in carousel) + (abort, Tool T%d# not found in carousel) o130 endif ; now we know which pocket the next tool is sitting in @@ -59,7 +79,7 @@ o130 endif o140 if [# GT 0] ; checks if there is a valid tool in the spindle o141 if [# EQ 0] ; If there is a tool in the spindle, checks if there is an open pocket - (abort, carousel is full, cant put away tool in into carousel) + (abort, Carousel is full, cant put away tool T# in into carousel) o141 endif M10 P[#] ; move carousel to an open pocket M21 ; puts the tool in spindle away into the open pocket @@ -67,10 +87,12 @@ o140 if [# GT 0] ; checks if there is a valid tool in the spind #140 = # #[4000 + #140] = # ; save tool number in pocket #3991 = 0 ; empty tool in the spindle + M61 Q0 + G49 o140 endif G90 -G0 G53 Z0 +G0 G53 Z# ; move z to clear height o150 if [# GT 0] ; selected tool is not tool0 M10 P# ; set the carousel to move to the right pocket for the selected tool @@ -79,7 +101,7 @@ o150 if [# GT 0] ; selected tool is not tool0 M66 P1 L3 Q5 ; check carousel out position sensor o151 if [#5399 LT 0] M65 P0 ; turn off the solenoid to send atc to tool change - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o151 endif M65 P0 @@ -95,7 +117,7 @@ o150 else M66 P0 L3 Q4 ; check carousel in position sensor o152 if [#5399 LT 0] M65 P1 ; turn off the solenoid to send atc home - (abort, failed to send carousel home) ; abort if the sensor does not activate in 5 seconds + (abort, Failed to send carousel home) ; abort if the sensor does not activate in 5 seconds o152 endif M65 P1 o150 endif @@ -112,6 +134,7 @@ o170 if [# EQ 1] o call [#][#][#][#] o170 endif +(PRINT, o endsub) o endsub [1] M2 diff --git a/configs/probe_basic_lathe/subroutines/unclamptool.ngc b/configs/probe_basic_lathe/subroutines/unclamptool.ngc index 1bf17ec5..ac9c3798 100644 --- a/configs/probe_basic_lathe/subroutines/unclamptool.ngc +++ b/configs/probe_basic_lathe/subroutines/unclamptool.ngc @@ -4,7 +4,7 @@ M64 P2 ; unclamp the tool M66 P2 L3 Q2 ; check the unclamped tool sensor o100 if [#5399 LT 0] - (abort, failed to release tool) ; abort if the sensor does not activate in 2 seconds + (abort, Failed to release tool) ; abort if the sensor does not activate in 2 seconds o100 endif o endsub [1]