Skip to content

Commit 946a445

Browse files
Add programmer to the sketch profile
1 parent 4d6f4d2 commit 946a445

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

Diff for: commands/instances.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro
150150
responseCallback(&rpc.InitResponse{
151151
Message: &rpc.InitResponse_Profile{
152152
Profile: &rpc.Profile{
153-
Name: req.GetProfile(),
154-
Fqbn: profile.FQBN,
153+
Name: req.GetProfile(),
154+
Fqbn: profile.FQBN,
155+
Programmer: profile.Programmer,
155156
// TODO: Other profile infos may be provided here...
156157
},
157158
},

Diff for: internal/arduino/sketch/profiles.go

+12-7
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,20 @@ func (p *projectRaw) getProfiles() []*Profile {
9393
// Profile is a sketch profile, it contains a reference to all the resources
9494
// needed to build and upload a sketch
9595
type Profile struct {
96-
Name string
97-
Notes string `yaml:"notes"`
98-
FQBN string `yaml:"fqbn"`
99-
Platforms ProfileRequiredPlatforms `yaml:"platforms"`
100-
Libraries ProfileRequiredLibraries `yaml:"libraries"`
96+
Name string
97+
Notes string `yaml:"notes"`
98+
FQBN string `yaml:"fqbn"`
99+
Programmer string `yaml:"programmer"`
100+
Platforms ProfileRequiredPlatforms `yaml:"platforms"`
101+
Libraries ProfileRequiredLibraries `yaml:"libraries"`
101102
}
102103

103104
// ToRpc converts this Profile to an rpc.SketchProfile
104105
func (p *Profile) ToRpc() *rpc.SketchProfile {
105106
return &rpc.SketchProfile{
106-
Name: p.Name,
107-
Fqbn: p.FQBN,
107+
Name: p.Name,
108+
Fqbn: p.FQBN,
109+
Programmer: p.Programmer,
108110
}
109111
}
110112

@@ -115,6 +117,9 @@ func (p *Profile) AsYaml() string {
115117
res += fmt.Sprintf(" notes: %s\n", p.Notes)
116118
}
117119
res += fmt.Sprintf(" fqbn: %s\n", p.FQBN)
120+
if p.Programmer != "" {
121+
res += fmt.Sprintf(" programmer: %s\n", p.Programmer)
122+
}
118123
res += p.Platforms.AsYaml()
119124
res += p.Libraries.AsYaml()
120125
return res

Diff for: internal/arduino/sketch/testdata/SketchWithProfiles/sketch.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
profiles:
22
nanorp:
33
fqbn: arduino:mbed_nano:nanorp2040connect
4+
programmer: p1
45
platforms:
56
- platform: arduino:mbed_nano (2.1.0)
67
libraries:

0 commit comments

Comments
 (0)