Skip to content

[BUG] P000 Emergency Command Misleadingly Described as ‘Instant Pause / Hold’ but Actually Performs Immediate Stop #27964

@kadirilkimen

Description

@kadirilkimen

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

When you call the P000 command to pause or hold motion, it does not decelerate—it stops the motors immediately. This sudden stop causes positional errors because ongoing inertia physically moves the machine beyond the last commanded position, unless the motion is very slow.

English is not my native language, so please excuse any inaccuracies. When I read “instant pause/hold,” I expect a command that safely stops motion and maintains a trustworthy position for later continuation, especially since in CNC terminology, “hold” strongly implies an instant pause that does not cause positional error.

I examined the code to see what actually happens.

The P000 command redirects to this line in e_parser.cpp:

case EP_GRBL_PAUSE: quickpause_stepper(); break;

In the quickpause_stepper function in motion.cpp, there is only one line:

planner.quick_pause();

In planner.quick_pause() (found in planner.cpp), two steps occur:

  1. Call stepper.suspend()
  2. Report the pause

In stepper.h, the suspend() method looks like this:

static bool suspend() {
  const bool awake = is_awake();
  if (awake) DISABLE_STEPPER_DRIVER_INTERRUPT();
  return awake;
}

Following the code beyond this gets complicated for me. but it looks like intentionally disables step pulses immediately, causing an abrupt stop.

I have been working on Marlin to control a custom machine with a custom host software, relying on P000 to provide a hold feature assuming it is the same with the CNC HOLD concept, then I found that it doesn't.

I am not sure if this feature coded intentionally this way or if it is an oversee. I think either the feature or the description should be fixed.

Bug Timeline

I realised the issue with 2.1.3 b3... it seems goes back to as far as the very existence of P000

Expected behavior

When it is called in realtime, it would provide a pause with deceleration while staying on the intended path. So following R000 command would continue on the same path without positional error.

Actual behavior

It stops the motors immediately, causing ongoing inertia to cause positional error.

Steps to Reproduce

Activate EMERGENCY_PARSER in the Configuration_adv.h
Make the machine move at a certain speed that would cause inertial load at sudden stop.
Call P000 command to make it pause/hold while the machine is moving.

Version of Marlin Firmware

2.1.3-beta3

Printer model

A custom cartesian machine. Not a 3D printer.

Electronics

BTT SKR 2.0

LCD/Controller

none

Other add-ons

Spindle

Bed Leveling

None

Your Slicer

Other (explain below)

Host Software

Other (explain below)

Don't forget to include

  • A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

It is a custom machine to perform a custom task. Therefore I write G-codes by hand. There is no slicer information to provide.

I use a host software coded by myself. It is pretty much an automated serial terminal. A serial terminal could do the same to replicate the issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions