Fixed preheating for Legacy UM3

CL-541
This commit is contained in:
Jaime van Kessel 2017-12-08 17:16:59 +01:00
parent ae629e2968
commit 1719a7b2fe
5 changed files with 97 additions and 74 deletions

View file

@ -543,7 +543,9 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice):
return
if not self._printers:
self._printers = [PrinterOutputModel(output_controller=self._output_controller, number_of_extruders=self._number_of_extruders)]
# Quickest way to get the firmware version is to grab it from the zeroconf.
firmware_version = self._properties.get(b"firmware_version", b"").decode("utf-8")
self._printers = [PrinterOutputModel(output_controller=self._output_controller, number_of_extruders=self._number_of_extruders, firmware_version=firmware_version)]
self._printers[0].setCamera(NetworkCamera("http://" + self._address + ":8080/?action=stream"))
self.printersChanged.emit()
@ -553,6 +555,14 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice):
printer.updateTargetBedTemperature(result["bed"]["temperature"]["target"])
printer.updateState(result["status"])
try:
# If we're still handling the request, we should ignore remote for a bit.
if not printer.getController().isPreheatRequestInProgress():
printer.updateIsPreheating(result["bed"]["pre_heat"]["active"])
except KeyError:
# Older firmwares don't support preheating, so we need to fake it.
pass
head_position = result["heads"][0]["position"]
printer.updateHeadPosition(head_position["x"], head_position["y"], head_position["z"])