20 OTA(
const char* password) : password_{password} {
22 ArduinoOTA.setPassword(password_);
23 ArduinoOTA.onStart([]() { ESP_LOGW(__FILENAME__,
"Starting OTA"); });
24 ArduinoOTA.onEnd([]() { ESP_LOGW(__FILENAME__,
"OTA End"); });
25 ArduinoOTA.onProgress([](
unsigned int progress,
unsigned int total) {
26 ESP_LOGI(__FILENAME__,
"OTA Progress: %u%%\r",
27 (progress / (total / 100)));
29 ArduinoOTA.onError([](ota_error_t error) {
30 ESP_LOGE(__FILENAME__,
"OTA Error[%u]: ", error);
31 if (error == OTA_AUTH_ERROR) {
32 ESP_LOGE(__FILENAME__,
"OTA Auth Failed");
33 }
else if (error == OTA_BEGIN_ERROR) {
34 ESP_LOGE(__FILENAME__,
"OTA Begin Failed");
35 }
else if (error == OTA_CONNECT_ERROR) {
36 ESP_LOGE(__FILENAME__,
"OTA Connect Failed");
37 }
else if (error == OTA_RECEIVE_ERROR) {
38 ESP_LOGE(__FILENAME__,
"OTA Receive Failed");
39 }
else if (error == OTA_END_ERROR) {
40 ESP_LOGE(__FILENAME__,
"OTA End Failed");