Skip to content

Commit

Permalink
Add more logging for diagnosing autoconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
markwal committed Mar 4, 2016
1 parent 5b9e670 commit 8b1a067
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions octoprint_portlister/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ def on_port_created(self, port, *args, **kwargs):
self._logger.info("on_port_created connection_options %s", repr(connection_options))

# is the new device in the port list? yes, tell the view model
self._logger.info("Checking if %s is in %s", port, repr(connection_options["ports"]))
if port in connection_options["ports"]:
self._plugin_manager.send_plugin_message(self._plugin_name, port)

# if autoconnect and the new port matches, try to connect
if self._settings.global_get_boolean(["serial", "autoconnect"]):
self._logger.info("autoconnect_delay %d", self._settings.get(["autoconnect_delay"]))
Timer(self._settings.get(["autoconnect_delay"]), self.do_auto_connect, [port]).start()
else:
self._logger.info("Not autoconnecting because autoconnect is turned off.")
else:
self._logger.warning("Won't autoconnect because %s isn't in %s", port, repr(connection_options["ports"]))
else:
self._logger.warning("Not auto connecting because printer is not closed nor in error state.")

def on_shutdown(self, *args, **kwargs):
self._logger.info("Shutting down file system observer")
Expand Down

0 comments on commit 8b1a067

Please sign in to comment.