@@ -30,31 +30,34 @@ void setup() {
30
30
// MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
31
31
// ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");
32
32
33
- ArduinoOTA.onStart ([]() {
34
- String type;
35
- if (ArduinoOTA.getCommand () == U_FLASH)
36
- type = " sketch" ;
37
- else // U_SPIFFS
38
- type = " filesystem" ;
33
+ ArduinoOTA
34
+ .onStart ([]() {
35
+ String type;
36
+ if (ArduinoOTA.getCommand () == U_FLASH)
37
+ type = " sketch" ;
38
+ else // U_SPIFFS
39
+ type = " filesystem" ;
40
+
41
+ // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
42
+ Serial.println (" Start updating " + type);
43
+ })
44
+ .onEnd ([]() {
45
+ Serial.println (" \n End" );
46
+ })
47
+ .onProgress ([](unsigned int progress, unsigned int total) {
48
+ Serial.printf (" Progress: %u%%\r " , (progress / (total / 100 )));
49
+ })
50
+ .onError ([](ota_error_t error) {
51
+ Serial.printf (" Error[%u]: " , error);
52
+ if (error == OTA_AUTH_ERROR) Serial.println (" Auth Failed" );
53
+ else if (error == OTA_BEGIN_ERROR) Serial.println (" Begin Failed" );
54
+ else if (error == OTA_CONNECT_ERROR) Serial.println (" Connect Failed" );
55
+ else if (error == OTA_RECEIVE_ERROR) Serial.println (" Receive Failed" );
56
+ else if (error == OTA_END_ERROR) Serial.println (" End Failed" );
57
+ });
39
58
40
- // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
41
- Serial.println (" Start updating " + type);
42
- });
43
- ArduinoOTA.onEnd ([]() {
44
- Serial.println (" \n End" );
45
- });
46
- ArduinoOTA.onProgress ([](unsigned int progress, unsigned int total) {
47
- Serial.printf (" Progress: %u%%\r " , (progress / (total / 100 )));
48
- });
49
- ArduinoOTA.onError ([](ota_error_t error) {
50
- Serial.printf (" Error[%u]: " , error);
51
- if (error == OTA_AUTH_ERROR) Serial.println (" Auth Failed" );
52
- else if (error == OTA_BEGIN_ERROR) Serial.println (" Begin Failed" );
53
- else if (error == OTA_CONNECT_ERROR) Serial.println (" Connect Failed" );
54
- else if (error == OTA_RECEIVE_ERROR) Serial.println (" Receive Failed" );
55
- else if (error == OTA_END_ERROR) Serial.println (" End Failed" );
56
- });
57
59
ArduinoOTA.begin ();
60
+
58
61
Serial.println (" Ready" );
59
62
Serial.print (" IP address: " );
60
63
Serial.println (WiFi.localIP ());
0 commit comments