Skip to content

Commit

Permalink
wait for heat is now optional
Browse files Browse the repository at this point in the history
  • Loading branch information
electr0sheep committed Apr 20, 2018
1 parent ea802df commit 0fd4bd9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.DS_Store
.pyc
CR_10_Leveling.egg-info/
octoprint_CR10_Leveling/__init__.pyc
10 changes: 5 additions & 5 deletions octoprint_CR10_Leveling/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
20 changes: 15 additions & 5 deletions octoprint_CR10_Leveling/static/cr10leveling.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' +
Expand Down Expand Up @@ -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;
}

Expand All @@ -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());
Expand Down
13 changes: 11 additions & 2 deletions octoprint_CR10_Leveling/templates/CR10_Leveling_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ Email: [email protected]

<div style="background-color: #d9534f; color: #fff; margin: 10px; padding: 10px; border-radius: 4px">
Warning: Please home your printer before using the buttons, failing to do so
can cause the printer head to go out-of-bounds. There is a fix for this in the
works, but it is not complete yet.
can cause the printer head to go out-of-bounds. <s>There is a fix for this in the
works, but it is not complete yet.</s> 04/19/2018 UPDATE: The OctoPrint core
exhibits the same behavior. Therefore, forcing the user to home before using
this plugin is beyond its scope. This issue won't be fixed in the forseeable
future.
</div>
<div style="background-color: #5bc0de; color: #fff; margin: 10px; padding: 10px; border-radius: 4px">
After saving these settings, please refresh the page to update the control
Expand Down Expand Up @@ -65,6 +68,12 @@ Email: [email protected]
<input type="checkbox" data-bind="checked: settings.plugins.CR10_Leveling.heat_simultaneously">
</div>
</div>
<div class="control-group">
<label class="control-label">Wait for heating to finish (if unchecked, bed and nozzle will heat simultaneously):</label>
<div class="controls">
<input type="checkbox" data-bind="checked: settings.plugins.CR10_Leveling.wait_for_heat">
</div>
</div>
<div class="control-group">
<label class="control-label">Play post-heat tune:</label>
<div class="controls">
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 = "CR-10 Leveling"

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

# 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 0fd4bd9

Please sign in to comment.