Skip to content

Commit

Permalink
possible miniterm fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dyldonahue committed Oct 16, 2024
1 parent 700c708 commit 9b46732
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 3 additions & 8 deletions ner_environment/build_system/build_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ner_environment/build_system/miniterm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()))

Expand Down

0 comments on commit 9b46732

Please sign in to comment.