Version 1.4.1 - Tool Change Length Calculation Error

I recently started using gSender and have been loving it, I’m now working on integrating some probes and tool sensors and ran into an issue with the Automated Tool Change workflows on the 1.4.1 release.

When running a tool change using the “Set Tool Sensor” mode, the tool length is being incorrectly calculated when changing tools. I used the following process:

  1. Have a bit inserted into the CNC collet (X-Carve Pro in my case)
  2. Zero the bit using a Z-Probe
    → G54: 0mm
    → Machine: -134.86mm
  3. Start running a G-Code file that starts with a tool change command (M6)
  4. Measure the initial tool height using a Tool Sensor, wait for spindle to retract
    → G54: 124.86mm
    → Machine: -10.00mm
  5. Do not change tool, but click to measure “new tool”, wait for spindle to retract
    → G54: 132.86mm
    → Machine: -10.00mm
  6. Go to Z0 (make sure the spindle is in a location where the tool will have clearance (in my case we have a separate fixture plate which is lower than the initial Z0).
    → G54: 0mm
    → Machine: -142.86mm

This results in the “zero” of the G54 coordinate system now being 8mm lower than the original zero.

Running this same process on v1.2.2 works correctly, I haven’t tried any other 1.4x versions yet.

The “8mm” delta seems like it could be due to the retract height after probing the sensor no longer being accounted for correctly, I haven’t looked into the source yet but wanted to share this issue to see if anyone else has experienced it.

Can you capture your console log output when you try this?

Here is a capture of the tool probing sequence using v1.4.1, this is the sequence that results in an incorrect offset:

gSender - [Grbl]
Connected to COM3 with a baud rate of 57600
feeder G53 G0 Z-16.225
ok
feeder G91 G21
ok
feeder G38.2 Z-131.775 F200
[PRB:-30.576,-1183.767,-84.344:1]
ok
feeder G0 Z4
ok
feeder G38.2 Z-10 F50
[PRB:-30.576,-1183.767,-84.363:1]
ok
feeder G0 Z4
ok
feeder G4 P0.3
ok
feeder (TLO set: 58.357)
ok
feeder G90 G21
ok
feeder G53 G0 Z-10
ok
feeder (Moving back to configured location)
ok
feeder G90 G53 G0 Z-10
ok
feeder G90 G53 G0 X-30.576 Y-1183.767
ok
feeder G53 G0 Z-16.225
ok
feeder G91 G21
ok
feeder G38.2 Z-131.775 F200
[PRB:-30.576,-1183.767,-84.350:1]
ok
feeder G0 Z4
ok
feeder G38.2 Z-15 F50
[PRB:-30.576,-1183.767,-84.363:1]
ok
feeder G0 Z4
ok
feeder (Set Z to Tool offset and wait)
ok
feeder G4 P0.3
ok
feeder G21 G10 L20 P0 Z62.357
ok
feeder (Set Z to Tool offset and wait)
ok
feeder G53 G21 G0 Z-10
ok
feeder G21 G91
ok

Here is a capture of the tool probing sequence using v1.4.1, this is the sequence that results in a correct offset:

gSender - [Grbl]
Connected to COM3 with a baud rate of 57600
feeder G53 G0 Z-16.225
ok
feeder G91 G21
ok
feeder G38.2 Z-131.775 F200
[PRB:-30.576,-1183.767,-84.338:1]
ok
feeder G0 Z4
ok
feeder G38.2 Z-10 F50
[PRB:-30.576,-1183.767,-84.338:1]
ok
feeder G0 Z4
ok
feeder G4 P0.3
ok
feeder (TLO set: 54.3884)
ok
feeder G90 G21
ok
feeder G53 G0 Z-10
ok
feeder (Moving back to configured location)
ok
feeder G90 G53 G0 Z-10
ok
feeder G90 G53 G0 X-30.576 Y-1183.767
ok
feeder G53 G0 Z-16.225
ok
feeder G91 G21
ok
feeder G38.2 Z-131.775 F200
[PRB:-30.576,-1183.767,-84.338:1]
ok
feeder G0 Z4
ok
feeder G38.2 Z-15 F50
[PRB:-30.576,-1183.767,-84.338:1]
ok
feeder G0 Z4
ok
feeder (Set Z to Tool offset and wait)
ok
feeder G4 P0.3
ok
feeder G21 G10 L20 P0 Z54.38844
ok
feeder (Set Z to Tool offset and wait)
ok
feeder G53 G21 G0 Z-10
ok
feeder G21 G91
ok

I believe that the G10 command in the line containing " G21 G10 L20 P0 " is having an incorrect offset input, and the “TLO set:” line also has the TLO shifted by 4mm (which is the current retract distance in the Probe Settings).

Thanks for the help!

Yup. There’s a problem with the code…I have a pretty good idea what it is. Give me a few to look at the source.

Edit:
@KGN looks like these variables are treated like strings and concatenated rather than added like Numbers.

I remember dealing with this at some point when writing macros, but I can’t find where. They could explicitly convert those variables to numbers or do the g10 before the retract. Either way, it’s an easy fix for @KGN and the team. I’d do a pull request, but I hate doing those and it’ll take them a minute to fix.

@lowderd basically, instead of adding 4mm because of the 4mm retract, it’s tacking a ‘4’ into the end of the “TLO set”.
I’m your case, you set an initial probe location at
Z54.3884
With a retract of 4mm, it should have set the second tool at Z54.3884 + 4 = 58.3884
But instead it was set at 54.38844 (note the ‘4’ tacked onto the end)

3 Likes

I’m having the same issue.
Z is 8mm off.
Gsender 1.4.1 on Windows 11
Shapeoko 3 XL

Is that your retract height setting?

No, My Z0 becomes approximately Z -8mm. Bit plunges into material. I always set Z zero to top of material.

I’ll rephrase. Do you have your retract height on the probe set to 8mm?

Thanks - I thought we’d fixed variables being treated as strings in an earlier version but we’ll double check. It’ll be fixed for the next version.

2 Likes

Great! Thanks so much for the quick response.

We’ve figured out what’s going on here and should have a fix for the next release (with a bit more testing to double check/cut a bit more wood).

Thank you for your exceptionally detailed response which helped narrow down what’s going on.

2 Likes