mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Merge branch 'usbprinting-zparseerror-refactor' of git://github.com/tamarintech/Cura
This commit is contained in:
commit
04d2f8d68c
1 changed files with 7 additions and 7 deletions
|
@ -566,19 +566,19 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
line = line[:line.find(";")]
|
line = line[:line.find(";")]
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
|
||||||
# Don't send empty lines. But we do have to send something, so send m105 instead.
|
# Don't send empty lines. But we do have to send something, so send
|
||||||
if line == "":
|
# 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"
|
line = "M105"
|
||||||
|
|
||||||
try:
|
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:
|
if ("G0" in line or "G1" in line) and "Z" in line:
|
||||||
z = float(re.search("Z([0-9\.]*)", line).group(1))
|
z = float(re.search("Z([0-9\.]*)", line).group(1))
|
||||||
if self._current_z != z:
|
if self._current_z != z:
|
||||||
self._current_z = z
|
self._current_z = z
|
||||||
except Exception as e:
|
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)
|
self._setErrorState("Unexpected error: %s" %e)
|
||||||
checksum = functools.reduce(lambda x,y: x^y, map(ord, "N%d%s" % (self._gcode_position, line)))
|
checksum = functools.reduce(lambda x,y: x^y, map(ord, "N%d%s" % (self._gcode_position, line)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue