@@ -133,13 +133,18 @@ func run(cmd *cobra.Command, args []string) {
133133 }
134134
135135 // Check if board needs a 1200bps touch for upload
136+ uploadPort := address
136137 if board .UploadTouch {
137138 logrus .Info ("Putting board into bootloader mode" )
138- _ , err := serialutils .Reset (address , board .UploadWait , nil )
139+ newUploadPort , err := serialutils .Reset (address , board .UploadWait , nil )
139140 if err != nil {
140141 feedback .Errorf ("Error during certificates flashing: missing board address" )
141142 os .Exit (errorcodes .ErrGeneric )
142143 }
144+ if newUploadPort != "" {
145+ logrus .Infof ("Found port to upload Loader: %s" , newUploadPort )
146+ uploadPort = newUploadPort
147+ }
143148 }
144149
145150 // Flash loader Sketch
@@ -157,18 +162,18 @@ func run(cmd *cobra.Command, args []string) {
157162
158163 // Wait a bit after flashing the loader sketch for the board to become
159164 // available again.
160- time .Sleep (1 * time .Second )
165+ time .Sleep (2 * time .Second )
161166
162167 // Get flasher depending on which module to use
163168 var f flasher.Flasher
164169 moduleName := board .Module
165170 switch moduleName {
166171 case "NINA" :
167- f , err = flasher .NewNinaFlasher (address )
172+ f , err = flasher .NewNinaFlasher (uploadPort )
168173 case "SARA" :
169- f , err = flasher .NewSaraFlasher (address )
174+ f , err = flasher .NewSaraFlasher (uploadPort )
170175 case "WINC1500" :
171- f , err = flasher .NewWincFlasher (address )
176+ f , err = flasher .NewWincFlasher (uploadPort )
172177 default :
173178 err = fmt .Errorf ("unknown module: %s" , moduleName )
174179 }
0 commit comments