self fanpwn

This commit is contained in:
ntoff 2017-09-05 22:57:53 +10:00
parent 6124bba2e7
commit b03a045b24

View File

@ -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"]
]);
});