Skip to content

Commit

Permalink
Correctly interpret Smoothieware temperature data for multiple extruders
Browse files Browse the repository at this point in the history
Fixes #633
  • Loading branch information
foosel committed Oct 31, 2014
1 parent 62667de commit ca6364e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

* [#435](https://github.com/foosel/OctoPrint/issues/435) - Always interpret negative duration (e.g. for print time left)
as 0
* [#633](https://github.com/foosel/OctoPrint/issues/633) - Correctly interpret temperature lines from multi extruder
setups under Smoothieware
* Various fixes of bugs in newly introduced features and improvements:
* [#625](https://github.com/foosel/OctoPrint/pull/625) - Newly added GCODE files were not being added to the analysis
queue
Expand Down
1 change: 1 addition & 0 deletions src/octoprint/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def settings(init=False, configfile=None, basedir=None):
"includeCurrentToolInTemps": True,
"hasBed": True,
"repetierStyleTargetTemperature": False,
"smoothieTemperatureReporting": False,
"extendedSdFileList": False
}
}
Expand Down
12 changes: 9 additions & 3 deletions src/octoprint/util/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,8 @@ def _processTemperatures(self, line):
maxToolNum, parsedTemps = self._parseTemperatures(line)

# extruder temperatures
if not "T0" in parsedTemps.keys() and "T" in parsedTemps.keys():
# only single reporting, "T" is our one and only extruder temperature
if not "T0" in parsedTemps.keys() and not "T1" in parsedTemps.keys() and "T" in parsedTemps.keys():
# no T1 so only single reporting, "T" is our one and only extruder temperature
toolNum, actual, target = parsedTemps["T"]

if target is not None:
Expand All @@ -588,7 +588,13 @@ def _processTemperatures(self, line):
self._temp[0] = (actual, oldTarget)
else:
self._temp[0] = (actual, None)
elif "T0" in parsedTemps.keys():
elif not "T0" in parsedTemps.keys() and "T" in parsedTemps.keys():
# Smoothieware sends multi extruder temperature data this way: "T:<first extruder> T1:<second extruder> ..." and therefore needs some special treatment...
_, actual, target = parsedTemps["T"]
del parsedTemps["T"]
parsedTemps["T0"] = (0, actual, target)

if "T0" in parsedTemps.keys():
for n in range(maxToolNum + 1):
tool = "T%d" % n
if not tool in parsedTemps.keys():
Expand Down
3 changes: 3 additions & 0 deletions src/octoprint/util/virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ def _processTemperatureQuery(self):
allTemps.append((i, self.temp[i], self.targetTemp[i]))
allTempsString = " ".join(map(lambda x: "T%d:%.2f /%.2f" % x if includeTarget else "T%d:%.2f" % (x[0], x[1]), allTemps))

if settings().getBoolean(["devel", "virtualPrinter", "smoothieTemperatureReporting"]):
allTempsString = allTempsString.replace("T0:", "T:")

if settings().getBoolean(["devel", "virtualPrinter", "hasBed"]):
if includeTarget:
allTempsString = "B:%.2f /%.2f %s" % (self.bedTemp, self.bedTargetTemp, allTempsString)
Expand Down

0 comments on commit ca6364e

Please sign in to comment.