From 6ff130c3619078c5be9b9867cc647673e0803d6a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 23 Mar 2017 17:57:52 +0100 Subject: [PATCH 1/3] Added logging --- plugins/USBPrinting/USBPrinterOutputDeviceManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index eb0193c0c0..8f7c06419b 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -236,7 +236,7 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension): self.getOutputDeviceManager().removeOutputDevice(serial_port) self.connectionStateChanged.emit() except KeyError: - pass # no output device by this device_id found in connection list. + Logger.log("w", "Connection state of %s changed, but it was not found in the list") @pyqtProperty(QObject , notify = connectionStateChanged) From 645e3e8dfedf41bc8b5f1ebd080a529df99136ca Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 23 Mar 2017 19:42:52 +0100 Subject: [PATCH 2/3] Don't try to send empty g-code lines --- plugins/USBPrinting/USBPrinterOutputDevice.py | 8 +++++++- plugins/USBPrinting/USBPrinterOutputDeviceManager.py | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index a519e05f53..31cdb16ff5 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -19,8 +19,8 @@ from PyQt5.QtCore import QUrl, pyqtSlot, pyqtSignal, pyqtProperty from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") -class USBPrinterOutputDevice(PrinterOutputDevice): +class USBPrinterOutputDevice(PrinterOutputDevice): def __init__(self, serial_port): super().__init__(serial_port) self.setName(catalog.i18nc("@item:inmenu", "USB printing")) @@ -559,6 +559,12 @@ class USBPrinterOutputDevice(PrinterOutputDevice): if ";" in line: line = line[:line.find(";")] line = line.strip() + + # Don't send empty lines + if line == "": + self._gcode_position += 1 + return + 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. diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index 8f7c06419b..5b1d0b8dac 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -238,7 +238,6 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension): except KeyError: Logger.log("w", "Connection state of %s changed, but it was not found in the list") - @pyqtProperty(QObject , notify = connectionStateChanged) def connectedPrinterList(self): self._usb_output_devices_model = ListModel() From e30e2a801873bbc75c74775157f7403b5933edc0 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 23 Mar 2017 20:13:13 +0100 Subject: [PATCH 3/3] Instead of not sending the line at all, just send a get temp command --- plugins/USBPrinting/USBPrinterOutputDevice.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 31cdb16ff5..dfe6e94387 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -560,10 +560,9 @@ class USBPrinterOutputDevice(PrinterOutputDevice): line = line[:line.find(";")] line = line.strip() - # Don't send empty lines + # Don't send empty lines. But we do have to send something, so send m105 instead. if line == "": - self._gcode_position += 1 - return + line = "M105" try: if line == "M0" or line == "M1":