Merge pull request #2334 from fieldOfView/feature_target_hotend_temperature

Show target hotend temperatures
This commit is contained in:
alekseisasin 2017-08-31 13:46:55 +02:00 committed by GitHub
commit 7c637029b6
2 changed files with 53 additions and 8 deletions

View file

@ -313,6 +313,18 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
self.targetBedTemperatureChanged.emit()
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):
if self._camera_timer.isActive():
self._camera_timer.stop()
@ -535,8 +547,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
def _spliceJSONData(self):
# Check for hotend temperatures
for index in range(0, self._num_extruders):
temperature = self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["temperature"]["current"]
self._setHotendTemperature(index, temperature)
temperatures = self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["temperature"]
self._setHotendTemperature(index, temperatures["current"])
self._updateTargetHotendTemperature(index, temperatures["target"])
try:
material_id = self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["guid"]
except KeyError:
@ -548,10 +561,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
hotend_id = ""
self._setHotendId(index, hotend_id)
bed_temperature = self._json_printer_state["bed"]["temperature"]["current"]
self._setBedTemperature(bed_temperature)
target_bed_temperature = self._json_printer_state["bed"]["temperature"]["target"]
self._updateTargetBedTemperature(target_bed_temperature)
bed_temperatures = self._json_printer_state["bed"]["temperature"]
self._setBedTemperature(bed_temperatures["current"])
self._updateTargetBedTemperature(bed_temperatures["target"])
head_x = self._json_printer_state["heads"][0]["position"]["x"]
head_y = self._json_printer_state["heads"][0]["position"]["y"]