ZebusJesus / Meshtastic-PyGUI

Python Based GUI that uses the Meshtastic API
MIT License
25 stars 6 forks source link

`--port` Meshtastic API flag is not honored #10

Open danmandle opened 3 years ago

danmandle commented 3 years ago

On MacOS, when running python3 -m meshtastic_pygui --port /dev/tty.SLAB_USBtoUART, the --port flag is not honored. When clicking any of of the GUI buttons, nothing happens and the follow error is displayed in the terminal. I don't see a way in the GUI to specify which serial device to use.

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/bin/meshtastic", line 10, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/meshtastic/__main__.py", line 616, in main
    common()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/meshtastic/__main__.py", line 469, in common
    args.port, debugOut=logfile, noProto=args.noproto)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/meshtastic/__init__.py", line 887, in __init__
    f"Multiple ports detected, you must specify a device, such as {ports[0]}")
Exception: Multiple ports detected, you must specify a device, such as /dev/cu.SLAB_USBtoUART
ZebusJesus commented 3 years ago

Thank you for the feedback I really appreciate it! I don't own an OSX system so I need to get an old Mac Mini or something as it seems there are a handful of differences between Windows and Linux and BSD which I do test on. It appears OSX cares about ports more than the others so this is helpful.

Currently specifying a port is not supported and is being added. Pyserial auto-detects serial devices and handles the connection so you will not need to specify a port to launch the GUI, there will be an option to specify in the GUI which port to attached to commands allowing commands to be sent to multiple ports if you want.

I realized there may be Ham-Radio operators that are also using serial devices and I know that it also an issue for them and I am working on device type filters for future releases.

ZebusJesus commented 3 years ago

I have added the ability to specify a port in the options window. You do not need to specify the port at launch as this will allow you to have multiple devices connected and be able to specify wich one you want a setting to be sent to.