Skip to content

Commit

Permalink
Don't update gcode scripts if gcode script obvservables are still und…
Browse files Browse the repository at this point in the history
…efined. This occurs when settings hasn't been in opened such as the wizard. (Fixes #162)
  • Loading branch information
kantlivelong committed Feb 1, 2021
1 parent 71d8d4a commit de4fd3e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions octoprint_psucontrol/static/js/psucontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@ $(function() {
};

self.onSettingsBeforeSave = function () {
if (self.scripts_gcode_psucontrol_post_on() != self.settings.scripts.gcode["psucontrol_post_on"]()) {
self.settings.plugins.psucontrol.scripts_gcode_psucontrol_post_on = self.scripts_gcode_psucontrol_post_on;
self.settings.scripts.gcode["psucontrol_post_on"](self.scripts_gcode_psucontrol_post_on());
if (self.scripts_gcode_psucontrol_post_on() !== undefined) {
if (self.scripts_gcode_psucontrol_post_on() != self.settings.scripts.gcode["psucontrol_post_on"]()) {
self.settings.plugins.psucontrol.scripts_gcode_psucontrol_post_on = self.scripts_gcode_psucontrol_post_on;
self.settings.scripts.gcode["psucontrol_post_on"](self.scripts_gcode_psucontrol_post_on());
}
}

if (self.scripts_gcode_psucontrol_pre_off() != self.settings.scripts.gcode["psucontrol_pre_off"]()) {
self.settings.plugins.psucontrol.scripts_gcode_psucontrol_pre_off = self.scripts_gcode_psucontrol_pre_off;
self.settings.scripts.gcode["psucontrol_pre_off"](self.scripts_gcode_psucontrol_pre_off());
if (self.scripts_gcode_psucontrol_pre_off() !== undefined) {
if (self.scripts_gcode_psucontrol_pre_off() != self.settings.scripts.gcode["psucontrol_pre_off"]()) {
self.settings.plugins.psucontrol.scripts_gcode_psucontrol_pre_off = self.scripts_gcode_psucontrol_pre_off;
self.settings.scripts.gcode["psucontrol_pre_off"](self.scripts_gcode_psucontrol_pre_off());
}
}
};

Expand Down

0 comments on commit de4fd3e

Please sign in to comment.