Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added 'board details' #67

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
cmaglie merged 8 commits into arduino:master from cmaglie:board-details
Oct 19, 2018
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
2 changes: 1 addition & 1 deletion .drone.yml
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ pipeline:
# Build
- golangci-lint run
- go build
- go test -timeout 20m -v ./... -race
- go test -timeout 20m -v ./...
secrets: [TEST_USERNAME, TEST_PASSWORD]
1 change: 1 addition & 0 deletions Gopkg.lock
View file Open in desktop

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion arduino/cores/board.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ func (b *Board) GetConfigOptionValues(option string) *properties.Map {
res := properties.NewMap()
menu := b.Properties.SubTree("menu").SubTree(option)
for _, value := range menu.FirstLevelKeys() {
res.Set(value, menu.Get(value))
if label, ok := menu.GetOk(value); ok {
res.Set(value, label)
}
}
return res
}
Expand Down
2 changes: 1 addition & 1 deletion arduino/cores/packagemanager/package_manager.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (pm *PackageManager) ResolveFQBN(fqbn *cores.FQBN) (
platformRelease := pm.GetInstalledPlatformRelease(platform)
if platformRelease == nil {
return targetPackage, nil, nil, nil, nil,
fmt.Errorf("platform %s is not installed", platformRelease)
fmt.Errorf("platform %s is not installed", platform)
}

// Find board
Expand Down
42 changes: 42 additions & 0 deletions arduino/cores/packagemanager/package_manager_test.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/arduino/arduino-cli/arduino/cores/packagemanager"
"github.com/arduino/go-paths-helper"
"github.com/arduino/go-properties-orderedmap"
"github.com/stretchr/testify/require"
)

Expand All @@ -43,3 +44,44 @@ func TestFindBoardWithFQBN(t *testing.T) {
require.NotNil(t, board)
require.Equal(t, board.Name(), "Arduino/Genuino Mega or Mega 2560")
}

func TestBoardOptionsFunctions(t *testing.T) {
pm := packagemanager.NewPackageManager(
paths.New("testdata"),
paths.New("testdata"),
paths.New("testdata"),
paths.New("testdata"))
pm.LoadHardwareFromDirectory(paths.New("testdata"))

nano, err := pm.FindBoardWithFQBN("arduino:avr:nano")
require.Nil(t, err)
require.NotNil(t, nano)
require.Equal(t, nano.Name(), "Arduino Nano")

nanoOptions := nano.GetConfigOptions()
require.Equal(t, "Processor", nanoOptions.Get("cpu"))
require.Equal(t, 1, nanoOptions.Size())
nanoCPUValues := nano.GetConfigOptionValues("cpu")

expectedNanoCPUValues := properties.NewMap()
expectedNanoCPUValues.Set("atmega328", "ATmega328P")
expectedNanoCPUValues.Set("atmega328old", "ATmega328P (Old Bootloader)")
expectedNanoCPUValues.Set("atmega168", "ATmega168")
require.EqualValues(t, expectedNanoCPUValues, nanoCPUValues)

esp8266, err := pm.FindBoardWithFQBN("esp8266:esp8266:generic")
require.Nil(t, err)
require.NotNil(t, esp8266)
require.Equal(t, esp8266.Name(), "Generic ESP8266 Module")

esp8266Options := esp8266.GetConfigOptions()
require.Equal(t, 13, esp8266Options.Size())
require.Equal(t, "Builtin Led", esp8266Options.Get("led"))
require.Equal(t, "Upload Speed", esp8266Options.Get("UploadSpeed"))

esp8266UploadSpeedValues := esp8266.GetConfigOptionValues("UploadSpeed")
for k, v := range esp8266UploadSpeedValues.AsMap() {
// Some option values are missing for a particular OS: check that only the available options are listed
require.Equal(t, k, v)
}
}
Loading

AltStyle によって変換されたページ (->オリジナル) /