Change info prints

This commit is contained in:
2023-11-28 18:31:47 +05:30
parent 58ff047dd5
commit 1ed1fa337b
5 changed files with 26 additions and 18 deletions
Binary file not shown.
+3
View File
@@ -5,6 +5,9 @@ enum DISPLAY_POSITION {
POSITION_RIGHT,
};
#define LCD_COLUMNS 16
#define LCD_ROWS 2
void setupDisplay();
void showNumber(uint8_t number);
void showInsideInfo(const char* text);
+3 -3
View File
@@ -1,9 +1,9 @@
#ifndef BUILD_NUMBER
#define BUILD_NUMBER 39
#define BUILD_NUMBER 41
#endif
#ifndef VERSION
#define VERSION "v0.1.39 - 2023-11-28 18:19:04.992246"
#define VERSION "v0.1.41 - 2023-11-28 18:30:13.789845"
#endif
#ifndef VERSION_SHORT
#define VERSION_SHORT "v0.1.39"
#define VERSION_SHORT "v0.1.41"
#endif
+19 -14
View File
@@ -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;
}
}
+1 -1
View File
@@ -1 +1 @@
39
41