Skip to content

Commit 43dfacf

Browse files
authored
fix 🐛 causing panic with mkr1000 (#57)
1 parent ff995eb commit 43dfacf

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

cli/certificates/flash.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package certificates
2121

2222
import (
2323
"bytes"
24+
"fmt"
2425
"os"
2526
"path/filepath"
2627
"strings"
@@ -161,13 +162,16 @@ func run(cmd *cobra.Command, args []string) {
161162

162163
// Get flasher depending on which module to use
163164
var f flasher.Flasher
164-
switch board.Module {
165+
moduleName := board.Module
166+
switch moduleName {
165167
case "NINA":
166168
f, err = flasher.NewNinaFlasher(address)
167169
case "SARA":
168170
f, err = flasher.NewSaraFlasher(address)
169-
case "WINC":
171+
case "WINC1500":
170172
f, err = flasher.NewWincFlasher(address)
173+
default:
174+
err = fmt.Errorf("unknown module: %s", moduleName)
171175
}
172176
if err != nil {
173177
feedback.Errorf("Error during certificates flashing: %s", err)

cli/firmware/flash.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package firmware
2121

2222
import (
2323
"bytes"
24+
"fmt"
2425
"os"
2526
"path/filepath"
2627
"strings"
@@ -193,8 +194,10 @@ func run(cmd *cobra.Command, args []string) {
193194
f, err = flasher.NewNinaFlasher(address)
194195
case "SARA":
195196
f, err = flasher.NewSaraFlasher(address)
196-
case "WINC":
197+
case "WINC1500":
197198
f, err = flasher.NewWincFlasher(address)
199+
default:
200+
err = fmt.Errorf("unknown module: %s", moduleName)
198201
}
199202
if err != nil {
200203
feedback.Errorf("Error during firmware flashing: %s", err)

0 commit comments

Comments
 (0)