Skip to content

Commit 0df2788

Browse files
committed
Renamed tools version
1 parent bdde9d9 commit 0df2788

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

cli/ota/massupload.go

-17
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"fmt"
2323
"os"
2424
"sort"
25-
"strings"
2625

2726
"github.com/arduino/arduino-cli/cli/errorcodes"
2827
"github.com/arduino/arduino-cli/cli/feedback"
@@ -96,22 +95,6 @@ func runMassUploadCommand(flags *massUploadFlags) error {
9695
})
9796

9897
feedback.PrintResult(massUploadResult{resp})
99-
100-
var failed []string
101-
for _, r := range resp {
102-
if r.Err != nil {
103-
failed = append(failed, r.ID)
104-
}
105-
}
106-
if len(failed) == 0 {
107-
return nil
108-
}
109-
failDevs := strings.Join(failed, ",")
110-
feedback.Printf(
111-
"You can try to perform the OTA again on the failed devices using the following command:\n"+
112-
"$ arduino-cloud-cli ota mass-upload --file %s --fqbn %s -d %s",
113-
params.File, params.FQBN, failDevs,
114-
)
11598
return nil
11699
}
117100

tools/ota/ota_mass_upload.sh renamed to example/tools/ota/ota_mass_upload.sh

+13-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ do
3232
esac
3333
done
3434

35+
if [[ "$firmwarefile" == "" || "$tag" == "" || "$waittime" == "" ]]; then
36+
echo "Usage: $0 -t <tag> -f <firmwarefile> [-o <waittime>] [-v <new firmware version>]"
37+
exit 1
38+
fi
39+
3540
echo "Starting OTA process for devices with tag \"$tag\" using firmware \"$firmwarefile\""
3641
echo ""
3742

@@ -52,12 +57,14 @@ fqbncount=$(echo $devicelistjson | jq '.[] | .fqbn' | sort | uniq | wc -l)
5257
if [ "$fqbncount" -gt 1 ]; then
5358
echo "Mixed FQBNs detected. Please ensure all devices have the same FQBN."
5459
fqbns=$(echo $devicelistjson | jq '.[] | .fqbn' | sort | uniq)
55-
echo "Detected FQBNs: $fqbns"
60+
echo "Detected FQBNs:"
61+
echo "$fqbns"
5662
exit 1
5763
fi
5864

5965
fqbn=$(echo $devicelistjson | jq -r '.[] | .fqbn' | sort | uniq | head -n 1)
6066

67+
echo "Sending OTA request to detected boards of type $fqbn..."
6168
otastartedout=$(arduino-cloud-cli ota mass-upload --device-tags $tag --file $firmwarefile -b $fqbn --format json)
6269
if [ $? -ne 0 ]; then
6370
echo "Detected error during OTA process. Exiting..."
@@ -66,6 +73,11 @@ fi
6673

6774
otaids=$(echo $otastartedout | jq -r '.[] | .OtaStatus | .id' | uniq | paste -sd "," -)
6875

76+
if [ $otaids == "null" ]; then
77+
echo "No OTA processes to monitor. This could be due to an upgrade from previous ArduinoIotLibrary versions. Exiting..."
78+
exit 0
79+
fi
80+
6981
while [ $waittime -gt 0 ]; do
7082
echo "Waiting for $waittime seconds for OTA process to complete..."
7183
sleep 15

0 commit comments

Comments
 (0)