Skip to content

Wrong COM Port Selected #2

@turfptax

Description

@turfptax

I had a few COM Port devices plugged in and the parse_plot_data.py selected the wrong one. I adjusted the code in parse_plot_data.py to include an option to select the COM port from the listed COM ports:

def select_port(port):
    devices = []
    port_selected = False
    for i,p in enumerate(port):
        print(i,p.device)
        #device = p.device
        devices.append(p.device)
    while not port_selected:
        selected_port = input('Please Enter Port Number')
        try:
            device = devices[int(selected_port)]
            port_selected = True
        except:
            print(f'Error please enter an integer within range of 0 - {len(devices)}')
    print("===")
    print(f'{device} selected')
    return(device)

# list
from serial.tools import list_ports
port = list(list_ports.comports())
print("available ports:")
device = select_port(port)```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions