gcode: Introduce request_restart() method
Use request_restart() method instead of prep_restart() and motor_heater_off(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
11c7c110a1
commit
f77e1b67f6
|
@ -108,16 +108,6 @@ class GCodeParser:
|
||||||
self.fd_handle = self.reactor.register_fd(self.fd, self.process_data)
|
self.fd_handle = self.reactor.register_fd(self.fd, self.process_data)
|
||||||
def reset_last_position(self):
|
def reset_last_position(self):
|
||||||
self.last_position = self.position_with_transform()
|
self.last_position = self.position_with_transform()
|
||||||
def motor_heater_off(self):
|
|
||||||
if self.toolhead is None:
|
|
||||||
return
|
|
||||||
self.toolhead.motor_off()
|
|
||||||
print_time = self.toolhead.get_last_move_time()
|
|
||||||
for heater in self.heaters:
|
|
||||||
if heater is not None:
|
|
||||||
heater.set_temp(print_time, 0.)
|
|
||||||
if self.fan is not None:
|
|
||||||
self.fan.set_speed(print_time, 0.)
|
|
||||||
def dump_debug(self):
|
def dump_debug(self):
|
||||||
out = []
|
out = []
|
||||||
out.append("Dumping gcode input %d blocks" % (
|
out.append("Dumping gcode input %d blocks" % (
|
||||||
|
@ -185,10 +175,7 @@ class GCodeParser:
|
||||||
# Special handling for debug file input EOF
|
# Special handling for debug file input EOF
|
||||||
if not data and self.is_fileinput:
|
if not data and self.is_fileinput:
|
||||||
if not self.is_processing_data:
|
if not self.is_processing_data:
|
||||||
self.motor_heater_off()
|
self.request_restart('exit')
|
||||||
if self.toolhead is not None:
|
|
||||||
self.toolhead.wait_moves()
|
|
||||||
self.printer.request_exit()
|
|
||||||
pending_commands.append("")
|
pending_commands.append("")
|
||||||
# Handle case where multiple commands pending
|
# Handle case where multiple commands pending
|
||||||
if self.is_processing_data or len(pending_commands) > 1:
|
if self.is_processing_data or len(pending_commands) > 1:
|
||||||
|
@ -553,22 +540,27 @@ class GCodeParser:
|
||||||
temp = self.get_float('S', params)
|
temp = self.get_float('S', params)
|
||||||
heater.start_auto_tune(temp)
|
heater.start_auto_tune(temp)
|
||||||
self.bg_temp(heater)
|
self.bg_temp(heater)
|
||||||
def prep_restart(self):
|
def request_restart(self, result):
|
||||||
if self.is_printer_ready:
|
if self.is_printer_ready:
|
||||||
self.respond_info("Preparing to restart...")
|
self.respond_info("Preparing to restart...")
|
||||||
self.motor_heater_off()
|
self.toolhead.motor_off()
|
||||||
|
print_time = self.toolhead.get_last_move_time()
|
||||||
|
for heater in self.heaters:
|
||||||
|
if heater is not None:
|
||||||
|
heater.set_temp(print_time, 0.)
|
||||||
|
if self.fan is not None:
|
||||||
|
self.fan.set_speed(print_time, 0.)
|
||||||
self.toolhead.dwell(0.500)
|
self.toolhead.dwell(0.500)
|
||||||
self.toolhead.wait_moves()
|
self.toolhead.wait_moves()
|
||||||
|
self.printer.request_exit(result)
|
||||||
cmd_RESTART_when_not_ready = True
|
cmd_RESTART_when_not_ready = True
|
||||||
cmd_RESTART_help = "Reload config file and restart host software"
|
cmd_RESTART_help = "Reload config file and restart host software"
|
||||||
def cmd_RESTART(self, params):
|
def cmd_RESTART(self, params):
|
||||||
self.prep_restart()
|
self.request_restart('restart')
|
||||||
self.printer.request_exit('restart')
|
|
||||||
cmd_FIRMWARE_RESTART_when_not_ready = True
|
cmd_FIRMWARE_RESTART_when_not_ready = True
|
||||||
cmd_FIRMWARE_RESTART_help = "Restart firmware, host, and reload config"
|
cmd_FIRMWARE_RESTART_help = "Restart firmware, host, and reload config"
|
||||||
def cmd_FIRMWARE_RESTART(self, params):
|
def cmd_FIRMWARE_RESTART(self, params):
|
||||||
self.prep_restart()
|
self.request_restart('firmware_restart')
|
||||||
self.printer.request_exit('firmware_restart')
|
|
||||||
cmd_ECHO_when_not_ready = True
|
cmd_ECHO_when_not_ready = True
|
||||||
def cmd_ECHO(self, params):
|
def cmd_ECHO(self, params):
|
||||||
self.respond_info(params['#original'])
|
self.respond_info(params['#original'])
|
||||||
|
|
Loading…
Reference in New Issue