Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Port selection #326

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading