self fanpwn
This commit is contained in:
parent
6124bba2e7
commit
b03a045b24
@ -7,22 +7,20 @@ $(function() {
|
|||||||
function FanSliderPluginViewModel(parameters) {
|
function FanSliderPluginViewModel(parameters) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.printerstate = parameters[0];
|
self.settings = parameters[0];
|
||||||
self.loginstate = parameters[1];
|
self.control = parameters[1];
|
||||||
self.control = parameters[2];
|
self.loginState = parameters[2];
|
||||||
self.settings = parameters[3];
|
|
||||||
|
|
||||||
fanSpeed = ko.observable(undefined);
|
fanSpeed = ko.observable(undefined);
|
||||||
|
|
||||||
//convert percentage into PWM
|
//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.
|
self.speed = fanSpeed() * 255 / 100 //don't forget to limit this to 2 decimal places at some point.
|
||||||
|
|
||||||
return self.speed;
|
return self.speed;
|
||||||
});
|
});
|
||||||
//send gcode to set fan speed
|
//send gcode to set fan speed
|
||||||
sendFanSpeed = function () {
|
sendFanSpeed = function () {
|
||||||
self.control.sendCustomCommand({ command: "M106 S" + fanPWM() });
|
self.control.sendCustomCommand({ command: "M106 S" + self.fanPWM() });
|
||||||
};
|
};
|
||||||
//extra classes
|
//extra classes
|
||||||
$("#control > div.jog-panel").eq(0).addClass("controls");
|
$("#control > div.jog-panel").eq(0).addClass("controls");
|
||||||
@ -61,7 +59,6 @@ $(function() {
|
|||||||
}
|
}
|
||||||
OCTOPRINT_VIEWMODELS.push([
|
OCTOPRINT_VIEWMODELS.push([
|
||||||
FanSliderPluginViewModel,
|
FanSliderPluginViewModel,
|
||||||
|
["settingsViewModel", "controlViewModel", "loginStateViewModel"]
|
||||||
["printerStateViewModel", "loginStateViewModel", "controlViewModel", "settingsViewModel"]
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user