M112 in command queue

Basic Information:

Printer Model: Coustom Cartesian Printer
MCU / Printerboard: Rambo Board, Arduino Uno
Host / SBC Raspberry Pi
klippy.log

klippy_Klipper.zip (2.4 MB)

I have noticed that the M112 command always has to wait for a certain number of commands before the printer is stopped. However, I would like the printer to stop immediately when the M112 is sent. I used to use Marlin, where the M112 was always executed immediately.
Is it possible to configure Klipper so that this also works?
I use Klipper with Repetier Server.

If you run M112 in Klipper’s console (via Mainsail or Fluidd), it will execute immediately. Since you use Repetier Server, this is likely Repetier’s command queue stopping the command from going through.

I have counter-tested it. I filled the command queue with 20 G28 commands via the console. (The G28 takes a little longer on my machine). While the printer was processing the G28 commands, I sent the M112 directly via the console. The printer completed the current command first and then executed the M112, jumping the rest of the G28 commands.
So it looks like Klipper prefers the M112 as soon as it has been sent, but a command needs to be finished so the M112 can be sent. Can I work around this?
When the M112 is sent durring a heating process or the bed mesh calibration it can take minutes before the printer is able to react.

A M112 will immediately cancel any heating. Quite easy to test with, e.g., M109

Is it possible for Klipper to stop immediately when the M112 is sent in the console? If an incorrect movement is executed, the printer should stop immediately and not only with the next command. Currently I have to press the main switch of the printer to stop it immediately. But I would like to avoid this.

Klipper does immediately stop on an M112, as @Sineos pointed out. See Frequently Asked Questions - Klipper documentation.

M112 bypasses Klipper’s own G-Code queue. Repetier Server may have its own G-Code queue preventing M112 from being executed immediately.