double sortie pour l'ota + serial pour le wifi :)

This commit is contained in:
Julien Cabillot 2017-04-26 13:00:00 +02:00 committed by Cabillot Julien
parent 28fe62032b
commit 43e8038417

View File

@ -71,26 +71,35 @@ void setupOTA()
ArduinoOTA.setHostname("alarmclock"); // on donne une petit nom a notre module
ArduinoOTA.setPassword(OTA_PASSWORD);
ArduinoOTA.onStart([]() {
Debug.println("OTA Starting");
Serial.println("OTA Starting");
});
ArduinoOTA.onEnd([]() {
Debug.println("\nOTA End");
Serial.println("\nOTA End");
});
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)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("OTA Error[%u]: ", error);
Debug.printf("OTA Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) {
Serial.println("Auth Failed");
Debug.println("Auth Failed");
} else if (error == OTA_BEGIN_ERROR) {
Serial.println("Begin Failed");
Debug.println("Begin Failed");
} else if (error == OTA_CONNECT_ERROR) {
Serial.println("Connect Failed");
Debug.println("Connect Failed");
} else if (error == OTA_RECEIVE_ERROR) {
Serial.println("Receive Failed");
Debug.println("Receive Failed");
} else if (error == OTA_END_ERROR) {
Serial.println("End Failed");
Debug.println("End Failed");
}
});
ArduinoOTA.begin();
@ -99,18 +108,18 @@ void setupOTA()
// WIFI
void setupWifi()
{
Debug.print("Connexion a ");
Debug.print(WIFI_SSID);
Serial.print("Connexion a ");
Serial.print(WIFI_SSID);
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Debug.print(".");
Serial.print(".");
}
Debug.println(" OK");
Debug.print("IP : ");
Debug.println(WiFi.localIP());
Serial.println(" OK");
Serial.print("IP : ");
Serial.println(WiFi.localIP());
}
// MQTT