From b5693e2e3447d8e10935f4e461121d9ead772938 Mon Sep 17 00:00:00 2001 From: ntoff Date: Wed, 25 Apr 2018 14:35:06 +1000 Subject: [PATCH] fix regex not matching properly for low digit count values of S see issue #9 --- octoprint_fanspeedslider/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/octoprint_fanspeedslider/__init__.py b/octoprint_fanspeedslider/__init__.py index 9e7c3f9..89c8328 100644 --- a/octoprint_fanspeedslider/__init__.py +++ b/octoprint_fanspeedslider/__init__.py @@ -83,7 +83,7 @@ class FanSliderPlugin(octoprint.plugin.StartupPlugin, def rewrite_m106(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwargs): if gcode and gcode.startswith('M106'): - fanPwm = re.search("S(\d+.\d+)", cmd) + fanPwm = re.search("S(\d+\.?\d*)", cmd) if fanPwm and fanPwm.group(1): fanPwm = fanPwm.group(1) if Decimal(fanPwm) < self.minPWM and Decimal(fanPwm) != 0: