Skip to content

Commit d061a3c

Browse files
committed
improve wording
1 parent 1a03a41 commit d061a3c

File tree

4 files changed

+27
-22
lines changed

4 files changed

+27
-22
lines changed

libraries/ArduinoOTA/ArduinoOTA.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class ArduinoOTAClass
4646
void setPasswordHash(const char *password);
4747

4848
//Sets if the device should be rebooted after successful update. Default true
49-
//Sets eraseConfig conditional on RebootOnSuccess. Default false
49+
//"eraseConfig" selects to erase WiFi Settings in conjunction with a reboot
50+
//after a successful update. Default false - Legacy behavior
5051
void setRebootOnSuccess(bool reboot, bool eraseConfig = false);
5152

5253
//Sets flag to erase WiFi Settings at reboot/reset.
@@ -70,8 +71,8 @@ class ArduinoOTAClass
7071
//Ends the ArduinoOTA service
7172
void end();
7273

73-
//Has the effect of Arduino IDE Tools "Erase Flash" with "+ WiFi Settings"
74-
//selection. Only returns on failure to erase flash.
74+
//Has the effect of the "+ WiFi Settings" in the Arduino IDE Tools "Erase
75+
//Flash" selection. Only returns on erase flash failure.
7576
void eraseConfigAndReset();
7677

7778
//Call this in loop() to run the service. Also calls MDNS.update() when begin() or begin(true) is used.

libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void setup() {
6565
} else if (error == OTA_END_ERROR) {
6666
Serial.println("End Failed");
6767
} else if (error == OTA_ERASE_SETTINGS_ERROR) {
68-
Serial.println("Failed to erase WiFi Settings");
68+
Serial.println("Erase WiFi Settings Failed");
6969
}
7070
});
7171
ArduinoOTA.begin();

libraries/ArduinoOTA/examples/OTAEraseConfig/OTAEraseConfig.ino

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/*
22
This example is a variation on BasicOTA.
33
4-
After a successful update if will always erase WiFi Settings and reset.
4+
As is, this example will "always" erase WiFi Settings and reset after a
5+
successful update. You can make this conditional.
56
*/
67
#include <ESP8266WiFi.h>
78
#include <ESP8266mDNS.h>
@@ -55,11 +56,13 @@ void setup() {
5556
ArduinoOTA.onEnd([]() {
5657
Serial.println("\nEnd");
5758
/*
58-
By calling "ArduinoOTA.setRebootOnSuccess(true, true);", this example
59-
will always erases the "WiFi Settings" as part of an OTA update.
59+
By calling "ArduinoOTA.setRebootOnSuccess(true, true);", this example will
60+
always erase the "WiFi Settings" as part of an OTA update.
6061
61-
Modify the calling of "ArduinoOTA.setRebootOnSuccess(true, true);"
62-
to meet your requirements.
62+
Without the call to "ArduinoOTA.setRebootOnSuccess," the system restarts
63+
without touching the WiFi Settings legacy behavior.
64+
65+
Update the conditional below to meet your requirements.
6366
*/
6467
if (true) {
6568
ArduinoOTA.setRebootOnSuccess(true, true); // reboot = true, eraseConfig = true
@@ -81,7 +84,7 @@ void setup() {
8184
} else if (error == OTA_END_ERROR) {
8285
Serial.println("End Failed");
8386
} else if (error == OTA_ERASE_SETTINGS_ERROR) {
84-
Serial.println("Failed to erase WiFi Settings");
87+
Serial.println("Erase WiFi Settings Failed");
8588
}
8689
});
8790
ArduinoOTA.begin();

libraries/ArduinoOTA/examples/OTASdkCheck/OTASdkCheck.ino

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
22
This example is a variation on BasicOTA.
33
4-
Some logic has been added to check if the running SDK Version has changed.
5-
If so, erase WiFi Settings and reset.
4+
Logic added to look for a change in SDK Version. If so, erase the WiFi
5+
Settings and Reset the system.
66
7-
I have added a lot of debug printing because, with all reboots, it can get
8-
confusing when verifying that it works.
7+
Added extra debug printing to aid in cutting through the confusion of the
8+
multiple reboots.
99
*/
1010

1111
#include <ESP8266WiFi.h>
@@ -38,18 +38,19 @@ struct YourEEPROMData {
3838
// list of parameters you need to keep
3939
// ...
4040

41-
// To efficiently save and compare SDK version strings, we use their CRC32
42-
// value. They always take up the same amount of space, making them easy to
43-
// compare and store in EEPROM.
41+
// To efficiently save and compare SDK version strings, we use their computed
42+
// CRC32 value.
4443
uint32_t sdkCrc;
4544
};
4645

4746
bool checkSdkCrc() {
4847
auto reason = ESP.getResetInfoPtr()->reason;
49-
// Boot guard
50-
// Only runs at reset to avoid a crash loop trying to erase flash.
51-
// With the line below, an OTA update that does a software restart, no SDK
52-
// check will occur until after a hard reset. Remove at your discretion.
48+
// In this example, the OTA update does a software restart. As coded, SDK
49+
// version checks are only performed after a hard reset. Change the lines
50+
// below at your discretion.
51+
//
52+
// Boot loop guard
53+
// Limit crash loops erasing flash. Only run at Power On or Hardware Reset.
5354
if (REASON_DEFAULT_RST != reason && REASON_EXT_SYS_RST != reason) {
5455
DEBUG_PRINTF(" Boot loop guard - SDK version not checked. To perform check, do a hardware reset.\r\n");
5556
return true;
@@ -149,7 +150,7 @@ void setup() {
149150
} else if (error == OTA_END_ERROR) {
150151
Serial.println("End Failed");
151152
} else if (error == OTA_ERASE_SETTINGS_ERROR) {
152-
Serial.println("Failed to erase WiFi Settings");
153+
Serial.println("Erase WiFi Settings Failed");
153154
}
154155
});
155156
ArduinoOTA.begin();

0 commit comments

Comments
 (0)