Trying to understand how M6 tool change code handled

I have completed a build of a Lowrider v2… running CNCJS v1.9.20 as my GUI, with a gShield v5 as controller running Grbl v1.1g. All is running well and calibrated. I am using Fusion 360 as my CAM software, with the stock post processor “Grbl”. It inserts an M6 command for the first op, and I’m not sure if it is CNCJS or Grbl that is intercepting that… but it drives the spindle to

X100.000 Y60.000 Z-20.000

I would like to keep this M6 command in there and understand how to modify those coordinates associated with M6. There is a macro function in CNCJS, but it is not clear how I associate that with M6 (the docs suggest that it will simply pause execuation when encountering M6 and prompt for a tool change, but that is not the behavior). Is Grbl then the issue?

Thanks in advance!

1 Like

I didn’t know about M6. It looks like cnc.js intercepts it. Here is the documentation:

Thanks Jeff,

I had seen that doc. After playing around for more than two hours, I think I determined that the issue was in Grbl. I’m updating here in the case it helps someone else on a future search.

The Fusion 360 Grbl post processor issues a “G28” command, which is intended to work with end stops and to bring the spindle to a safe height/location for a tool change. I don’t have end stops, and since Grbl never had a G28 position initialized, it was going to the coords I shared above – which were essentially non-sensical. I had to put the spindle in an intentional location and issue a “G28.1” command via CNCjs, which stored the location with Grbl, and the problem went away. I also found that there is a checkbox in Fusion 360 that disables the sending of G28 in post, as well. Either would have solved the problem.

2 Likes