double sortie pour l'ota

This commit is contained in:
Julien Cabillot 2017-04-26 12:59:35 +02:00 committed by Cabillot Julien
parent 73bc585145
commit 6097acddcc

View File

@ -94,30 +94,38 @@ void setup()
// OTA // OTA
void setupOTA() void setupOTA()
{ {
// TODO: on devrait ecrire ce genre d'info sur les deux sorties
ArduinoOTA.setHostname("mqttfastledmenu"); // on donne une petit nom a notre module ArduinoOTA.setHostname("mqttfastledmenu"); // on donne une petit nom a notre module
ArduinoOTA.setPassword(OTA_PASSWORD); ArduinoOTA.setPassword(OTA_PASSWORD);
ArduinoOTA.onStart([]() { ArduinoOTA.onStart([]() {
Debug.println("OTA Starting");
Serial.println("OTA Starting"); Serial.println("OTA Starting");
}); });
ArduinoOTA.onEnd([]() { ArduinoOTA.onEnd([]() {
Debug.println("\nOTA End");
Serial.println("\nOTA End"); Serial.println("\nOTA End");
}); });
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Debug.printf("OTA Progress: %u%%\r", (progress / (total / 100)));
Serial.printf("OTA Progress: %u%%\r", (progress / (total / 100))); Serial.printf("OTA Progress: %u%%\r", (progress / (total / 100)));
}); });
ArduinoOTA.onError([](ota_error_t error) { ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("OTA Error[%u]: ", error); Serial.printf("OTA Error[%u]: ", error);
Debug.printf("OTA Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) { if (error == OTA_AUTH_ERROR) {
Serial.println("Auth Failed"); Serial.println("Auth Failed");
Debug.println("Auth Failed");
} else if (error == OTA_BEGIN_ERROR) { } else if (error == OTA_BEGIN_ERROR) {
Serial.println("Begin Failed"); Serial.println("Begin Failed");
Debug.println("Begin Failed");
} else if (error == OTA_CONNECT_ERROR) { } else if (error == OTA_CONNECT_ERROR) {
Serial.println("Connect Failed"); Serial.println("Connect Failed");
Debug.println("Connect Failed");
} else if (error == OTA_RECEIVE_ERROR) { } else if (error == OTA_RECEIVE_ERROR) {
Serial.println("Receive Failed"); Serial.println("Receive Failed");
Debug.println("Receive Failed");
} else if (error == OTA_END_ERROR) { } else if (error == OTA_END_ERROR) {
Serial.println("End Failed"); Serial.println("End Failed");
Debug.println("End Failed");
} }
}); });
ArduinoOTA.begin(); ArduinoOTA.begin();