mcu: Detect if the communication channel to the firmware is lost

Detect a comms loss and report it to the user.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-11-30 19:31:46 -05:00
parent 5ebe8ce025
commit bc80ed4e88
4 changed files with 30 additions and 5 deletions

View file

@ -72,6 +72,13 @@ class GCodeParser:
self.build_handlers()
if is_ready and self.is_fileinput and self.fd_handle is None:
self.fd_handle = self.reactor.register_fd(self.fd, self.process_data)
def note_mcu_error(self):
if self.toolhead is not None:
self.toolhead.motor_off()
if self.heater_nozzle is not None:
self.heater_nozzle.set_temp(0., 0.)
if self.heater_bed is not None:
self.heater_bed.set_temp(0., 0.)
def dump_debug(self):
logging.info("Dumping gcode input %d blocks" % (
len(self.input_log),))