How does Probe Basic save the current tool in variable #5400?

More
28 May 2022 22:48 #244080 by tripwire
I'm creating my own qtpyvcp gui and am using probe basic as my model and trying to understand how it works.

I see that the probing gcode subroutines compare the #<probe_tool_number>, which is set from a widget in the gui, to what I think is a gcode user variable, $5400. As in the following:
 (Probe Tool Safety Check)
  o<110> if [#5400 NE #<probe_tool_number>]
  (MSG, Specified probe tool #<probe_tool_number> not in spindle, aborting)
   o<probe_x_plus_wco> return
  o<110> endif

Placing some debug messages in the probing subroutines, I see that my #<probe_tool_number> is being set and passed to the subroutine correctly but I've googled and grepped my way through all of probe basic's code and subroutines and cannot find where or how the variable #5400 is set. So unless I set my tool # to 0, this comparison never succeeds and probing routine aborts. (I've set the variable, #5400 in linuxcnc.var but it always gets set back to zero.)

I'd sure welcome some enlightenment on this...
Thanks!

Yours truly, tripwire...
 

Please Log in or Create an account to join the conversation.

More
29 May 2022 14:40 #244128 by KCJ
Parameter #5400 is a standard LinuxCNC parameter that reflects the current tool in spindle number. It is the same as named parameter #<_current_tool>.

See the Numbered Parameters section of the G-Code Overview: www.linuxcnc.org/docs/html/gcode/overvie...:numbered-parameters

These parameters are initialized to zero when LinuxCNC starts up, even if there is a value entered in the var file. Because of this most GUIs handle tool-in-spindle persistence on their own and will reload the last tool in spindle using M61.

Try setting a tool number with M61 or doing a tool change with M6 and see if the #5400 value changes, it should!

Cheers,
Kurt
The following user(s) said Thank You: ikkuh

Please Log in or Create an account to join the conversation.

More
29 May 2022 16:22 #244135 by tripwire
Perfect explanation, thanks!

Now I see where probe basic sets those gcode variables via M61.

Please Log in or Create an account to join the conversation.

Moderators: KCJLcvette
Time to create page: 0.146 seconds
Powered by Kunena Forum