Skip to content

Commit

Permalink
add auto connect time option
Browse files Browse the repository at this point in the history
  • Loading branch information
Stéphane committed Nov 30, 2020
1 parent fcd2b8f commit 445ff17
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion octoprint_phom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def get_settings_defaults(self):
auto_off_bed_temp = 60,
auto_off_nozzle_temp = 50,
auto_connect = False,
auto_connect_time = 5,
security_connection_lost = False,
security_emergency_stop = True,
security_nozzle_temp = 250,
Expand Down Expand Up @@ -62,7 +63,8 @@ def get_template_vars(self):
auto_off=self._settings.get(["auto_off"]),
auto_off_bed_temp=self._settings.get(["auto_off_bed_temp"]),
auto_off_nozzle_temp=self._settings.get(["auto_off_nozzle_temp"]),
auto_connect=self._settings.get(['auto_connect'])
auto_connect=self._settings.get(['auto_connect']),
auto_connect_time=self._settings.get(['auto_connect_time'])
)

def get_template_configs(self):
Expand Down
2 changes: 1 addition & 1 deletion octoprint_phom/templates/ophom_navbar.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
body : JSON.stringify({command: "connect"}),
headers: { 'Content-Type': 'application/json'}
});
}, 5000)
}, Number(data.plugins.ophom.auto_connect_time) * 1000)
}
})
})
Expand Down
14 changes: 13 additions & 1 deletion octoprint_phom/templates/ophom_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,21 @@ Hue Bridge Status: <span id="ophom_generalstatus" class="badge badge-danger" sty

<label class="checkbox" disabled>
<input type="checkbox" value="" data-bind="checked: settings.plugins.ophom.auto_connect">
Try to connect to printer after power On the plug ? (~5sec)
Try to connect to printer after power On the plug ?
</label>

<table>
<tr>
<td>Time to wait before auto connect: </td>
<td>
<div class="input-append">
<input class="span3 controls" id="auto_connect_time" type="text" data-bind="value: settings.plugins.ophom.auto_connect_time">
<span class="add-on">sec</span>
</div>
</td>
</tr>
</table>

<br />

<div class="well">
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 = "Ophom"

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

# 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 445ff17

Please sign in to comment.