mirror of
https://github.com/bendtherules/Patient-counter-esp8266.git
synced 2026-08-18 13:52:39 +00:00
Change info prints
This commit is contained in:
+19
-14
@@ -11,29 +11,34 @@
|
||||
|
||||
void setupOTALocal() {
|
||||
Serial.println("Booting");
|
||||
char infoBuffer[LCD_COLUMNS];
|
||||
sprintf(infoBuffer, "W:%s", WIFI_SSID);
|
||||
showInsideInfo(infoBuffer);
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
||||
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
|
||||
Serial.println("Connection Failed! Rebooting...");
|
||||
showInsideInfo("W:Failed");
|
||||
delay(5000);
|
||||
ESP.restart();
|
||||
}
|
||||
showInsideInfo("W:Connected");
|
||||
ArduinoOTA.onStart([]() {
|
||||
Serial.println("Start");
|
||||
showInsideInfo("[LU] Start");
|
||||
showInsideInfo("LU:Start");
|
||||
});
|
||||
ArduinoOTA.onEnd([]() {
|
||||
Serial.println("\nEnd");
|
||||
showInsideInfo("[LU] Done");
|
||||
showInsideInfo("LU:Restarting..");
|
||||
});
|
||||
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
|
||||
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
|
||||
char infoBuffer[16];
|
||||
sprintf(infoBuffer, "[LU] P:%u%%", (progress / (total / 100)));
|
||||
Serial.printf("Progress:%u%%\r", (progress / (total / 100)));
|
||||
char infoBuffer[LCD_COLUMNS];
|
||||
sprintf(infoBuffer, "LU:P:%u%%", (progress / (total / 100)));
|
||||
showInsideInfo(infoBuffer);
|
||||
});
|
||||
ArduinoOTA.onError([](ota_error_t error) {
|
||||
Serial.printf("Error[%u]: ", error);
|
||||
Serial.printf("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");
|
||||
@@ -42,7 +47,7 @@ void setupOTALocal() {
|
||||
});
|
||||
ArduinoOTA.begin();
|
||||
Serial.println("Ready");
|
||||
Serial.print("IP address: ");
|
||||
Serial.print("IP address:");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
|
||||
@@ -54,21 +59,21 @@ void handleOTARemote() {
|
||||
WiFiClient client;
|
||||
|
||||
Serial.println("Updating from remote...");
|
||||
showInsideInfo("[RU] Start");
|
||||
showInsideInfo("RU:Start");
|
||||
t_httpUpdate_return ret = ESPhttpUpdate.update(client, "http://patient.bendtherules.in/build/esp12e/firmware.bin", VERSION_SHORT);
|
||||
switch(ret) {
|
||||
case HTTP_UPDATE_FAILED:
|
||||
Serial.print("[update] Update failed. Reason - ");
|
||||
Serial.print("update:Update failed. Reason - ");
|
||||
Serial.println(ESPhttpUpdate.getLastErrorString());
|
||||
showInsideInfo("[RU] Failed");
|
||||
showInsideInfo("RU:Failed");
|
||||
break;
|
||||
case HTTP_UPDATE_NO_UPDATES:
|
||||
Serial.println("[update] Update no Update.");
|
||||
showInsideInfo("[RU] Skip");
|
||||
Serial.println("update:Update no Update.");
|
||||
showInsideInfo("RU:Skip");
|
||||
break;
|
||||
case HTTP_UPDATE_OK:
|
||||
Serial.println("[update] Update ok."); // may not be called since we reboot the ESP
|
||||
showInsideInfo("[RU] Done");
|
||||
Serial.println("update:Update ok."); // may not be called since we reboot the ESP
|
||||
showInsideInfo("RU:Done");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user