Skip to content

OTAUpdate: change root certificate to download binary from download.arduino.cc #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
OTAUpdate: warn the user about what firmware will be installed on WiF…
…i chip
  • Loading branch information
pennam committed Feb 16, 2024
commit 390232902f491f2d90957dda78c9c1b326c7486f
34 changes: 33 additions & 1 deletion libraries/OTAUpdate/examples/WiFiFirmwareOTA/WiFiFirmwareOTA.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,31 @@ int status = WL_IDLE_STATUS;
OTAUpdate ota;
static char const OTA_FILE_LOCATION[] = "https://downloads.arduino.cc/ota/UNOR4USBBridge.ino.ota";

/* -------------------------------------------------------------------------- */
bool waitResponse() {
/* -------------------------------------------------------------------------- */
bool confirmation = false;
while (confirmation == false) {
if (Serial.available()) {
char choice = Serial.read();
switch (choice) {
case 'y':
case 'Y':
confirmation = true;
return true;
break;
case 'n':
case 'N':
confirmation = true;
return false;
break;
default:
continue;
}
}
}
}

/* -------------------------------------------------------------------------- */
void setup() {
/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -64,6 +89,13 @@ void setup() {

printWiFiStatus();

Serial.println("\nWARNING! Running the sketch a test version of the WiFi firmware will be flashed on your board.");
Serial.println("Do you want to proceed? Y/[n]");

if (false == waitResponse()) {
return;
}

int ret = ota.begin();
if(ret != OTAUpdate::OTA_ERROR_NONE) {
Serial.println("ota.begin() error: ");
Expand Down Expand Up @@ -108,7 +140,7 @@ void loop() {
/* -------------------------------------------------------------------------- */

String fv = WiFi.firmwareVersion();
Serial.print("Updated Wi-Fi firmware version: ");
Serial.print("Wi-Fi firmware version: ");
Serial.println(fv);
delay(1000);
}
Expand Down