mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-22 05:39:37 +08:00
Don't try to send empty g-code lines
This commit is contained in:
parent
6ff130c361
commit
645e3e8dfe
@ -19,8 +19,8 @@ from PyQt5.QtCore import QUrl, pyqtSlot, pyqtSignal, pyqtProperty
|
|||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
class USBPrinterOutputDevice(PrinterOutputDevice):
|
|
||||||
|
|
||||||
|
class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
def __init__(self, serial_port):
|
def __init__(self, serial_port):
|
||||||
super().__init__(serial_port)
|
super().__init__(serial_port)
|
||||||
self.setName(catalog.i18nc("@item:inmenu", "USB printing"))
|
self.setName(catalog.i18nc("@item:inmenu", "USB printing"))
|
||||||
@ -559,6 +559,12 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
|||||||
if ";" in line:
|
if ";" in line:
|
||||||
line = line[:line.find(";")]
|
line = line[:line.find(";")]
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
|
||||||
|
# Don't send empty lines
|
||||||
|
if line == "":
|
||||||
|
self._gcode_position += 1
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if line == "M0" or line == "M1":
|
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.
|
line = "M105" # Don't send the M0 or M1 to the machine, as M0 and M1 are handled as an LCD menu pause.
|
||||||
|
@ -238,7 +238,6 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
Logger.log("w", "Connection state of %s changed, but it was not found in the list")
|
Logger.log("w", "Connection state of %s changed, but it was not found in the list")
|
||||||
|
|
||||||
|
|
||||||
@pyqtProperty(QObject , notify = connectionStateChanged)
|
@pyqtProperty(QObject , notify = connectionStateChanged)
|
||||||
def connectedPrinterList(self):
|
def connectedPrinterList(self):
|
||||||
self._usb_output_devices_model = ListModel()
|
self._usb_output_devices_model = ListModel()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user