Compare commits
No commits in common. "master" and "commandlocktest" have entirely different histories.
master
...
commandloc
@ -12,8 +12,6 @@ Slide the slider, click the button. There really isn't much else to do :)
|
||||
|
||||
* The default value of the slider is user configurable, this is the value that the slider will be set to upon loading OctoPrint's UI, and any time you refresh the page.
|
||||
|
||||
* The remember last speed checkbox will tell the plugin to save the fan speed as it gets sent to the printer, and set the slider to that value on load / refresh (overrides the default value setting).
|
||||
|
||||
* The minimum fan speed setting will limit how slow the fan runs, this is useful since some fans don't work below a certain speed.
|
||||
|
||||
* The maximum fan speed setting will limit how fast the fan runs, this is useful if your fan is too strong, or you wish to limit the speed post-slice without having to re-slice your file.
|
||||
|
@ -12,8 +12,7 @@ class FanSliderPlugin(octoprint.plugin.StartupPlugin,
|
||||
|
||||
def __init__(self):
|
||||
self.minPWM=0,
|
||||
self.maxPWM=255,
|
||||
self.lockfan=False
|
||||
self.maxPWM=255
|
||||
|
||||
def on_after_startup(self):
|
||||
self.get_settings_updates()
|
||||
@ -24,9 +23,7 @@ class FanSliderPlugin(octoprint.plugin.StartupPlugin,
|
||||
minSpeed=0,
|
||||
maxSpeed=100,
|
||||
notifyDelay=4000,
|
||||
lockfan=False,
|
||||
lastSentSpeed=0,
|
||||
defaultLastSpeed=False
|
||||
lockfan=False
|
||||
)
|
||||
|
||||
def on_settings_save(self, data):
|
||||
@ -41,10 +38,6 @@ class FanSliderPlugin(octoprint.plugin.StartupPlugin,
|
||||
s.setInt(["notifyDelay"], data["notifyDelay"])
|
||||
if "lockfan" in data.keys():
|
||||
s.set(["lockfan"], data["lockfan"])
|
||||
if "lastSentSpeed" in data.keys():
|
||||
s.setInt(["lastSentSpeed"], data["lastSentSpeed"])
|
||||
if "defaultLastSpeed" in data.keys():
|
||||
s.set(["defaultLastSpeed"], data["defaultLastSpeed"])
|
||||
self.get_settings_updates()
|
||||
#clean up settings if everything's default
|
||||
self.on_settings_cleanup()
|
||||
@ -109,7 +102,7 @@ class FanSliderPlugin(octoprint.plugin.StartupPlugin,
|
||||
self._logger.info("fan pwm value " + str(fanPwm) + " is above threshold, decreasing to " + str(self.maxPWM) + " (" + str(self.maxSpeed) + "%)")
|
||||
cmd = "M106 S" + str(self.maxPWM)
|
||||
return cmd,
|
||||
elif gcode and gcode.startswith(('M106', 'M107')) and self.lockfan:
|
||||
elif self.lockfan and gcode and gcode.startswith(('M106', 'M107')):
|
||||
self._logger.info("A cooling fan control command was seen, but fanspeedslider is locked. Control command " + str(cmd) + " removed from queue.")
|
||||
return None,
|
||||
|
||||
@ -131,7 +124,6 @@ class FanSliderPlugin(octoprint.plugin.StartupPlugin,
|
||||
)
|
||||
|
||||
__plugin_name__ = "Fan Speed Control"
|
||||
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||
|
||||
def __plugin_load__():
|
||||
global __plugin_implementation__
|
||||
|
@ -18,8 +18,6 @@ $(function () {
|
||||
self.settings.maxFanSpeed = new ko.observable(100); //and this are percents 0 - 100%
|
||||
self.settings.notifyDelay = new ko.observable(4000); //time in milliseconds
|
||||
self.settings.lockfan = new ko.observable(false); //ignore fan inputs from gcode and lock the fan buttons
|
||||
self.settings.defaultLastSpeed = new ko.observable(false); //options page option to set the slider to the last sent fan speed value on load/refresh
|
||||
self.settings.lastSentSpeed = new ko.observable(null); //the last speed value that was sent to the printer
|
||||
|
||||
self.control.lockTitle = new ko.observable(gettext("Unlocked")); //will set the hover title info for the fan lock button
|
||||
|
||||
@ -29,7 +27,6 @@ $(function () {
|
||||
self.settings.minTitle = ko.observable(gettext("Set this to the lowest value at which your fan will spin.") + self.settings.commonTitle());
|
||||
self.settings.maxTitle = ko.observable(gettext("Set this <100% if your cooling fan is too strong on full.") + self.settings.commonTitle());
|
||||
self.settings.noticeTitle = ko.observable(gettext("Notifications only apply when setting the speed via the slider + button in the UI. Set to 0 (zero) to disable notifications."));
|
||||
self.settings.lastspeedTitle = ko.observable(gettext("Instead of defaulting to the speed set by \"Default Value\", the slider will be set to the last sent speed on load / refresh. \n\n Note: It takes into account the min/max value setting and overrides the \"Default Value\" setting."));
|
||||
|
||||
self.showNotify = function (self, options) {
|
||||
options.title = "Fan Speed Control";
|
||||
@ -76,12 +73,6 @@ $(function () {
|
||||
self.control.sendFanSpeed = function () {
|
||||
self.control.checkSliderValue();
|
||||
self.control.sendCustomCommand({ command: "M106 S" + self.control.fanSpeedToPwm() });
|
||||
|
||||
if (self.settings.defaultLastSpeed()) {
|
||||
self.settings.settings.plugins.fanspeedslider.lastSentSpeed(self.control.fanSpeed());
|
||||
self.settings.saveData();
|
||||
self.updateSettings();
|
||||
}
|
||||
};
|
||||
|
||||
self.control.lockFanInput = function () {
|
||||
@ -160,7 +151,6 @@ $(function () {
|
||||
else if (!self.settings.lockfan()) {
|
||||
self.control.lockTitle( gettext("Lock or unlock the cooling fan controls. When locked, no cooling fan commands will be sent to the printer. \n\n Fan controls are unlocked"))
|
||||
}
|
||||
self.settings.defaultLastSpeed(self.settings.settings.plugins.fanspeedslider.defaultLastSpeed());
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
@ -169,7 +159,6 @@ $(function () {
|
||||
|
||||
self.onBeforeBinding = function () {
|
||||
self.settings.defaultFanSpeed(parseInt(self.settings.settings.plugins.fanspeedslider.defaultFanSpeed()));
|
||||
self.settings.lastSentSpeed(parseInt(self.settings.settings.plugins.fanspeedslider.lastSentSpeed()));
|
||||
self.updateSettings();
|
||||
//if the default fan speed is above or below max/min then set to either max or min
|
||||
if (self.settings.defaultFanSpeed() < self.settings.minFanSpeed()) {
|
||||
@ -178,9 +167,6 @@ $(function () {
|
||||
else if (self.settings.defaultFanSpeed() > self.settings.maxFanSpeed()) {
|
||||
self.control.fanSpeed(self.settings.maxFanSpeed());
|
||||
}
|
||||
else if (self.settings.defaultLastSpeed()) {
|
||||
self.control.fanSpeed(self.settings.lastSentSpeed());
|
||||
}
|
||||
else {
|
||||
self.control.fanSpeed(self.settings.defaultFanSpeed());
|
||||
}
|
||||
|
@ -11,15 +11,6 @@
|
||||
<span class="help-block">{{ _('The default value the slider will be set to when opening OctoPrint\'s UI') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{ _('Remember Last Speed') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="checkbox" class="input-mini" data-bind="attr: { title: lastspeedTitle }, checked: settings.plugins.fanspeedslider.defaultLastSpeed">
|
||||
</div>
|
||||
<span class="help-block">{{ _('Instead of the default speed value, the slider will use the last sent speed as the default value') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<!--<strong>{{ _('The settings below can be used to limit the fan\'s output without having to re-slice and re-upload your gcode.') }}</strong>-->
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{ _('Minimum Speed') }}</label>
|
||||
|
2
setup.py
2
setup.py
@ -14,7 +14,7 @@ plugin_package = "octoprint_fanspeedslider"
|
||||
plugin_name = "OctoPrint-FanSpeedSlider"
|
||||
|
||||
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
|
||||
plugin_version = "0.2.1"
|
||||
plugin_version = "0.1.8"
|
||||
|
||||
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
|
||||
# module
|
||||
|
Loading…
Reference in New Issue
Block a user