Skip to content

Commit

Permalink
Merge pull request #115 from gdombiak/dev
Browse files Browse the repository at this point in the history
Merge changes for release 0.3.8
  • Loading branch information
gdombiak authored Aug 28, 2021
2 parents d972949 + a819dcd commit a361252
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 23 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ You can test the configuration before saving it by using the _Send test notifica

## Changelog

**[0.3.8]** (08/28/2021)
- Use Marlin defaults to prevent false thermal runaway alerts. Defaults are also configurable from UI. Thanks bonjipoo
- Migration error thrown on fresh install with latest OctoPi install and Python 3. Thanks Pizzahd88

**[0.3.7]** (08/25/2021)
- NEW: Send notification with picture for first X (up to 10) layers for early catch of failed prints. Requires DisplayLayerProgress plugin
- NEW: Added Chinese simplified(简体中文)Translation. Thanks 零更酱 / clementatt
Expand Down Expand Up @@ -125,6 +129,7 @@ You can test the configuration before saving it by using the _Send test notifica
**[0.1.2]** (05/28/2019)
- Initial Release

[0.3.8]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.3.8
[0.3.7]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.3.7
[0.3.6]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.3.6
[0.3.5]: https://github.com/gdombiak/OctoPrint-OctoPod/tree/0.3.5
Expand Down
34 changes: 19 additions & 15 deletions octoprint_octopod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ def get_settings_defaults(self):
thermal_runway_threshold=10,
thermal_threshold_minutes_frequency=10,
thermal_cooldown_seconds_threshold=14,
thermal_warmup_seconds_threshold=9,
thermal_warmup_bed_seconds_threshold=19,
thermal_warmup_hotend_seconds_threshold=39,
thermal_warmup_chamber_seconds_threshold=19,
thermal_below_target_threshold=5,
webcam_flipH=False,
webcam_flipV=False,
Expand All @@ -130,54 +132,56 @@ def get_settings_version(self):
return 13

def on_settings_migrate(self, target, current):
if current == 1:
if current is None or current == 1:
# add the 2 new values included
self._settings.set(['temp_interval'], self.get_settings_defaults()["temp_interval"])
self._settings.set(['bed_low'], self.get_settings_defaults()["bed_low"])

if current <= 2:
if current is None or current <= 2:
self._settings.set(['bed_target_temp_hold'], self.get_settings_defaults()["bed_target_temp_hold"])

if current <= 3:
if current is None or current <= 3:
self._settings.set(['mmu_interval'], self.get_settings_defaults()["mmu_interval"])

if current <= 4:
if current is None or current <= 4:
self._settings.set(['pause_interval'], self.get_settings_defaults()["pause_interval"])

if current <= 5:
if current is None or current <= 5:
self._settings.set(['tool0_low'], self.get_settings_defaults()["tool0_low"])

if current <= 6:
if current is None or current <= 6:
self._settings.set(['palette2_printing_error_codes'],
self.get_settings_defaults()["palette2_printing_error_codes"])

if current <= 7:
if current is None or current <= 7:
self._settings.set(['progress_type'], self.get_settings_defaults()["progress_type"])

if current <= 8:
if current is None or current <= 8:
self._settings.set(['ifttt_key'], self.get_settings_defaults()["ifttt_key"])
self._settings.set(['ifttt_name'], self.get_settings_defaults()["ifttt_name"])

if current <= 9:
if current is None or current <= 9:
self._settings.set(['soc_temp_high'], self.get_settings_defaults()["soc_temp_high"])
self._settings.set(['webcam_flipH'], self._settings.global_get(["webcam", "flipH"]))
self._settings.set(['webcam_flipV'], self._settings.global_get(["webcam", "flipV"]))
self._settings.set(['webcam_rotate90'], self._settings.global_get(["webcam", "rotate90"]))

if current <= 10:
if current is None or current <= 10:
self._settings.set(['tool0_target_temp'], self.get_settings_defaults()["tool0_target_temp"])

if current <= 11:
if current is None or current <= 11:
self._settings.set(['thermal_runway_threshold'], self.get_settings_defaults()["thermal_runway_threshold"])
self._settings.set(['thermal_threshold_minutes_frequency'], self.get_settings_defaults()["thermal_threshold_minutes_frequency"])
self._settings.set(['sound_notification'], self.get_settings_defaults()["sound_notification"])

