From fb697050cb9b03f75d00635fa66e45a849703e59 Mon Sep 17 00:00:00 2001 From: ntoff Date: Sun, 30 Dec 2018 23:03:22 +1000 Subject: [PATCH] init self.lockfan how do I keep forgetting these things? --- octoprint_fanspeedslider/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/octoprint_fanspeedslider/__init__.py b/octoprint_fanspeedslider/__init__.py index 45033a8..e921d53 100644 --- a/octoprint_fanspeedslider/__init__.py +++ b/octoprint_fanspeedslider/__init__.py @@ -12,7 +12,8 @@ class FanSliderPlugin(octoprint.plugin.StartupPlugin, def __init__(self): self.minPWM=0, - self.maxPWM=255 + self.maxPWM=255, + self.lockfan=False def on_after_startup(self): self.get_settings_updates() @@ -108,7 +109,7 @@ class FanSliderPlugin(octoprint.plugin.StartupPlugin, self._logger.info("fan pwm value " + str(fanPwm) + " is above threshold, decreasing to " + str(self.maxPWM) + " (" + str(self.maxSpeed) + "%)") cmd = "M106 S" + str(self.maxPWM) return cmd, - elif self.lockfan and gcode and gcode.startswith(('M106', 'M107')): + elif gcode and gcode.startswith(('M106', 'M107')) and self.lockfan: self._logger.info("A cooling fan control command was seen, but fanspeedslider is locked. Control command " + str(cmd) + " removed from queue.") return None,