Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ All support related questions will be closed.
Feature requests should be made at:
https://feathub.com/kantlivelong/OctoPrint-PSUControl

When reporting a bug do NOT delete ANY lines from the template.
When reporting a bug do NOT delete ANY lines from the template or exclude
any information unless otherwise noted.
Failure to follow this will result in the ticket being closed and locked.

Make sure any bug you want to report is still present with the CURRENT
OctoPrint-PSUControl version.
Expand Down
14 changes: 9 additions & 5 deletions octoprint_psucontrol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def get_settings_defaults(self):
pseudoOnGCodeCommand = 'M80',
pseudoOffGCodeCommand = 'M81',
postOnDelay = 0.0,
postConnectDelay = 0.0,
connectOnPowerOn = False,
disconnectOnPowerOff = False,
sensingMethod = 'INTERNAL',
Expand Down Expand Up @@ -508,13 +509,16 @@ def turn_psu_on(self):
time.sleep(0.1 + self.config['postOnDelay'])

self.check_psu_state()

threading.Timer(self.config['postConnectDelay'], self.connect_printer).start()
Comment thread
Gifford47 marked this conversation as resolved.

if self.config['connectOnPowerOn'] and self._printer.is_closed_or_error():
self._printer.connect()
time.sleep(0.1)
def connect_printer(self):
if self.config['connectOnPowerOn'] and self._printer.is_closed_or_error():
self._printer.connect()
time.sleep(0.1)

if not self._printer.is_closed_or_error():
self._printer.script("psucontrol_post_on", must_be_set=False)
if not self._printer.is_closed_or_error():
self._printer.script("psucontrol_post_on", must_be_set=False)


def turn_psu_off(self):
Expand Down
11 changes: 11 additions & 0 deletions octoprint_psucontrol/templates/psucontrol_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,17 @@
</label>
</div>
</div>
<!-- ko if: settings.plugins.psucontrol.connectOnPowerOn() -->
<div class="control-group">
<label class="control-label">Post Connect Delay</label>
<div class="controls">
<div class="input-append">
<input type="number" min="0" step="0.1" class="input-mini text-right" data-bind="value: settings.plugins.psucontrol.postConnectDelay">
<span class="add-on">sec</span>
</div>
</div>
</div>
<!-- /ko -->
<div class="control-group">
<div class="controls">
<label class="checkbox">
Expand Down