mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-20 05:07:53 -06:00
gcode: Use an event to handle restart request actions
Instead of directly turning off motors, heaters, and fans from gcode.py, raise a new event and allow the heater, fan, and toolhead to handle the event as needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ff9605c082
commit
adf6040e9e
4 changed files with 17 additions and 11 deletions
|
@ -673,13 +673,8 @@ class GCodeParser:
|
|||
gcode_pos, base_pos, homing_pos))
|
||||
def request_restart(self, result):
|
||||
if self.is_printer_ready:
|
||||
self.toolhead.motor_off()
|
||||
print_time = self.toolhead.get_last_move_time()
|
||||
if self.heaters is not None:
|
||||
for heater in self.heaters.get_all_heaters():
|
||||
heater.set_temp(print_time, 0.)
|
||||
if self.fan is not None:
|
||||
self.fan.set_speed(print_time, 0.)
|
||||
self.printer.send_event("gcode:request_restart", print_time)
|
||||
self.toolhead.dwell(0.500)
|
||||
self.toolhead.wait_moves()
|
||||
self.printer.request_exit(result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue