Possible unit bug in tool change wizard

This topic is closed in gSender->Questions so I thought it might be worth posting here in case it wasn’t noticed by the gSender devs.

This thread is also relevant.

EDIT: I think this boils down to if the ā€˜Standard Re-zero’ tool change strategy is supposed to work with inch mode G-code and $13=0. The macro problem, while not gSender’s problem stemmed from setting $13=1 to make the tool change work.

@_Michael I may be misunderstanding the $13 problem. It seems to be an issue with a 3rd party tool change wizard that the OP is using with gSender. Am I correct? If so, I don’t see how is issue can be categorized as a gSender bug. Feel free to explain why I am wrong. :grinning_face:

Am I mistaken? I thought it was the tool change wizard in gSender. I may very well be wrong because I don’t do tool changes in a file.

My understanding is that needing to set $13 in a macro is because of the tool change wizard running as if mm was used when it had inserted a G20 command to use inches. I assumed, and you know how that goes, that knowing a G20 was used was from examining the console output when @davebmck was diagnosing his problem.

I’m basing this mostly on this part of post #3 in the second link.

but I ran into a problem when using the tool change wizard in Gsender. If I’m running an inch based gcode file, when the tool change wizard returns the spindle to the position it was located at the M6 command, the command line uses the metric units, but puts a G20 in the line which executes the move as inch units. I think this is a bug in the wizard, but I can get it to work fine as long as I have $13=1.

So I think in the first thread he discovered a workaround by setting $13=1, but that led to a problem in the probe macro not working because he needed $13=0 there, that’s the second thread I linked. I think he wouldn’t need $13=1 at all if the tool change wizard had worked correctly.

I’ll see if I can explain. The root problem is not with the macro. It expects $13=0 which is the default. The problem (bug?) is with the tool change wizard that I outlined in the referenced thread. If I’m running an inch based gcode file and $13 is set to 0, the wizard sends the spindle to the wrong position because of the G20 in the command line. The work around is to set $13=1 and the wizard will work for inch files.

Now the next time I run the probe macro, it will fail unless I remember to reset $13=0. My post about changing $13 in a macro is another work around so I can just leave $13 set at one value.

I run most of my gcode files in inches, so for multi tool files with a tool change, I need to have $13 set to 1 for the tool change wizard to work correctly. However, when I run my XYZ probe macro, $13 must be set to 0 for that to run correctly. I am wondering if I can set $13=0 at the start of the macro in the code and then reset it to $13=1 at the end of the macro. if I have to remember to change $13 manually every time I do an XYZ probe and tool change, I’m sure to miss that at some point and my machine will go somewhere its not supposed to.

I don’t have an answer to your question. I do have a suggestion that may work for you instead.

From what I’ve seen hanging around here for awhile, what usually works best is to leave $13 at 0. It’s possible, at least in the design programs that I’m familiar with, to design in inches but use a mm post processor. gSender is also capable of displaying inches, for coordinates and visualization, when it’s running a mm G-code file.

Inches are a second class citizen as far as grbl is concerned. Millimeters are more accurate and avoid several problems that crop up when inches are used. That said using the setup described above you don’t have to look at millimeters anywhere unless you are looking at the G-code itself.

The tool change settings might need to be changed if they are in inches. I’ve never used tool changes so I don’t know.

You do you but $13=1 never seems to work out from what I’ve seen.

EDIT: Don’t quote me on this because I work in mm from start to finish but I don’t think $13=1 is even needed for inch G-code files. Isn’t that what G20(set units to inches) and G21(set units to millimeters) are for?

Wanted to make sure I wasn’t hallucinating so I searched a bit. gSender may handle $13=1 better than it used to but posts like this have stuck with me.

Thanks for the response Michael. You are correct that standard gcode runs fine in either inch or metric regardless of the value of $13. I’ve always left $13 at the default 0, but I ran into a problem when using the tool change wizard in Gsender. If I’m running an inch based gcode file, when the tool change wizard returns the spindle to the position it was located at the M6 command, the command line uses the metric units, but puts a G20 in the line which executes the move as inch units. I think this is a bug in the wizard, but I can get it to work fine as long as I have $13=1. However, when I run my XYZ probe macro, $13 must be set to zero for that one to work correctly. That’s why I’m asking if I can just set $13 in my macro.

@davebmck I think that, to get a definitive answer, you will need to post your probe macro.

It’s the CNCjs macro that KGN pointed me to in my previous thread. nomad3-cncjs-macros/bitzero-v2-probe-xyz.macro.nc at master Ā· vsergeev/nomad3-cncjs-macros Ā· GitHub

Thanks for the additional context. I hope my post didn’t come across in a negative way.

Apparently, in the post apocalyptic wasteland that is my mind, the $13 trip wire really rattles the cans in my alarm system! I wanted to make sure it was really necessary to go there.

Unfortunately I haven’t been able to find any info on how to change a firmware setting in a macro.

EDIT:

If you haven’t done so already consider creating a post in the gSender Bug category or GitHub to get this fixed if it is indeed a bug.

I think I may have something here.

I made two macros.

Set Firmware 13=1

$13=1 %wait
$13 %wait

Set Firmware 13=0

$13=0 %wait
$13 %wait

Here is the console output from running:

  • the first macro
  • $13 in the console (extra verification)
  • the second macro
  • $13 in the console (extra verification)
$13=1 %wait
ok
$13 %wait
$13=1 (Report in inches, boolean)
ok
$13=1 (Report in inches, boolean)
ok
$13=0 %wait
ok
$13 %wait
$13=0 (Report in inches, boolean)
ok
$13=0 (Report in inches, boolean)
ok

This was done using the grblHAL simulator not my actual SLB but I could test that if needed. Maybe you tried without the %wait?

Actually, I never tried without the %wait because I saw a line in the Variables drop down, in the create/edit macros window, that was ā€˜$# %wait’ to get the value of a setting so I tested based on that.

That looks like it works. I’m running standard grbl, but I think it should work the same. Unfortunately, I’m traveling again this weekend, but I’ll test this when I get home on Monday.

I posted about the problem with the wizard in the general questions sections. Do you think it would get additional attention in the bug section?

Let us know how you make out when you get back home.

I took the liberty of posting in the bug category with links to this thread and the one you mentioned just in case.

Thanks for posting it there for me. I was going to do that later, but you probably have more cred than me on this forum.

I did it because you mentioned you were traveling and I thought it might save you some phone typing. It also seemed just as easy as answering if I thought it would get more attention. Since then you’ve had to type it all anyway to clarify that thread. :person_shrugging:

Safe travels!

EDIT: Some people are wizards at phone typing but I’m at least 10 times faster on my PC keyboard than mobile devices!

@_Michael @davebmck I’ve moved all the posts to the ā€œpossible bug in tool change wizardā€ topic. This way, all the conversation is in one place, and there will be no more duplicate posts.

I would suggest to @davebmck that he open a support ticket with Sienci. Keep in mind that this is a user forum and your issue may not be addressed here as promptly as you would like.

@_Michael Just to let you know, I tried changing the value of $13 in my probe macro and it does work. I can set it to 0 at the start of the macro and back to 1 at the end. The only difference I ran into was that adding the %wait to the line gives me an error:3 (invalid statement) and no change is made. Without the %wait it works fine. Maybe it has to do with me running standard grbl vs. grblhal.

We’re looking to get this fixed for the next release for standard and flexible where it seems to be the issue - fixed is working as expected.

Thanks for the response. I’ll be sure to check out the next release.