if current <= 12:
if current is None or current <= 12:
self._settings.set(['thermal_cooldown_seconds_threshold'], self.get_settings_defaults()["thermal_cooldown_seconds_threshold"])
self._settings.set(['thermal_below_target_threshold'], self.get_settings_defaults()["thermal_below_target_threshold"])
self._settings.set(['thermal_warmup_seconds_threshold'], self.get_settings_defaults()["thermal_warmup_seconds_threshold"])
self._settings.set(['thermal_warmup_bed_seconds_threshold'], self.get_settings_defaults()["thermal_warmup_bed_seconds_threshold"])
self._settings.set(['thermal_warmup_hotend_seconds_threshold'], self.get_settings_defaults()["thermal_warmup_hotend_seconds_threshold"])
self._settings.set(['thermal_warmup_chamber_seconds_threshold'], self.get_settings_defaults()["thermal_warmup_chamber_seconds_threshold"])

if current <= 13:
if current is None or current <= 13:
self._settings.set(['notify_first_X_layers'], self.get_settings_defaults()["notify_first_X_layers"])

# AssetPlugin mixin
Expand Down
19 changes: 19 additions & 0 deletions octoprint_octopod/static/css/octopod.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,22 @@ label.radio_label {
display: inline;
padding-right: 10px;
}

/* Solid border */
hr.solid {
border-top: 1px solid #bbb;
}

.form-horizontal .control-label {
width: 260px;
padding-right: 10px;
}

.radio input[type="radio"], .checkbox input[type="checkbox"] {
margin-left: 0;
margin-right: 5px;
}

#server_url_label, #snapshot_url_label, #progress_notification_label {
width: 160px;
}
48 changes: 42 additions & 6 deletions octoprint_octopod/templates/octopod_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<p>{{ _('Complete URLs below so that OctoPrint can send notifications to OctoPod once print is finished') }}</p>

<div class="control-group">
<label class="control-label">{{ _('Notification Server URL') }}</label>
<label class="control-label" id="server_url_label">{{ _('Notification Server URL') }}</label>
<div class="controls">
<input type="text" class="input-block-level" id="server_url" data-bind="value: settings.plugins.octopod.server_url">
<span class="help-inline">{{ _('Enter URL address to the OctoPod server that sends Apple Push Notifications') }}</span>
Expand All @@ -22,7 +22,7 @@

<div class="control-group">
<!-- <label class="control-label">{{ _('Snapshot URL') }}</label> -->
<label class="control-label">Snapshot URL</label>
<label class="control-label" id="snapshot_url_label">Snapshot URL</label>
<div class="controls">
<input type="text" class="input-block-level" id="camera_snapshot_url" data-bind="value: settings.plugins.octopod.camera_snapshot_url">
<span class="help-inline">{{ _('Enter URL address that provides an image snapshot that will be included in the notification') }}</span>
Expand All @@ -45,7 +45,7 @@
</div>

<div class="control-group">
<label class="control-label">{{ _('Progress Notification') }}</label>
<label class="control-label" id="progress_notification_label">{{ _('Progress Notification') }}</label>
<div class="controls">
<input class="radio" type="radio" id="progress_type1" data-bind="checked: settings.plugins.octopod.progress_type" value="0">
<label class="radio_label" for="progress_type1">{{ _('Disabled') }}</label>
Expand Down Expand Up @@ -82,6 +82,8 @@
</div>
</div>

<hr class="solid">

<h4>{{ _('Layer Notifications') }}</h4>

