Skip to content

Commit

Permalink
Apply temperature offset (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheThief authored Oct 17, 2024
1 parent 60ac091 commit 9170f03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions octoprint_smartpreheat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def get_temps_from_file(self, selected_file):
if gcode in ('M104', 'M109', 'M140', 'M190'):
self._logger.debug("Line %d: Detected SetTemp. Line=%s", lineNum, line)

offsets = self._printer._comm.getOffsets()

toolMatch = octoprint.util.comm.regexes_parameters["intT"].search(line)
if toolMatch:
toolNum = int(toolMatch.group("value"))
Expand All @@ -104,10 +106,10 @@ def get_temps_from_file(self, selected_file):

if gcode in ("M104", "M109"):
self._logger.debug("Line %d: Tool %s = %s", lineNum, toolNum, temp)
temps["tools"][toolNum] = temp
temps["tools"][toolNum] = temp + offsets.get("tool%d" % toolNum, 0)
elif gcode in ("M140", "M190"):
self._logger.debug("Line %d: Bed = %s", lineNum, temp)
temps["bed"] = temp
temps["bed"] = temp + offsets.get("bed", 0)

self._logger.debug("Temperatures: %r", temps)
return temps
Expand Down

0 comments on commit 9170f03

Please sign in to comment.