Get UM3 target hotend temperatures

This commit is contained in:
fieldOfView 2017-08-29 11:05:36 +02:00
parent 4d0c77683c
commit 85b20ab16b

View file

@ -312,6 +312,18 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
self.targetBedTemperatureChanged.emit() self.targetBedTemperatureChanged.emit()
return True return True
## Updates the target hotend temperature from the printer, and emit a signal if it was changed.
#
# /param index The index of the hotend.
# /param temperature The new target temperature of the hotend.
# /return boolean, True if the temperature was changed, false if the new temperature has the same value as the already stored temperature
def _updateTargetHotendTemperature(self, index, temperature):
if self._target_hotend_temperatures[index] == temperature:
return False
self._target_hotend_temperatures[index] = temperature
self.targetHotendTemperaturesChanged.emit()
return True
def _stopCamera(self): def _stopCamera(self):
if self._camera_timer.isActive(): if self._camera_timer.isActive():
self._camera_timer.stop() self._camera_timer.stop()
@ -534,8 +546,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
def _spliceJSONData(self): def _spliceJSONData(self):
# Check for hotend temperatures # Check for hotend temperatures
for index in range(0, self._num_extruders): for index in range(0, self._num_extruders):
temperature = self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["temperature"]["current"] temperatures = self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["temperature"]
self._setHotendTemperature(index, temperature) self._setHotendTemperature(index, temperatures["current"])
self._updateTargetHotendTemperature(index, temperatures["target"])
try: try:
material_id = self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["guid"] material_id = self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["guid"]
except KeyError: except KeyError:
@ -547,10 +560,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
hotend_id = "" hotend_id = ""
self._setHotendId(index, hotend_id) self._setHotendId(index, hotend_id)
bed_temperature = self._json_printer_state["bed"]["temperature"]["current"] bed_temperatures = self._json_printer_state["bed"]["temperature"]
self._setBedTemperature(bed_temperature) self._setBedTemperature(bed_temperatures["current"])
target_bed_temperature = self._json_printer_state["bed"]["temperature"]["target"] self._updateTargetBedTemperature(bed_temperatures["target"])
self._updateTargetBedTemperature(target_bed_temperature)
head_x = self._json_printer_state["heads"][0]["position"]["x"] head_x = self._json_printer_state["heads"][0]["position"]["x"]
head_y = self._json_printer_state["heads"][0]["position"]["y"] head_y = self._json_printer_state["heads"][0]["position"]["y"]