Skip to content

Commit

Permalink
Add a gcode command for the cooldown sequence if the M109 option is e…
Browse files Browse the repository at this point in the history
…nabled

fixes #49
  • Loading branch information
marian42 committed Mar 25, 2021
1 parent 823e82c commit 93bc199
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 21 additions & 1 deletion octoprint_preheat/static/js/preheat.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $(function() {
});
};

self.cooldown = function() {
self.setTemperaturesToZero = function() {
var targets = {};
for (tool of Object.keys(self.temperatureState.tools())) {
targets["tool" + tool] = 0;
Expand Down Expand Up @@ -83,6 +83,26 @@ $(function() {
});
}
};

self.cooldown = function() {
if (self.settings.settings.plugins.preheat.use_m109()) {
$.ajax({
url: API_BASEURL + "printer/command",
type: "POST",
dataType: "json",
data: JSON.stringify({
commands: ["M108"],
parameters: {}
}),
contentType: "application/json; charset=UTF-8",
success: function() {
self.setTemperaturesToZero();
}
});
} else {
self.setTemperaturesToZero();
}
};

self.btnPreheatClick = function() {
if (self.mode == self.MODE_PREHEAT) {
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
plugin_name = "Preheat"

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "0.7.1"
plugin_version = "0.7.2"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down

0 comments on commit 93bc199

Please sign in to comment.