CNCjs - a few questions

  1. Softlimits. Okay, so ideally, I’d never crash my machine into the axis limits. I have a PRO XL, and have set these values based on measuring actual travel limits with the end plates.
$20=1 (Soft limits enable, boolean)
$21=0 (Hard limits enable, boolean)
$130=869.000 (X-axis maximum travel, millimeters)
$131=440.000 (Y-axis maximum travel, millimeters)
$132=95.000 (Z-axis maximum travel, millimeters)

I think this is what I need to achieve the no-crashing.

With this setup, @neilferreri 's wonderful Bitsetter script no longer works.

feeder> G4 P0.5
feeder> G53 Z-40
feeder> G91
feeder> G38.2 Z-80 F350
ALARM:2 (Soft limit)
[MSG:Reset to continue]

Has anyone figured out a way around this?

First a word of warning for other users, specifically folks who use Carbide Motion: enabling soft limits at GRBL level is not great, because it interacts with CM’s internal soft limits.
That said, when using CNCjs there is nothing wrong with using soft limits if you’d like to, but in this specific case you’ll need to increase your max Z value ($132).
This BitSetter script is telling the machine to move to absolute Z=-40 (so 40mm down from the top of the Z), and then to probe down by a theoretical maximum of 80mm from that point (because in the meantime the G91 command toggled GRBL in relative position mode).
GRBL therefore concludes that the probing move could go as low as Z=-120mm, and since your $132 is set at a max of Z=-95.000, it errors out.
Of course the probing is not actually going to go as low as -120, the probe triggering will stop it before that, but GRBL can’t assume that this will be the case.
So, either reduce the -80 value in the script on the G38.2 line to something smaller than 55, and check that the probing move can still trigger the probe even with your shortest endmill, OR increase the $132 such that the starting point in the script (currently -40mm) plus the G38.2 max movement (currently -80) is lower than $132.

EDIT: and now Neil is typing, so I’ll stop there and let the master answer :slight_smile:


40+80 = 120

Change the -80 to something that makes more sense (-54).

Edit: Somehow Julien answered before me… With all those words!


Awesome thanks guys.

I need to customize a pendant for the Raspberry Pi official 7" screen. The mini one I found is a bit basic. Shopfloor might be a good starting point.

Is there a way to auto execute macros, without a popup? I’d love to copy CMs change tool workflow which needs 1 interaction (after loading new tool). From the looks of it out of the box with cncjs, there’s a few more interactions required.

Another question for the C3D folks, would it be possible to get a CNCjs thread that doesn’t auto-close? It would be nice to have a consolidated area for information.

I’m not aware of such a possibility, there would probably be some CNCjs code modification involved.

All threads auto-close after a while, but should you need to reopen any given thread to post fresh information, just PM Will or myself.


Ok thanks. A few more questions I’ll keep em coming :slight_smile:

For feedhold, is it possible to customize the action? Would like to stop the spindle at least.

Feedhold behavior is hardcoded in GRBL, but…it does stop the spindle.
You meant spindle as in the thing connected to a VFD, not the trim router right? (Because of course there is no way to stop a trim router other than manually, unless one uses a BitRunner)
What behavior do you see?

1 Like

I’m using BitRunner.

Hitting pause on CNCJS does not stop the spindle. Just stops all movement.

That’s what “Pause” is designed to do. I think you’ll have to modify the source of either CNCjs (a bit tricky, but not very risky) or grbl (much simpler, but a bit unadvised if you’re not comfortable).

One idea is that you could have a side process running alongside CNCjs that behaves similar to a custom pendant.

If you connect to the websocket, I believe you get an event on pause and should be able to stop the spindle as appropriate.

Ok I may have been confused : you were talking about feedhold,

But then mentioned hitting “Pause”:

Are you talking about the Pause icon that’s in between the “Play” and “Stop” icons ?
Or are you using the “Feedhold” button up top ?

The Pause button will just halt movement indeed, but the Feedhold button will trigger a full-blown feedhold sequence, and that’s going to retract and stop the spindle (more details than you would ever care for are available in this thread)


Love the details!

So essentially, feed hold is completely defined by the firmware, and I should see the same behaviour as Carbide Motion?

The feed hold button in the CNCJs interface wasn’t visible on my Pi display due to resizing I guess. Another reason to wire up a button soon!

I might take a step back from CNCjs. I think it’s really awesome, and I was looking forward to maybe some stored offsets/etc, as well as customizing a few other things (jogging travel speeds)

However, the amount of effort to build a custom widget/pendant to get what I want is a few days of machining time :slight_smile: The tool change in Carbide Motion is too good compared to cncjs. Perhaps a winter project will be making some code contributions.

1 Like

Yep, it’s GRBL doing all the heavy lifting when it receives the feedhold character, whoever sends it.

I chose to wire up a button since for me feedhold is for “half-emergency” cases, and I’d rather slam a button than have to grab the mouse, move a pointer over a button, and click :slight_smile:

This is precisely why I enjoy using both: CM is great for USING the machine and provides a guided workflow to do that for folks who do not want to hear about nitty gritty G-code details, while CNCjs on the does not come with any specific workflow but one can use the bits and pieces (macros, etc…) to make their own (which also has value).

I have been down the “hey what if I wrote code for a CNCjs pendant” road, and while I don’t regret it because I enjoy geeky activities, it is certainly not the best use of one’s shop time indeed :slight_smile:

1 Like

Bingo :slight_smile: I love the IDEA of having a slick touch screen pendant. One button sets my Z0 to the top of the spoilboard. Another sets X0Y0 to a corner square. etc. Current RPM is interpolated to a # on the Makita dial.

I don’t like the thought of all the javascript to get to that point :slight_smile:

That said, am I best to disable soft-limits if using CM?

For a long while the answer was “yes”, because CM has/had internal soft limits of its own.
I admit to not checking whether with the more recent versions of CM that allow one to define machine travel limits, this still makes sense, and whether soft limits are (still) disabled in the default configuration…

Soft-limits are disabled in default config, as in setting up CNCJS I saw that they were and had to enable them.

I can give it a go and worst case, the machine will stop/error out. When this happen, does CM disconnect from the grbl board?

disconnect, no, but it may not allow you to resume the current job after the soft limit error happens (I can’t remember for sure), so at the end of the day it’s not very different from a disconnect.

1 Like

Why use the existing button when you can modify the source code?

Those buttons are easy to overlook, @Julien.

1 Like