From b4f6ae8c5f76fa7cd0d1510d1960853396fb4d06 Mon Sep 17 00:00:00 2001 From: Elijah Snyder Date: Mon, 10 Apr 2017 19:01:59 -0500 Subject: [PATCH] First refactor for section to increase verbosity and move all translated M105s. --- plugins/USBPrinting/USBPrinterOutputDevice.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 580bbf06df..2ca7e4ecc7 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -563,19 +563,19 @@ class USBPrinterOutputDevice(PrinterOutputDevice): line = line[:line.find(";")] line = line.strip() - # Don't send empty lines. But we do have to send something, so send m105 instead. - if line == "": + # Don't send empty lines. But we do have to send something, so send + # m105 instead. + # Don't send the M0 or M1 to the machine, as M0 and M1 are handled as + # an LCD menu pause. + if line == "" or line == "M1" or line == "M1": line = "M105" - try: - if line == "M0" or line == "M1": - line = "M105" # Don't send the M0 or M1 to the machine, as M0 and M1 are handled as an LCD menu pause. if ("G0" in line or "G1" in line) and "Z" in line: z = float(re.search("Z([0-9\.]*)", line).group(1)) if self._current_z != z: self._current_z = z except Exception as e: - Logger.log("e", "Unexpected error with printer connection: %s" % e) + Logger.log("e", "Unexpected error with printer connection, could not parse current Z: %s: %s" % (e, line)) self._setErrorState("Unexpected error: %s" %e) checksum = functools.reduce(lambda x,y: x^y, map(ord, "N%d%s" % (self._gcode_position, line))) @@ -674,4 +674,4 @@ class USBPrinterOutputDevice(PrinterOutputDevice): def cancelPreheatBed(self): Logger.log("i", "Cancelling pre-heating of the bed.") self._setTargetBedTemperature(0) - self.preheatBedRemainingTimeChanged.emit() \ No newline at end of file + self.preheatBedRemainingTimeChanged.emit()