diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index dbfe7029..8078495a 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -1129,8 +1129,9 @@ class MachineCom(object): def _processTemperatures(self, line): current_tool = self._currentTool if self._currentTool is not None else 0 + current_tool_key = "T%d" % current_tool maxToolNum, parsedTemps = parse_temperature_line(line, current_tool) -# self._logger.info("current_tool: %d, maxToolNum: %d, parsedTemps: %s"%(current_tool,maxToolNum,parsedTemps)) + for name, hook in self._temperature_hooks.items(): try: parsedTemps = hook(self, parsedTemps) @@ -1139,17 +1140,15 @@ class MachineCom(object): except: self._logger.exception("Error while processing temperatures in {}, skipping".format(name)) - printer_profile=self._printerProfileManager.get_current_or_default() - shared_nozzle = printer_profile["extruder"]["sharedNozzle"] - - if "T%d"%current_tool in parsedTemps.keys(): + if current_tool_key in parsedTemps.keys(): + shared_nozzle = self._printerProfileManager.get_current_or_default()["extruder"]["sharedNozzle"] for n in range(maxToolNum + 1): tool = "T%d" % n - if not tool in parsedTemps.keys() and not shared_nozzle: - continue - elif not tool in parsedTemps.keys() and shared_nozzle: - actual, target = parsedTemps["T%d"%current_tool] - + if not tool in parsedTemps: + if shared_nozzle: + actual, target = parsedTemps[current_tool_key] + else: + continue else: actual, target = parsedTemps[tool] self.last_temperature.set_tool(n, actual=actual, target=target)