Fix temperature access

This commit is contained in:
Gina Häußge committed 2018-06-06 15:12:27 +02:00
1 parent 717eef25da
commit 7e4faa20b7
2 files changed
+21 -5

No files matched your search

+11 -4
View File
@@ -649,7 +649,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback, ProtocolListener,
return util.thaw_frozendict(data["job"])
def get_current_temperatures(self, *args, **kwargs):
# TODO
# TODO temperature offsets
#if self._comm is not None:
# offsets = self._comm.getOffsets()
#else:
@@ -657,9 +657,16 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback, ProtocolListener,
offsets = dict()
result = dict()
for key, value in self._latest_temperatures.items():
result[key] = dict(actual=value[0],
target=value[1],
if not len(self._temperature_history):
return result
latest_temperature = self._temperature_history[-1]
for key, value in latest_temperature.items():
if not key.startswith("tool") and not key == "bed":
continue
result[key] = dict(actual=value["actual"],
target=value["target"],
offset=offsets.get(key, 0))
return result
+10 -1
View File
@@ -1414,8 +1414,17 @@ class InvariantContainer(object):
def __len__(self):
return len(self._data)
def __getitem__(self, item):
with self._mutex:
return self._data[item]
def __setitem__(self, item, value):
with self._mutex:
self._data[item] = value
self._data = self._invariant(self._data)
def __iter__(self):
return self._data.__iter__()
return iter(self._data)
class PrependableQueue(queue.Queue):