feat(boards): Support board revisions in setup scripts.

* Make setup.sh/ps1 prompt for board revision for boards that have revisions
This commit is contained in:
zhiayang
2024-03-30 19:12:37 -04:00
committed by GitHub
parent fff1cbecdc
commit 4bef4e98f5
3 changed files with 78 additions and 1 deletions

View File

@@ -131,6 +131,19 @@ if ($keyboard_type -eq "shield") {
{{/boards}}
}
$boards_revisions = [ordered]@{
{{#boards}}
{{id}} = @({{#revisions}}
"{{.}}"{{/revisions}});
{{/boards}}
}
$boards_default_revision=[ordered]@{
{{#boards}}
{{id}} = "{{{default_revision}}}";
{{/boards}}
}
Write-Host "$title"
Write-Host ""
Write-Host "MCU Board Selection:"
@@ -145,6 +158,22 @@ if ($keyboard_type -eq "shield") {
$shields = $keyboard_siblings
$board = $($($boards.keys)[$choice])
$boards = ( $board )
if ($($($boards_revisions.values)[$choice]).count -gt 0) {
$valid_revisions = $($($boards_revisions.values)[$choice])
$revision_choices = @() + $valid_revisions
for ($i = 0; $i -lt $valid_revisions.count; $i += 1) {
if ($valid_revisions[$i] -eq $($($boards_default_revision.values)[$choice])) {
$revision_choices[$i] += " (default)"
}
}
$revision_choice = Get-Choice-From-Options -Options $revision_choices -Prompt $prompt
$board = $board + "@" + $valid_revisions[$revision_choice]
$boards = ( $board )
}
} else {
$boards = ( $keyboard_siblings )
$shields = @( )