markwal / OctoPrint-PortLister

An OctoPrint plugin that notices when a new serial port appears and refreshes the port list without a page refresh
GNU Affero General Public License v3.0
26 stars 10 forks source link

Portlistr autoconnects even if connection already exists #8

Open Kunsi opened 7 years ago

Kunsi commented 7 years ago

Portlister should check if there is already an open connection, if yes, it should not autoconnect. Note: It's the same printer, so no real problem, however it may cause confusion in the logs.


2017-06-02 08:48:09,617 - octoprint.plugins.portlister - INFO - Checking if /dev/ttyACM0 is in ['/dev/ttyACM0']
2017-06-02 08:48:09,621 - octoprint.plugins.portlister - INFO - autoconnect_delay 20
2017-06-02 08:48:13,178 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2017-06-02 08:48:13,190 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2017-06-02 08:48:13,211 - octoprint.util.comm - INFO - Printer reports firmware name "Marlin V1; Sprinter/grbl mashup for gen6"
2017-06-02 08:48:29,636 - octoprint.plugins.portlister - INFO - do_auto_connect
2017-06-02 08:48:29,639 - octoprint.plugins.portlister - INFO - realpath match
2017-06-02 08:48:29,642 - octoprint.plugins.portlister - INFO - Attempting to connect to /dev/ttyACM0 at 115200 with profile '_default'
2017-06-02 08:48:30,038 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2017-06-02 08:48:30,077 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2017-06-02 08:48:30,374 - octoprint.util.comm - INFO - Printer reports firmware name "Marlin V1; Sprinter/grbl mashup for gen6"```
markwal commented 7 years ago

https://github.com/markwal/OctoPrint-PortLister/blob/master/octoprint_portlister/__init__.py#L30-L31

markwal commented 7 years ago

Fixed-ish by 0.1.6. There's still a possibility that a connection could have been initiated between the final check added and the reconnect by the plugin, but the window has been reduced dramatically.