diff --git a/octoprint_fanspeedslider/static/js/fanslider.js b/octoprint_fanspeedslider/static/js/fanslider.js index cf100d0..9d6940c 100644 --- a/octoprint_fanspeedslider/static/js/fanslider.js +++ b/octoprint_fanspeedslider/static/js/fanslider.js @@ -5,7 +5,7 @@ $(function() { function FanSliderPluginViewModel(parameters) { - //'use strict'; + 'use strict'; var self = this; self.settings = parameters[0]; @@ -29,8 +29,8 @@ $(function() { } }; - //send gcode to set fan speed TODO: not be a global function - sendFanSpeed = ko.pureComputed(function () { + //send gcode to set fan speed + self.control.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 ("+self.control.minFanSpeed()+"%), increasing."); @@ -65,21 +65,21 @@ $(function() { //add new fan controls $("#control-jog-general").find("button").eq(0).before("\ \ - \ + \ \ "); } else { //replace touch UI's fan on button with one that sends whatever speed is set in this plugin $("#fan-on").remove(); $("#control-jog-general").find("button").eq(0).after("\ - \ + \ "); //also add spin box + button below in its own section, button is redundant but convenient $("#control-jog-extrusion").after("\
\
\ \ - \ + \
\
\ ");