diff --git a/.gitignore b/.gitignore index 43dd422..223e493 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .DS_Store .pyc +CR_10_Leveling.egg-info/ +octoprint_CR10_Leveling/__init__.pyc diff --git a/octoprint_CR10_Leveling/__init__.py b/octoprint_CR10_Leveling/__init__.py index 9a80134..375823d 100644 --- a/octoprint_CR10_Leveling/__init__.py +++ b/octoprint_CR10_Leveling/__init__.py @@ -40,11 +40,11 @@ def on_after_startup(self): def get_settings_defaults(self): return dict(bed_temp=50, nozzle_temp=170, play_tune=True, - front_left_x=30, front_left_y=30, front_right_x=270, - front_right_y=30, back_left_x=30, back_left_y=270, - back_right_x=270, back_right_y=270, center_x=150, - center_y=150, lower_z=0, upper_z=10, feed_rate=3600, - heat_simultaneously=False) + wait_for_heat=True, front_left_x=30, front_left_y=30, + front_right_x=270, front_right_y=30, back_left_x=30, + back_left_y=270, back_right_x=270, back_right_y=270, + center_x=150, center_y=150, lower_z=0, upper_z=10, + feed_rate=3600, heat_simultaneously=False) def get_template_configs(self): return [dict(type="settings", custom_bindings=False)] diff --git a/octoprint_CR10_Leveling/static/cr10leveling.js b/octoprint_CR10_Leveling/static/cr10leveling.js index 60e03bb..1f9b29d 100644 --- a/octoprint_CR10_Leveling/static/cr10leveling.js +++ b/octoprint_CR10_Leveling/static/cr10leveling.js @@ -30,7 +30,7 @@ $(function() { [{'width': '11', 'output': 'WARNING: DO NOT USE CONTROLS WITHOUT HOMING FIRST!!!'}, {'width': '11', 'output': 'If you changed settings, make sure you refresh the page'}, {'width': '11', 'commands': - ['M190 S' + settings.bed_temp(), 'M109 S' + settings.nozzle_temp()], + [], 'customClass': 'btn btn-danger', 'name': 'Apply Heat', 'offset': '2'}, {'width': '2', 'commands': ['G90', 'G0 Z' + settings.upper_z() + 'F500', 'G0 X' + @@ -61,12 +61,15 @@ $(function() { var finalSettings = baseSettings; - if (settings.play_tune()) { - applyTune(finalSettings); + if (settings.wait_for_heat()) { + waitForHeat(finalSettings); } - if (settings.heat_simultaneously()) { + if (settings.heat_simultaneously() || !settings.wait_for_heat()) { applySimultaneousHeat(finalSettings); } + if (settings.play_tune()) { + applyTune(finalSettings); + } return finalSettings; } @@ -89,8 +92,15 @@ $(function() { 'M300 S1975 P100') } + function waitForHeat(currentSettings) { + var settings = self.settings.settings.settings.plugins.CR10_Leveling; + var heatCommand = currentSettings[0].children[2].commands; + + heatCommand.push('M190 S' + settings.bed_temp(), 'M109 S' + settings.nozzle_temp()); + } + function applySimultaneousHeat(currentSettings) { - var settings = self.settings.settings.settings.plugins.CR10_Leveling + var settings = self.settings.settings.settings.plugins.CR10_Leveling; var heatCommand = currentSettings[0].children[2].commands; heatCommand.unshift('M140 S' + settings.bed_temp(), 'M104 S' + settings.nozzle_temp()); diff --git a/octoprint_CR10_Leveling/templates/CR10_Leveling_settings.jinja2 b/octoprint_CR10_Leveling/templates/CR10_Leveling_settings.jinja2 index daed65d..177e900 100644 --- a/octoprint_CR10_Leveling/templates/CR10_Leveling_settings.jinja2 +++ b/octoprint_CR10_Leveling/templates/CR10_Leveling_settings.jinja2 @@ -20,8 +20,11 @@ Email: electr0sheep@electr0sheep.com