File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed
libraries/OTAUpdate/examples/WiFiFirmwareOTA Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,31 @@ int status = WL_IDLE_STATUS;
2727OTAUpdate ota;
2828static char const OTA_FILE_LOCATION[] = " https://downloads.arduino.cc/ota/UNOR4USBBridge.ino.ota" ;
2929
30+ /* -------------------------------------------------------------------------- */
31+ bool waitResponse () {
32+ /* -------------------------------------------------------------------------- */
33+ bool confirmation = false ;
34+ while (confirmation == false ) {
35+ if (Serial.available ()) {
36+ char choice = Serial.read ();
37+ switch (choice) {
38+ case ' y' :
39+ case ' Y' :
40+ confirmation = true ;
41+ return true ;
42+ break ;
43+ case ' n' :
44+ case ' N' :
45+ confirmation = true ;
46+ return false ;
47+ break ;
48+ default :
49+ continue ;
50+ }
51+ }
52+ }
53+ }
54+
3055/* -------------------------------------------------------------------------- */
3156void setup () {
3257/* -------------------------------------------------------------------------- */
@@ -64,6 +89,13 @@ void setup() {
6489
6590 printWiFiStatus ();
6691
92+ Serial.println (" \n WARNING! Running the sketch a test version of the WiFi firmware will be flashed on your board." );
93+ Serial.println (" Do you want to proceed? Y/[n]" );
94+
95+ if (false == waitResponse ()) {
96+ return ;
97+ }
98+
6799 int ret = ota.begin ();
68100 if (ret != OTAUpdate::OTA_ERROR_NONE) {
69101 Serial.println (" ota.begin() error: " );
@@ -108,7 +140,7 @@ void loop() {
108140/* -------------------------------------------------------------------------- */
109141
110142 String fv = WiFi.firmwareVersion ();
111- Serial.print (" Updated Wi-Fi firmware version: " );
143+ Serial.print (" Wi-Fi firmware version: " );
112144 Serial.println (fv);
113145 delay (1000 );
114146}
You can’t perform that action at this time.
0 commit comments