Fixed `/api/printer` which wasn't adapter yet to new internal offset data model

This commit is contained in:
Gina Häußge 2015-03-18 15:54:06 +01:00
parent 7b9e3efea1
commit aa0e7a6dd3
2 changed files with 9 additions and 9 deletions

View file

@ -171,6 +171,7 @@
* Don't display a "Disconnected" screen when trying to download a timelapse in Firefox
* Fixed handling of SD card files in folders
* Fixed refreshing of timelapse file list upon finished rendering of a new one
* Fixed ``/api/printer`` which wasn't adapter yet to new internal offset data model
([Commits](https://github.com/foosel/OctoPrint/compare/master...devel))

View file

@ -436,24 +436,23 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
def get_current_temperatures(self):
if self._comm is not None:
tempOffset, bedTempOffset = self._comm.getOffsets()
offsets = self._comm.getOffsets()
else:
tempOffset = {}
bedTempOffset = None
offsets = dict()
result = {}
if self._temp is not None:
for tool in self._temp.keys():
result["tool%d" % tool] = {
"actual": self._temp[tool][0],
"target": self._temp[tool][1],
"offset": tempOffset[tool] if tool in tempOffset.keys() and tempOffset[tool] is not None else 0
"actual": self._temp[tool][0],
"target": self._temp[tool][1],
"offset": offsets[tool] if tool in offsets and offsets[tool] is not None else 0
}
if self._bedTemp is not None:
result["bed"] = {
"actual": self._bedTemp[0],
"target": self._bedTemp[1],
"offset": bedTempOffset
"actual": self._bedTemp[0],
"target": self._bedTemp[1],
"offset": offsets["bed"] if "bed" in offsets and offsets["bed"] is not None else 0
}
return result