New hook octoprint.comm.protocol.temperatures.received
Allows preprocessing/sanitizing temperatures as received from the printer. Workaround for printers that occasionally report garbage temperature data, e.g. #2050
This commit is contained in:
1 parent
d7298cee06
commit
bfe5bc179c
2 files changed
+36
No files matched your search
@@ -441,6 +441,8 @@ class MachineCom(object):
|
||||
self._gcodescript_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.scripts")
|
||||
self._serial_factory_hooks = self._pluginManager.get_hooks("octoprint.comm.transport.serial.factory")
|
||||
|
||||
self._temperature_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.temperatures.received")
|
||||
|
||||
# SD status data
|
||||
self._sdEnabled = settings().getBoolean(["feature", "sdSupport"])
|
||||
self._sdAvailable = False
|
||||
@@ -1129,6 +1131,14 @@ class MachineCom(object):
|
||||
current_tool = self._currentTool if self._currentTool is not None else 0
|
||||
maxToolNum, parsedTemps = parse_temperature_line(line, current_tool)
|
||||
|
||||
for name, hook in self._temperature_hooks.items():
|
||||
try:
|
||||
parsedTemps = hook(self, parsedTemps)
|
||||
if parsedTemps is None or not parsedTemps:
|
||||
return
|
||||
except:
|
||||
self._logger.exception("Error while processing temperatures in {}, skipping".format(name))
|
||||
|
||||
if "T0" in parsedTemps.keys():
|
||||
for n in range(maxToolNum + 1):
|
||||
tool = "T%d" % n
|
||||
|
||||
Reference in new issue
Block a user