add percentage to logger message

add a more "human readable" percentage value to the logged fan speed (if modified)
This commit is contained in:
ntoff 2017-11-11 21:31:05 +10:00
parent 99364df94e
commit 0e71971e66

View File

@ -50,11 +50,11 @@ class FanSliderPlugin(octoprint.plugin.StartupPlugin,
if fanPwm and fanPwm.group(1): if fanPwm and fanPwm.group(1):
fanPwm = fanPwm.group(1) fanPwm = fanPwm.group(1)
if Decimal(fanPwm) < self.minPWM and Decimal(fanPwm) != 0: if Decimal(fanPwm) < self.minPWM and Decimal(fanPwm) != 0:
self._logger.info("fan pwm value " + str(fanPwm) + " is below threshold, increasing to " + str(self.minPWM)) self._logger.info("fan pwm value " + str(fanPwm) + " is below threshold, increasing to " + str(self.minPWM) + " (" + str(self.minSpeed) + "%)")
cmd = "M106 S" + str(self.minPWM) cmd = "M106 S" + str(self.minPWM)
return cmd, return cmd,
elif Decimal(fanPwm) > self.maxPWM: elif Decimal(fanPwm) > self.maxPWM:
self._logger.info("fan pwm value " + str(fanPwm) + " is above threshold, decreasing to " + str(self.maxPWM)) 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) cmd = "M106 S" + str(self.maxPWM)
return cmd, return cmd,