From 175722a0159c9642dc5158c91654a6c40681eb52 Mon Sep 17 00:00:00 2001 From: ntoff Date: Sun, 12 Nov 2017 01:08:27 +1000 Subject: [PATCH] fix javascript console logging of fan speed notification log was being output after the slider was set causing it to display the wrong value --- octoprint_fanspeedslider/static/js/fanslider.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/octoprint_fanspeedslider/static/js/fanslider.js b/octoprint_fanspeedslider/static/js/fanslider.js index ada8aef..81dd1d4 100644 --- a/octoprint_fanspeedslider/static/js/fanslider.js +++ b/octoprint_fanspeedslider/static/js/fanslider.js @@ -33,21 +33,23 @@ $(function() { sendFanSpeed = ko.pureComputed(function () { self.speed = self.control.fanSpeed() * 255 / 100 //don't forget to limit this to 2 decimal places at some point. if (self.control.fanSpeed() < self.control.minFanSpeed() && self.control.fanSpeed() != "0") { + console.log("Fan Speed Control Plugin: " + self.control.fanSpeed() + "% is less than the minimum speed set in the fan control settings, increasing to " + self.control.minFanSpeed() + "%"); self.control.fanSpeed(self.control.minFanSpeed()); var options = { text: 'Fan speed increased to meet minimum requirement.', } self.showNotify(self,options); - console.log("Fan Speed Control Plugin: " + self.control.fanSpeed() + "% is less than the minimum speed set in the fan control settings, increasing to " + self.control.minFanSpeed() + "%"); + } else { if (self.control.fanSpeed() > self.control.maxFanSpeed()) { + console.log("Fan Speed Control Plugin: " + self.control.fanSpeed() + "% is more than the maximum speed set in the fan control settings, decreasing to " + self.control.maxFanSpeed() + "%"); self.control.fanSpeed(self.control.maxFanSpeed()); var options = { text: 'Fan speed decreased to meet minimum requirement.', } self.showNotify(self,options); - console.log("Fan Speed Control Plugin: " + self.control.fanSpeed() + "% is more than the maximum speed set in the fan control settings, decreasing to " + self.control.maxFanSpeed() + "%"); + } } self.control.sendCustomCommand({ command: "M106 S" + self.speed });