Bug Canceling (annoying)

Clicking cancel wont stop the printer until it finishes its current task.

How to reproduce:
Click Load print
Print bed starts heating up
Click cancel
Wont cancel until bed reaches temp

This results in waiting minutes for cancel.
Restarting PI is only way to cancel faster.

1 Like
2 Likes

If OctoPrint sends an M112, does Marlin ignore what's still in the queue?

I know that I've been bitten at least once when some rogue code drilled a hotend into my plastic bed and I'm begging the printer to... just... stop... already.

That depends entirely on your specific flavor of Marlin.

I just sent a print, started it, and cancelled it

Then I went to terminal command window, and typed "M112" and hit enter, and I didn't see an M112 command float dutifully up my screen as was my intention

So I typed "M112" again, only this time, I hit the "send" button, thinking that it might pay more attention that way

I still failed to notice an M112 float up my screen

Then, when it got to .5 degrees of the set temp, this happened

Recv: T:21.11 /0 B:84.50 /85 B@:255 @:0
Recv: ok 5
Send: M112
Send: N6 M11239
Send: N7 M104 T0 S0
38
Send: N8 M140 S0*109
Closing serial port due to emergency stop M112.
Changing monitoring state from "Cancelling" to "Offline (Error: Closing serial port due to emergency stop M112.)"
Connection closed, closing down monitor

It was like watching a movie where the hero is trying to defuse the bomb, then finally getting it at the last half second

I didn't try disconnecting the Raspi from the printer (which I didn't think would work, but I should have tried anyway), nor did I try unplugging the printer itself (which I knew would work, but, that wasn't part of the experiment)

Have you considered using the power switch on the printer itself? Stops mine dead in a matter of seconds.

Yes. Of course. But this was an experiment to see if I could manually send an emergency cancel via Octoprint's Terminal screen

Well, "blocking commands are blocking", as they say.

But most of the time during the print job, it's not under the fiat of an M109, for example.

If an M112 shuts down the connection then that's problematic; the GCODE Cancel script then can't do the other things it needs to do like lift the hotend, X/Y home it and anything else it might do to take care of business.

COOL !

All I had up til now was a little cheat sheet of M commands, and M108 wasn't in it

This gives me an idea... If all we want to do is cancel the heater, since the print itself has already been cancelled, how about if a command gets issued that sets the new target temp as the current temp, thereby fooling the thing into thinking that it's achieved its goal, and can now move on to its next command, which is to shut down the heater ?

Could that work ?

1 Like

That's a slice of brilliance if it works. I'd have to test it though after this part is finished.

Most 3d printer boards are based on Arduino's and will reset on serial connection. Just cycle the printer's connection (press the disconnect button, then reconnect) and that should reset your printer's controller board. I used that trick a few times.

That or in my early days, I just had a physical button that cuts power to the printer and I'd smash that when stuff went wrong, much faster and more reliable than a software solution (assuming you're right next to said button)

1 Like

Marlin supports the M108 and M112 commands.
The problem is that Octoprint will not send the commands because it is waiting for the buffer to become empty. Even when "Send emergency GCODES M108 and M410 without waiting for acknowledgement, if detected as supported by the firmware" is activated.
Can this be changed?

Make your firmware report it as supported in the capability report (which recent marlin should do)

you mean this one:
Recv: Cap:EMERGENCY_PARSER:1

Yep. If it reports it like that and emergency commands are not forced through immediately (which last I checked they were) then please open a full bug report and I'll take a look (after my vacation).

I see something is planned for 1.3.12:


I am at 1.3.11.
So we will wait.

Have a good vacation !!

Oh, I forgot about that. Good catch!