diff --git a/ner_environment/build_system/build_system.py b/ner_environment/build_system/build_system.py index 94cd7df..6ffc695 100644 --- a/ner_environment/build_system/build_system.py +++ b/ner_environment/build_system/build_system.py @@ -163,17 +163,12 @@ def flash(ftdi: bool = typer.Option(False, "--ftdi", help="Set this flag if the @app.command(help="Open UART terminal of conneced device") def serial(list: bool = typer.Option(False, "--list", help="Specify the device to connect or disconnect (e.g., /dev/ttyACM0,/dev/ttyUSB0,/dev/ttyUSB1,COM1)"), - device: str = typer.Option(None, "--device", "-d", help="Specify the board to connect to")): - - if device: - dev = device - else: - dev = None + device: str = typer.Option("", "--device", "-d", help="Specify the board to connect to")): if list: - miniterm(list=True, device=dev) + miniterm(list=True, device=device) else: - miniterm(list=False, device=dev) + miniterm(device=device) # ============================================================================== # Update command diff --git a/ner_environment/build_system/miniterm.py b/ner_environment/build_system/miniterm.py index de614e7..d8204bd 100644 --- a/ner_environment/build_system/miniterm.py +++ b/ner_environment/build_system/miniterm.py @@ -42,9 +42,9 @@ def run_miniterm(device, baudrate=115200): print(f"Failed to run pyserial-miniterm: {e}", file=sys.stderr) sys.exit(1) -def main(list=False, device=None): +def main(list=False, device=""): # Detect the operating system and find USB devices - if not device: + if device == "": # reverse so FTDI is the default if present, can always be overridden devices = list(reversed(list_usb_devices()))