Skip to content

Commit

Permalink
✨ Port selection (#326)
Browse files Browse the repository at this point in the history
* Found a typo

* add feature on selecting brain based on brains' unique ID
  • Loading branch information
Rocky14683 authored Feb 16, 2024
1 parent 18fb090 commit 3998579
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions pros/cli/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,13 @@ def resolve_v5_port(port: Optional[str], type: str, quiet: bool = False) -> Tupl
return None, False
if len(ports) > 1:
if not quiet:
port = click.prompt('Multiple {} ports were found. Please choose one: [{}]'
.format('v5', '|'.join([p.device for p in ports])),
default=ports[0].device,
brain_id = click.prompt('Multiple {} Brains were found. Please choose one to upload the program: [{}]'
.format('v5', ' | '.join([p.product.split(' ')[-1] for p in ports])),
default=ports[0].product.split(' ')[-1],
show_default=False,
type=click.Choice([p.device for p in ports]))
type=click.Choice([p.description.split(' ')[-1] for p in ports]))
port = [p.device for p in ports if p.description.split(' ')[-1] == brain_id][0]

assert port in [p.device for p in ports]
else:
return None, False
Expand Down
2 changes: 1 addition & 1 deletion pros/cli/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def __str__(self):
result.append(PortReport('VEX EDR V5 System Ports', ports, 'v5/system'))

ports = find_v5_ports('User')
result.append(PortReport('VEX EDR V5 User ports', ports, 'v5/user'))
result.append(PortReport('VEX EDR V5 User Ports', ports, 'v5/user'))
if target == 'cortex' or target is None:
ports = find_cortex_ports()
result.append(PortReport('VEX EDR Cortex Microcontroller Ports', ports, 'cortex'))
Expand Down

0 comments on commit 3998579

Please sign in to comment.