naikymen / klipper-for-cnc

Fork of the Klipper 3D-printer firmware, plus features for more general CNC.
https://klipper.discourse.group/t/klipper-for-cnc-initiatives-and-projects-list/5698
GNU General Public License v3.0
66 stars 9 forks source link

Implement "emergency brakes" in order to stop but also retain position #21

Open naikymen opened 2 months ago

naikymen commented 2 months ago

EMERGENCY_STOP is too violent for my taste.

An EMERGENCY_BRAKE would stop the machine in the way jogging would (according to my idea of that feature https://github.com/naikymen/klipper-for-cnc/issues/20).

The emergency brake would signal the MCUs to ignore all incoming commands (entering LOCKED mode), and apply a brake move at maximum acceleration. Also clear all move queues immediately everywhere. There must be a new command that UNLOCKS the machine after an emergency brake.

noobydp commented 1 month ago

Would the brake feature still be considered an emergency function that means you have to restart the job from the beginning?

I.e. would interrupting the mcu and clearing the queue make it impossible to restart the job where it was stopped?

naikymen commented 1 month ago

This is only meant to retain the robot's position in an emergency, and using that information to avoid collisions while re-homing, or doing something else.

I'd consider it an emergency function, but its logic would certainly allow restarting a job from the place it stopped.

I'm sure a GCODE program could be restarted from this "soft-stop" state, by using the print time and position/step at the soft-stop event, and some extra context from the host part.

I don't know how to implement any of this in the MCU code, at all, but someone with some experience would not find it hard to do. Hence the "help wanted" tag. :smile: