@@ -133,13 +133,18 @@ func run(cmd *cobra.Command, args []string) {
133
133
}
134
134
135
135
// Check if board needs a 1200bps touch for upload
136
+ uploadPort := address
136
137
if board .UploadTouch {
137
138
logrus .Info ("Putting board into bootloader mode" )
138
- _ , err := serialutils .Reset (address , board .UploadWait , nil )
139
+ newUploadPort , err := serialutils .Reset (address , board .UploadWait , nil )
139
140
if err != nil {
140
141
feedback .Errorf ("Error during certificates flashing: missing board address" )
141
142
os .Exit (errorcodes .ErrGeneric )
142
143
}
144
+ if newUploadPort != "" {
145
+ logrus .Infof ("Found port to upload Loader: %s" , newUploadPort )
146
+ uploadPort = newUploadPort
147
+ }
143
148
}
144
149
145
150
// Flash loader Sketch
@@ -157,18 +162,18 @@ func run(cmd *cobra.Command, args []string) {
157
162
158
163
// Wait a bit after flashing the loader sketch for the board to become
159
164
// available again.
160
- time .Sleep (1 * time .Second )
165
+ time .Sleep (2 * time .Second )
161
166
162
167
// Get flasher depending on which module to use
163
168
var f flasher.Flasher
164
169
moduleName := board .Module
165
170
switch moduleName {
166
171
case "NINA" :
167
- f , err = flasher .NewNinaFlasher (address )
172
+ f , err = flasher .NewNinaFlasher (uploadPort )
168
173
case "SARA" :
169
- f , err = flasher .NewSaraFlasher (address )
174
+ f , err = flasher .NewSaraFlasher (uploadPort )
170
175
case "WINC1500" :
171
- f , err = flasher .NewWincFlasher (address )
176
+ f , err = flasher .NewWincFlasher (uploadPort )
172
177
default :
173
178
err = fmt .Errorf ("unknown module: %s" , moduleName )
174
179
}
0 commit comments