@@ -69,8 +69,8 @@ func runFlash(cmd *cobra.Command, args []string) {
69
69
// at the end cleanup the fwuploader temp dir
70
70
defer globals .FwUploaderPath .RemoveAll ()
71
71
72
- packageIndex , firmwareIndex := common .InitIndexes ()
73
72
common .CheckFlags (commonFlags .Fqbn , commonFlags .Address )
73
+ packageIndex , firmwareIndex := common .InitIndexes ()
74
74
board := common .GetBoard (firmwareIndex , commonFlags .Fqbn )
75
75
uploadToolDir := common .DownloadRequiredToolsForBoard (packageIndex , board )
76
76
@@ -92,7 +92,6 @@ func runFlash(cmd *cobra.Command, args []string) {
92
92
moduleName = strings .ToUpper (moduleName )
93
93
94
94
var firmwareFilePath * paths.Path
95
- var err error
96
95
// If a local firmware file has been specified
97
96
if fwFile != "" {
98
97
firmwareFilePath = paths .New (fwFile )
@@ -111,9 +110,10 @@ func runFlash(cmd *cobra.Command, args []string) {
111
110
feedback .Fatal (fmt .Sprintf ("Error getting firmware for board: %s" , commonFlags .Fqbn ), feedback .ErrGeneric )
112
111
}
113
112
logrus .Debugf ("module name: %s, firmware version: %s" , firmware .Module , firmware .Version .String ())
114
- firmwareFilePath , err = download .DownloadFirmware (firmware )
115
- if err != nil {
113
+ if fwPath , err := download .DownloadFirmware (firmware ); err != nil {
116
114
feedback .Fatal (fmt .Sprintf ("Error downloading firmware from %s: %s" , firmware .URL , err ), feedback .ErrGeneric )
115
+ } else {
116
+ firmwareFilePath = fwPath
117
117
}
118
118
logrus .Debugf ("firmware file downloaded in %s" , firmwareFilePath .String ())
119
119
}
0 commit comments