Skip to content

Commit 56397f3

Browse files
committed
minor optimizations
1 parent dfededb commit 56397f3

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

cli/firmware/flash.go

-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ func run(cmd *cobra.Command, args []string) {
171171
// Flash loader Sketch
172172
programmerOut := new(bytes.Buffer)
173173
programmerErr := new(bytes.Buffer)
174-
// var err error
175174
if feedback.GetFormat() == feedback.JSON {
176175
err = programmer.Flash(commandLine, programmerOut, programmerErr)
177176
} else {

flasher/nina.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,12 @@ func (f *NinaFlasher) FlashFirmware(firmwareFile *paths.Path) error {
8686
}
8787

8888
logrus.Debugf("Checking md5")
89-
err = f.md5sum(data)
90-
if err != nil {
89+
if err := f.md5sum(data); err != nil {
9190
logrus.Error(err)
9291
return err
9392
}
94-
logrus.Debugf("Flashed all the things")
95-
return nil
93+
logrus.Infof("Flashed all the things")
94+
return err //should be nil
9695
}
9796

9897
func (f *NinaFlasher) FlashCertificates(certificatePaths *paths.PathList, URLs []string) error {

flasher/sara.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ func (f *SaraFlasher) FlashFirmware(firmwareFile *paths.Path) error {
101101
if err != nil {
102102
logrus.Error(err)
103103
}
104-
return err
104+
logrus.Infof("Flashed all the things")
105+
return err //should be nil
105106
}
106107

107108
func (f *SaraFlasher) FlashCertificates(certificatePaths *paths.PathList, URLs []string) error {

flasher/winc.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"encoding/binary"
2828
"errors"
2929
"fmt"
30-
"log"
3130
"strconv"
3231
"time"
3332

@@ -68,7 +67,12 @@ func (f *WincFlasher) FlashFirmware(firmwareFile *paths.Path) error {
6867
return err
6968
}
7069
firmwareOffset := 0x0000
71-
return f.flashChunk(firmwareOffset, data)
70+
if err = f.flashChunk(firmwareOffset, data); err != nil {
71+
logrus.Error(err)
72+
return err
73+
}
74+
logrus.Infof("Flashed all the things")
75+
return err //should be nil
7276
}
7377

7478
func (f *WincFlasher) FlashCertificates(certificatePaths *paths.PathList, URLs []string) error {
@@ -431,7 +435,7 @@ func (f *WincFlasher) erase(address uint32, length uint32) error {
431435
return err
432436
}
433437

434-
log.Printf("Erasing %d bytes from address 0x%X\n", length, address)
438+
logrus.Debugf("Erasing %d bytes from address 0x%X\n", length, address)
435439

436440
// wait acknowledge
437441
ack := make([]byte, 2)

0 commit comments

Comments
 (0)