From 24568082fa78b2cc9f745987f82d9a4b76170882 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Wed, 2 Feb 2022 09:08:52 -0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Enable=20custom=20temps=20reported?= =?UTF-8?q?=20by=20printer=20on=20API=20&=20socket=20(#4388)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/printer/standard.py | 6 ++++++ src/octoprint/util/comm.py | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index baf33070b..0a564935c 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -853,6 +853,12 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): if "chamber" in offsets and offsets["chamber"] is not None else 0, } + if self._custom is not None: + for custom_key in self._custom.keys(): + result[custom_key] = { + "actual": self._custom[custom_key][0], + "target": self._custom[custom_key][1], + } return result diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 61cfc4a01..a7614cfa4 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -112,7 +112,7 @@ Groups will be as follows: """ regex_temp = re.compile( - r"(?PB|C|T(?P\d*)):\s*(?P%s)(\s*\/?\s*(?P%s))?" + r"(?PB|C|T(?P\d*)|([\w]+)):\s*(?P%s)(\s*\/?\s*(?P%s))?" % (regex_float_pattern, regex_float_pattern) ) """Regex matching temperature entries in line. @@ -6207,10 +6207,10 @@ def parse_temperature_line(line, current): maxToolNum = toolNumber try: - actual = float(match.group(3)) + actual = float(match.group(4)) target = None - if match.group(4) and match.group(5): - target = float(match.group(5)) + if match.group(4) and match.group(6): + target = float(match.group(6)) result[tool] = (actual, target) except ValueError: