CNCjs & M0 Wait for User

Just wanted to tap the community to see if anyone has experienced this issue and maybe found a solution. I’m keen on using CNCjs in my workflow since it is similar to my octoprint workflow.

I use a Touch plate to zero my Z and the Gcode script contains M0 commands to pause and wait for attach z probe, etc. When I run the Gcode through Repetier host, all I need to do is click on the LCD and the process moves forward. However through CNCjs, I have to both click the lcd and click resume in CNCjs through the web UI. I also cannot just run headless because of this issue. Anyone have any ideas? I can’t seem to find anything in the CNCjs forums.

I haven’t tried it. What happens if you disable the lcd in the marlin firmware?

I never thought to try that. Actually I wanted to run headless all along, but CNCjs was waiting for input from the LCD to move forward. I had to end up going out and buying an LCD. I guess it might have been easier to disable it in the firmware. I guess I’ll have to experiment to find out. Anyway, I do like having the LCD since it’s easier to just click the wheel rather than do something at the computer.

I’ve actually had the same issue (I run completely headless via v1pi and don’t have an lcd). When an M0 gets issued (for a tool change I believe, it’s been a while), it’ll pause and there’s no way to get it to actually resume. I’ll end up having to stop the gcode file and take the M0 out and start over. Not a huge deal, as I just end up creating separate gcode files for each tool rather than doing tool changes, but it’s interesting to hear that someone’s had a similar issue. I haven’t seen anything in the cnc.js github issues referring to this, but I also haven’t looked in a while.

I also hadn’t tried disabling lcd in the firmware, but please keep us posted if you try and it works!

If the controller is just waiting for a button press, can you just add a momentary switch to the appropriate pins of the LCD header to use as a “continue” button?

Ah hah! Now I understand what is going on using CNCjs and not being able to fully pause or stop and then resume with tool changes. I just haven’t done the troubleshooting on this since I have not had any jobs that really required it, but when I do a test piece, I get stuck and can’t for the life of me get going again until I reset everything. I hadn’t thought of the LCD un-pause.

I just haven’t had the time recently to develop a proven workflow and debug all these issues since I was still building out the system. The last thing I have to do is wire the smart power controller to the board so I can turn the spindle and dust on and off with the code.

Thanks for posting this question.

1 Like

Is the pause from an M25 in the file? Couldn’t you just send an M24 to allow the resume?

Those are just for SD card pausing, right?

I should have just looked at the documentation:

http://marlinfw.org/docs/gcode/M000-M001.html

It looks like you should at least enable the emergency parser, and you might also need to disable the LCD for the M0 to pause and the M108 from CNC.js to continue.

On the other hand, what CNC.js might be doing is intercepting the M0 and pausing on it’s own. If that’s the case, then you can just disable the LCD and CNC.js will just send more gcode after it’s no longer paused.

I finally got around to disabling LCD in the firmware and it did allow CNCjs to work with M0 and M1 commands as expected. Now during touch probe and tool changes, I simply click the resume button within CNCjs to move the job forward.

2 Likes

That is awesome news! Thanks for sharing.

That is good to know. I should make a note and include that somewhere.

I wondered this the other day

running code through cncjs, I had a tool change and it just wouldn’t resume when clicking the start button

would you let me know where in the code is it to disable the lcd

Change:

#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER

to

// #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
1 Like

I was running into this issue as well. I was just doing a double press.

The cnc.js would show notice of the pause.
LCD would show the message.
I would do what ever my pause was for (I have 5 of them in my tool change).
I would press the LCD button.
Then press the play/resume in cnc.js

Basically would have to do a double press for each.

I would like to keep the LCD on the machine as that button is closer to where I am doing the tool change and is faster to press. Has anyone checked on disabling the pause in cnc.js instead of disabling the LCD?

Also, (I need to check this in a few days when I get home) I don’t think cnc.js shows the MO comments, which I have showing me which tool to change to or what do to (attach probe, turn on router, etc). See https://github.com/cncjs/cncjs/issues/467

1 Like

I’m also interested in having cnc.js not pause on M0… it’s handier having the tool display and unpause button closer to where I am doing my tool changes. Hitting a button on both the LCD and the laptop every time is not a great workflow.

Cnc.js has been pretty open to PRs, if you want to take a swing at it.

Cncjs does show the M0 comments in the console window however it is not formatted in any way. It would be much better if it displayed in a pop up window. Ultimately, disabling the LCD improved the workflow by eliminating the LCD click.

I have never heard of disabling pause in Cncjs. I’m not sure what that would do. You would not want cncjs to start streaming gcode in the middle of your tool change.

1 Like

If cnc.js kept streaming, it would fill the buffer in Marlin, and cnc.js would wait until it heard “ok” from Marlin.

I don’t think it makes sense to make it the default, but a configuration option would be nice.