Skip to content

Commit 653536c

Browse files
committed
change GetFQBN and SetFQBN function because fqbn.getFQBN was improvable
1 parent a8b6dea commit 653536c

File tree

10 files changed

+22
-22
lines changed

10 files changed

+22
-22
lines changed

cli/arguments/fqbn.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ func (f *Fqbn) AddToCommand(cmd *cobra.Command) {
3232
})
3333
}
3434

35-
// GetFQBN returns the fqbn
36-
func (f *Fqbn) GetFQBN() string {
35+
// String returns the fqbn
36+
func (f *Fqbn) String() string {
3737
return f.fqbn
3838
}
3939

40-
// SetFQBN sets the fqbn
41-
func (f *Fqbn) SetFQBN(fqbn string) {
40+
// Set sets the fqbn
41+
func (f *Fqbn) Set(fqbn string) {
4242
f.fqbn = fqbn
4343
}

cli/board/attach.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ func runAttachCommand(cmd *cobra.Command, args []string) {
6767
// a more meaningful fix would be to fix board.Attach
6868
var boardURI string
6969
discoveryPort, _ := port.GetPort(instance, nil)
70-
if fqbn.GetFQBN() != "" {
71-
boardURI = fqbn.GetFQBN()
70+
if fqbn.String() != "" {
71+
boardURI = fqbn.String()
7272
} else if discoveryPort != nil {
7373
boardURI = discoveryPort.Address
7474
}

cli/board/details.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func runDetailsCommand(cmd *cobra.Command, args []string) {
6363

6464
res, err := board.Details(context.Background(), &rpc.BoardDetailsRequest{
6565
Instance: inst,
66-
Fqbn: fqbn.GetFQBN(),
66+
Fqbn: fqbn.String(),
6767
})
6868

6969
if err != nil {

cli/burnbootloader/burnbootloader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func runBootloaderCommand(command *cobra.Command, args []string) {
7676

7777
if _, err := upload.BurnBootloader(context.Background(), &rpc.BurnBootloaderRequest{
7878
Instance: instance,
79-
Fqbn: fqbn.GetFQBN(),
79+
Fqbn: fqbn.String(),
8080
Port: discoveryPort.ToRPC(),
8181
Verbose: verbose,
8282
Verify: verify,

cli/compile/compile.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
152152

153153
compileRequest := &rpc.CompileRequest{
154154
Instance: inst,
155-
Fqbn: fqbn.GetFQBN(),
155+
Fqbn: fqbn.String(),
156156
SketchPath: sketchPath.String(),
157157
ShowProperties: showProperties,
158158
Preprocess: preprocess,
@@ -188,7 +188,7 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
188188

189189
userFieldRes, err := upload.SupportedUserFields(context.Background(), &rpc.SupportedUserFieldsRequest{
190190
Instance: inst,
191-
Fqbn: fqbn.GetFQBN(),
191+
Fqbn: fqbn.String(),
192192
Protocol: discoveryPort.Protocol,
193193
})
194194
if err != nil {
@@ -204,7 +204,7 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
204204

205205
uploadRequest := &rpc.UploadRequest{
206206
Instance: inst,
207-
Fqbn: fqbn.GetFQBN(),
207+
Fqbn: fqbn.String(),
208208
SketchPath: sketchPath.String(),
209209
Port: discoveryPort.ToRPC(),
210210
Verbose: verbose,

cli/debug/debug.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func runDebugCommand(command *cobra.Command, args []string) {
7777
sketchPath, _, discoveryPort := arguments.SketchPathCalculation(path, port, instance, false)
7878
debugConfigRequested := &dbg.DebugConfigRequest{
7979
Instance: instance,
80-
Fqbn: fqbn.GetFQBN(),
80+
Fqbn: fqbn.String(),
8181
SketchPath: sketchPath.String(),
8282
Port: discoveryPort.ToRPC(),
8383
Interpreter: interpreter,

cli/lib/examples.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func runExamplesCommand(cmd *cobra.Command, args []string) {
6767
Instance: instance,
6868
All: true,
6969
Name: name,
70-
Fqbn: fqbn.GetFQBN(),
70+
Fqbn: fqbn.String(),
7171
})
7272
if err != nil {
7373
feedback.Errorf(tr("Error getting libraries info: %v"), err)

cli/lib/list.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,19 @@ func runListCommand(cmd *cobra.Command, args []string) {
7070
All: all,
7171
Updatable: updatable,
7272
Name: name,
73-
Fqbn: fqbn.GetFQBN(),
73+
Fqbn: fqbn.String(),
7474
})
7575
if err != nil {
7676
feedback.Errorf(tr("Error listing Libraries: %v"), err)
7777
os.Exit(errorcodes.ErrGeneric)
7878
}
7979

8080
libs := []*rpc.InstalledLibrary{}
81-
if fqbn.GetFQBN() == "" {
81+
if fqbn.String() == "" {
8282
libs = res.GetInstalledLibraries()
8383
} else {
8484
for _, lib := range res.GetInstalledLibraries() {
85-
if lib.Library.CompatibleWith[fqbn.GetFQBN()] {
85+
if lib.Library.CompatibleWith[fqbn.String()] {
8686
libs = append(libs, lib)
8787
}
8888
}

cli/monitor/monitor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func runMonitorCmd(cmd *cobra.Command, args []string) {
8484
enumerateResp, err := monitor.EnumerateMonitorPortSettings(context.Background(), &rpc.EnumerateMonitorPortSettingsRequest{
8585
Instance: instance,
8686
PortProtocol: portProtocol,
87-
Fqbn: fqbn.GetFQBN(),
87+
Fqbn: fqbn.String(),
8888
})
8989
if err != nil {
9090
feedback.Error(tr("Error getting port settings details: %s", err))
@@ -148,7 +148,7 @@ func runMonitorCmd(cmd *cobra.Command, args []string) {
148148
portProxy, _, err := monitor.Monitor(context.Background(), &rpc.MonitorRequest{
149149
Instance: instance,
150150
Port: &rpc.Port{Address: portAddress, Protocol: portProtocol},
151-
Fqbn: fqbn.GetFQBN(),
151+
Fqbn: fqbn.String(),
152152
PortConfiguration: configuration,
153153
})
154154
if err != nil {

cli/upload/upload.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ func runUploadCommand(command *cobra.Command, args []string) {
7878
}
7979
sketchPath, sk, discoveryPort := arguments.SketchPathCalculation(path, port, instance, true)
8080

81-
if fqbn.GetFQBN() == "" && sk != nil && sk.Metadata != nil {
81+
if fqbn.String() == "" && sk != nil && sk.Metadata != nil {
8282
// If the user didn't specify an FQBN and a sketch.json file is present
8383
// read it from there.
84-
fqbn.SetFQBN(sk.Metadata.CPU.Fqbn)
84+
fqbn.Set(sk.Metadata.CPU.Fqbn)
8585
}
8686

8787
userFieldRes, err := upload.SupportedUserFields(context.Background(), &rpc.SupportedUserFieldsRequest{
8888
Instance: instance,
89-
Fqbn: fqbn.GetFQBN(),
89+
Fqbn: fqbn.String(),
9090
Protocol: discoveryPort.Protocol,
9191
})
9292
if err != nil {
@@ -106,7 +106,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
106106

107107
if _, err := upload.Upload(context.Background(), &rpc.UploadRequest{
108108
Instance: instance,
109-
Fqbn: fqbn.GetFQBN(),
109+
Fqbn: fqbn.String(),
110110
SketchPath: path,
111111
Port: discoveryPort.ToRPC(),
112112
Verbose: verbose,

0 commit comments

Comments
 (0)