<p>{{ _('Receive a notification with an image for the first X layers to confirm print started fine. A value of 0 will disable the notifications below. From OctoPod app you can also
Expand All @@ -93,6 +95,8 @@
</div>
</div>

<hr class="solid">

<h4>{{ _('Extruder Notifications') }}</h4>

<p>{{ _('When extruder temperature falls below threshold once done printing, OctoPrint will send notification. A value of 0 will disable the notifications below') }}</p>
Expand All @@ -112,6 +116,8 @@
</label>
</div>

<hr class="solid">

<h4>{{ _('Bed Notifications') }}</h4>

<p>{{ _('When bed temperature falls below threshold once done printing, OctoPrint will send notification. A value of 0 will disable the notifications below') }}</p>
Expand All @@ -131,6 +137,8 @@
</div>
</div>

<hr class="solid">

<h4>{{ _('Printer Paused Notifications') }}</h4>

<p>{{ _('When current print job was paused waiting for user, OctoPrint will send notification. Useful when running
Expand All @@ -155,6 +163,8 @@
</div>
</div>

<hr class="solid">

<h4>{{ _('System On a Chip (SoC) Notifications') }}</h4>

<p>{{ _('When SoC temperature goes above threshold, OctoPrint will send notification. New single-board computers like RPi 4 tend to run hot. A value of 0
Expand All @@ -166,23 +176,49 @@
</div>
</div>

<hr class="solid">

<h4>{{ _('Thermal Protection') }}</h4>

<p>{{ _('Receive a notification when possible thermal runaway was detected based on actual and target temperatures. Protection covers bed, hotends and chamber. A value of 0 will disable the notifications below') }}</p>
<label class="control-label">{{ _('Temperature difference') }}</label>
<p>{{ _('Receive a notification when possible thermal runaway was detected based on actual and target temperatures. Protection covers bed, hotends and chamber. A value of 0 for \'Max Temperature difference\' will disable the notifications below') }}</p>

<label class="control-label">{{ _('Max Temperature difference') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" class="input-mini text-right" id="thermal_runway_threshold" data-bind="value: settings.plugins.octopod.thermal_runway_threshold" min="0" max="20" step="1" value="10"><span class="add-on">&deg;C</span>
</div>
</div>

<label class="control-label">{{ _('Bed should increase temp in') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" class="input-mini text-right" id="thermal_warmup_bed_seconds_threshold" data-bind="value: settings.plugins.octopod.thermal_warmup_bed_seconds_threshold" min="9" max="59" step="5" value="19"><span class="add-on">{{ _('seconds') }}</span>
</div>
</div>

<label class="control-label">{{ _('Hotend should increase temp in') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" class="input-mini text-right" id="thermal_warmup_hotend_seconds_threshold" data-bind="value: settings.plugins.octopod.thermal_warmup_hotend_seconds_threshold" min="9" max="79" step="5" value="39"><span class="add-on">{{ _('seconds') }}</span>
</div>
</div>

<label class="control-label">{{ _('Chamber should increase temp in') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" class="input-mini text-right" id="thermal_warmup_chamber_seconds_threshold" data-bind="value: settings.plugins.octopod.thermal_warmup_chamber_seconds_threshold" min="9" max="59" step="5" value="19"><span class="add-on">{{ _('seconds') }}</span>
</div>
</div>

<label class="control-label">{{ _('Delay between notifications') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" class="input-mini text-right" id="thermal_threshold_minutes_frequency" data-bind="value: settings.plugins.octopod.thermal_threshold_minutes_frequency" min="5" max="30" step="1" value="10"><span class="add-on">{{ _('Minutes') }}</span>
<input type="number" class="input-mini text-right" id="thermal_threshold_minutes_frequency" data-bind="value: settings.plugins.octopod.thermal_threshold_minutes_frequency" min="5" max="30" step="1" value="10"><span class="add-on">{{ _('minutes') }}</span>
</div>
</div>

<hr class="solid">

<div class="control-group">
<div class="controls">
<label class="checkbox">
Expand Down
9 changes: 8 additions & 1 deletion octoprint_octopod/thermal_protection_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __check_thermal_runway(self, temps, part, thermal_threshold, settings):
# already perform this check but some printers still have thermal runaway disabled so this
# check can save those printers from catching fire
below_target_threshold = settings.get_int(['thermal_below_target_threshold'])
warmup_threshold = settings.get_int(['thermal_warmup_seconds_threshold'])
warmup_threshold = self.__get_warmup_threshold(settings, part)
# Check if below target temp. Use range to say that it is below target
if actual_temp + below_target_threshold < target_temp:
if not self.__get_last_actual_temp(part):
Expand Down Expand Up @@ -216,3 +216,10 @@ def __get_last_target_temp_time(self, part):
tuple = self._last_target_temps.get(part)
return tuple[1] if tuple else None

def __get_warmup_threshold(self, settings, part):
if part == 'bed':
return settings.get_int(['thermal_warmup_bed_seconds_threshold'])
elif part.startswith('tool'):
return settings.get_int(['thermal_warmup_hotend_seconds_threshold'])
else:
return settings.get_int(['thermal_warmup_chamber_seconds_threshold'])
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 = "OctoPrint-OctoPod"

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

# 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 a361252

Please sign in to comment.