Skip to content

Implemented pluggable discovery board matching #1330

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

Merged
merged 4 commits into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixed docs and linter warnings
  • Loading branch information
cmaglie committed Jun 21, 2021
commit c412f6c1b0402db16a7775ce24bb8dc45a7f9911
12 changes: 7 additions & 5 deletions arduino/cores/board.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ func (b *Board) GeneratePropertiesForConfiguration(config string) (*properties.M
return b.GetBuildProperties(fqbn.Configs)
}

func (b *Board) IsBoardMatchingIdProperties(query *properties.Map) bool {
portIdPropsSet := b.Properties.SubTree("upload_port")
if portIdPropsSet.Size() == 0 {
// IsBoardMatchingIDProperties returns true if the board match the given
// identification properties
func (b *Board) IsBoardMatchingIDProperties(query *properties.Map) bool {
portIDPropsSet := b.Properties.SubTree("upload_port")
if portIDPropsSet.Size() == 0 {
return false
}

Expand All @@ -158,7 +160,7 @@ func (b *Board) IsBoardMatchingIdProperties(query *properties.Map) bool {
idx := 0
haveIndexedProperties := false
for {
idProps := portIdPropsSet.SubTree(fmt.Sprintf("%d", idx))
idProps := portIDPropsSet.SubTree(fmt.Sprintf("%d", idx))
idx++
if idProps.Size() > 0 {
haveIndexedProperties = true
Expand All @@ -172,7 +174,7 @@ func (b *Board) IsBoardMatchingIdProperties(query *properties.Map) bool {
}

if !haveIndexedProperties {
return check(portIdPropsSet)
return check(portIDPropsSet)
}

return false
Expand Down
2 changes: 1 addition & 1 deletion arduino/cores/packagemanager/identify.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (pm *PackageManager) IdentifyBoard(idProps *properties.Map) []*cores.Board
}
foundBoards := []*cores.Board{}
for _, board := range pm.InstalledBoards() {
if board.IsBoardMatchingIdProperties(idProps) {
if board.IsBoardMatchingIDProperties(idProps) {
foundBoards = append(foundBoards, board)
}
}
Expand Down