From b03a045b24c713d60654271ed7ae7c1264bcc0c4 Mon Sep 17 00:00:00 2001 From: ntoff Date: Tue, 5 Sep 2017 22:57:53 +1000 Subject: [PATCH] self fanpwn --- octoprint_fanspeedslider/static/js/fanslider.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/octoprint_fanspeedslider/static/js/fanslider.js b/octoprint_fanspeedslider/static/js/fanslider.js index a72f340..0b07aca 100644 --- a/octoprint_fanspeedslider/static/js/fanslider.js +++ b/octoprint_fanspeedslider/static/js/fanslider.js @@ -7,22 +7,20 @@ $(function() { function FanSliderPluginViewModel(parameters) { var self = this; - self.printerstate = parameters[0]; - self.loginstate = parameters[1]; - self.control = parameters[2]; - self.settings = parameters[3]; + self.settings = parameters[0]; + self.control = parameters[1]; + self.loginState = parameters[2]; fanSpeed = ko.observable(undefined); //convert percentage into PWM - fanPWM = ko.pureComputed(function () { + self.fanPWM = ko.pureComputed(function () { self.speed = fanSpeed() * 255 / 100 //don't forget to limit this to 2 decimal places at some point. - return self.speed; }); //send gcode to set fan speed sendFanSpeed = function () { - self.control.sendCustomCommand({ command: "M106 S" + fanPWM() }); + self.control.sendCustomCommand({ command: "M106 S" + self.fanPWM() }); }; //extra classes $("#control > div.jog-panel").eq(0).addClass("controls"); @@ -61,7 +59,6 @@ $(function() { } OCTOPRINT_VIEWMODELS.push([ FanSliderPluginViewModel, - - ["printerStateViewModel", "loginStateViewModel", "controlViewModel", "settingsViewModel"] + ["settingsViewModel", "controlViewModel", "loginStateViewModel"] ]); }); \ No newline at end of file