M410 does unexpected things

What is the problem?
M410 does a reset of the printer, in an emergency situation.
Octoprint sees this as a canceled print and It executes the cancel gcode script.
In this cancel gcode script could be all kinds of scary things that you do not want to be executed in a emergency situation.

Please do not think of the M410 as a cancelled print.

According to this: http://marlinfw.org/docs/gcode/M410.html , M410 does not reset the printer, it just disables the stepper motors. As you see in the description, the steppers are expected to be out of position after this command. So OctoPrint assumes the print is wasted.

In this cancel gcode script could be all kinds of scary things that you do not want to be executed in a emergency situation.

In the end, the user himself is responsible for what's in the OctoPrint cancel gcode script box.

Also, when a printer does a complete reset, all positions are gone anyway and the print is wasted too.

1 Like

Well, it sends a start to octoprint, followed by all the info it only shows on startup, So we assume it is a full reset.
Of course the user is responsible for everything that is in the cancel gcode script. But Octoprint is responsible for when this script is executed.
Seeing that M112 and M410 are emergency commands that (according to regulations) have to render the machine in a safe state (and as you said, prints will be wasted anyway). No further actions may be done after these commands.

As you said, these commands are emergency codes (btw: M108 is another one) and in case of emergency, OctoPrint performs a cancel.
I do not see the sense in using an emergency command a regular GCODE file for printing. In neither my print files nor my OctoPrint scripts, these commands do appear.

If you want to attempt something - that I don't know - , there other GCODE commands to achieve that.

What we are trying to do, is to hook up a physical emergency switch to octoprint through the enclosure plugin. When the switch is triggered octoprint(enclosure plugin) sends the M410 code ( not M112 as that is not handled correctly by marlin) to the printer. The printer "resets" to a safe state. But after that octoprint also sends the cancel gcode script, which puts it back to an unsafe state.

I'd probably modify the cancel gcode script (see http://docs.octoprint.org/en/master/features/gcode_scripts.html).

In particular under Context: plugins : An object containing variables provided by plugins (e.g plugins.myplugin.myvariable )

One could create a variable that indicated an M410 was issued and then test that variable in the cancel script and skip all the "unsafe" stuff.

1 Like