-
Notifications
You must be signed in to change notification settings - Fork 0
/
OTA.ino
23 lines (22 loc) · 912 Bytes
/
OTA.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void OTAConfigure()
{
ArduinoOTA.onStart([]() {
Serial.println("[OTA] Start");
});
ArduinoOTA.onEnd([]() {
Serial.println("[OTA] \nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("[OTA] Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("[OTA] Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.begin();
dbg_printf ("[OTA] Ready, Host: %s, IP address: %s\n", ArduinoOTA.getHostname().c_str(), WiFi.localIP().toString().c_str() );
}