double sortie pour l'ota + serial pour le wifi :)
This commit is contained in:
parent
28fe62032b
commit
43e8038417
@ -71,26 +71,35 @@ void setupOTA()
|
|||||||
ArduinoOTA.setHostname("alarmclock"); // on donne une petit nom a notre module
|
ArduinoOTA.setHostname("alarmclock"); // 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();
|
||||||
@ -99,18 +108,18 @@ void setupOTA()
|
|||||||
// WIFI
|
// WIFI
|
||||||
void setupWifi()
|
void setupWifi()
|
||||||
{
|
{
|
||||||
Debug.print("Connexion a ");
|
Serial.print("Connexion a ");
|
||||||
Debug.print(WIFI_SSID);
|
Serial.print(WIFI_SSID);
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
||||||
|
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
delay(500);
|
delay(500);
|
||||||
Debug.print(".");
|
Serial.print(".");
|
||||||
}
|
}
|
||||||
Debug.println(" OK");
|
Serial.println(" OK");
|
||||||
Debug.print("IP : ");
|
Serial.print("IP : ");
|
||||||
Debug.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
}
|
}
|
||||||
|
|
||||||
// MQTT
|
// MQTT
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user