File tree 3 files changed +78
-1
lines changed
3 files changed +78
-1
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,19 @@ if ($keyboard_type -eq "shield") {
131
131
{ {/boards} }
132
132
}
133
133
134
+ $boards_revisions = [ordered]@{
135
+ {{#boards} }
136
+ { {id} } = @({ {#revisions} }
137
+ "{ {.} }"{ {/revisions} });
138
+ { {/boards} }
139
+ }
140
+
141
+ $boards_default_revision=[ordered]@{
142
+ {{#boards} }
143
+ { {id} } = "{ {{default_revision} }}";
144
+ { {/boards} }
145
+ }
146
+
134
147
Write-Host "$title"
135
148
Write-Host ""
136
149
Write-Host "MCU Board Selection:"
@@ -145,6 +158,22 @@ if ($keyboard_type -eq "shield") {
145
158
$shields = $keyboard_siblings
146
159
$board = $($($boards.keys)[$choice])
147
160
$boards = ( $board )
161
+
162
+ if ($($($boards_revisions.values)[$choice]).count -gt 0) {
163
+ $valid_revisions = $($($boards_revisions .values)[$choice ])
164
+ $revision_choices = @() + $valid_revisions
165
+
166
+ for ($i = 0; $i -lt $valid_revisions .count; $i += 1) {
167
+ if ($valid_revisions [$i ] -eq $($($boards_default_revision .values)[$choice ])) {
168
+ $revision_choices [$i ] += " (default)"
169
+ }
170
+ }
171
+
172
+ $revision_choice = Get-Choice-From-Options -Options $revision_choices -Prompt $prompt
173
+ $board = $board + "@" + $valid_revisions[$revision_choice]
174
+ $boards = ( $board )
175
+ }
176
+
148
177
} else {
149
178
$boards = ( $keyboard_siblings )
150
179
$shields = @( )
Original file line number Diff line number Diff line change @@ -122,6 +122,9 @@ if [ "$keyboard_shield" == "y" ]; then
122
122
board_ids=({{# boards}}"{{id}}" {{/boards}})
123
123
boards_usb_only=({{# boards}}"{{#usb_only}}y{{/usb_only}}{{^usb_only}}n{{/usb_only}}" {{/boards}})
124
124
125
+ boards_revisions=({{# boards}}"{{#revisions}}{{.}} {{/revisions}}" {{/boards}})
126
+ boards_default_revision=({{# boards}}"{{{default_revision}}}" {{/boards}})
127
+
125
128
echo " "
126
129
echo " MCU Board Selection:"
127
130
PS3=" $prompt "
@@ -151,6 +154,38 @@ if [ "$keyboard_shield" == "y" ]; then
151
154
152
155
esac
153
156
done
157
+
158
+ if [ -n " ${boards_revisions[$board_index]} " ]; then
159
+ read -a _valid_revisions <<< " ${boards_revisions[$board_index]}"
160
+
161
+ _rev_choices=(" ${_valid_revisions[@]} " )
162
+ for (( _i= 0 ; _i< ${# _valid_revisions} ; _i++ )) ; do
163
+ if [ " ${boards_default_revision[board_index]} " = " ${_valid_revisions[_i]} " ]; then
164
+ _rev_choices[_i]+=" (default)"
165
+ fi
166
+ done
167
+
168
+ echo " "
169
+ echo " MCU Board Revision:"
170
+ select opt in " ${_rev_choices[@]} " " Quit" ; do
171
+ case " $REPLY " in
172
+ ' ' |* [!0-9]* ) echo " Invalid option. Try another one." ; continue ;;
173
+
174
+ $(( ${# _valid_revisions[@]} + 1 )) ) echo " Goodbye!" ; exit 1;;
175
+ * )
176
+ if [ $REPLY -gt $(( ${# _valid_revisions[@]} + 1 )) ] || [ $REPLY -lt 0 ]; then
177
+ echo " Invalid option. Try another one."
178
+ continue
179
+ fi
180
+
181
+ _rev_index=$(( $REPLY - 1 ))
182
+ board=" ${board_ids[$board_index]} @${_valid_revisions[_rev_index]} "
183
+ boards=( " ${board} " )
184
+ break
185
+ ;;
186
+ esac
187
+ done
188
+ fi
154
189
else
155
190
board=${keyboard}
156
191
boards=$keyboard_siblings
Original file line number Diff line number Diff line change 16
16
"$defs" : {
17
17
"id" : {
18
18
"type" : " string" ,
19
- "pattern" : " ^[a-z0-9_]+$"
19
+ "pattern" : " ^[a-z0-9_]+(@([A-Z]|[0-9]+|([0-9]+(\\ .[0-9]+){1,2})))?$"
20
+ },
21
+ "revision" : {
22
+ "type" : " string" ,
23
+ "pattern" : " [A-Z]|[0-9]+|([0-9]+(\\ .[0-9]+){1,2})"
20
24
},
21
25
"keyboard_siblings" : {
22
26
"type" : " array" ,
202
206
},
203
207
"exposes" : {
204
208
"$ref" : " #/$defs/interconnects"
209
+ },
210
+ "revisions" : {
211
+ "type" : " array" ,
212
+ "items" : {
213
+ "$ref" : " #/$defs/revision"
214
+ }
215
+ },
216
+ "default_revision" : {
217
+ "$ref" : " #/$defs/revision"
205
218
}
206
219
}
207
220
},
You can’t perform that action at this time.
0 commit comments