Skip to content

Commit

Permalink
Minor changes to #2123 for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
foosel committed Sep 29, 2017
1 parent 791f045 commit 0f325b9
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/octoprint/util/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1129,8 +1129,9 @@ def _recordFilePosition(self):

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)
Expand All @@ -1139,17 +1140,15 @@ def _processTemperatures(self, line):
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)
Expand Down

0 comments on commit 0f325b9

Please sign in to comment.