From 58ed402f33b00eb3c27aeec499051cb01dc9eb89 Mon Sep 17 00:00:00 2001 From: umbynos Date: Tue, 15 Jun 2021 17:30:57 +0200 Subject: [PATCH] =?UTF-8?q?fix=20=F0=9F=90=9B=20causing=20panic=20with=20m?= =?UTF-8?q?kr1000?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli/certificates/flash.go | 8 ++++++-- cli/firmware/flash.go | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cli/certificates/flash.go b/cli/certificates/flash.go index 421209f9..05954703 100644 --- a/cli/certificates/flash.go +++ b/cli/certificates/flash.go @@ -21,6 +21,7 @@ package certificates import ( "bytes" + "fmt" "os" "path/filepath" "strings" @@ -161,13 +162,16 @@ func run(cmd *cobra.Command, args []string) { // Get flasher depending on which module to use var f flasher.Flasher - switch board.Module { + moduleName := board.Module + switch moduleName { case "NINA": f, err = flasher.NewNinaFlasher(address) case "SARA": f, err = flasher.NewSaraFlasher(address) - case "WINC": + case "WINC1500": f, err = flasher.NewWincFlasher(address) + default: + err = fmt.Errorf("unknown module: %s", moduleName) } if err != nil { feedback.Errorf("Error during certificates flashing: %s", err) diff --git a/cli/firmware/flash.go b/cli/firmware/flash.go index 3d3f98fe..e455d713 100644 --- a/cli/firmware/flash.go +++ b/cli/firmware/flash.go @@ -21,6 +21,7 @@ package firmware import ( "bytes" + "fmt" "os" "path/filepath" "strings" @@ -193,8 +194,10 @@ func run(cmd *cobra.Command, args []string) { f, err = flasher.NewNinaFlasher(address) case "SARA": f, err = flasher.NewSaraFlasher(address) - case "WINC": + case "WINC1500": f, err = flasher.NewWincFlasher(address) + default: + err = fmt.Errorf("unknown module: %s", moduleName) } if err != nil { feedback.Errorf("Error during firmware flashing: %s", err)