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, POSITION_RIGHT,
}; };
#define LCD_COLUMNS 16
#define LCD_ROWS 2
void setupDisplay(); void setupDisplay();
void showNumber(uint8_t number); void showNumber(uint8_t number);
void showInsideInfo(const char* text); void showInsideInfo(const char* text);
+3 -3
View File
@@ -1,9 +1,9 @@
#ifndef BUILD_NUMBER #ifndef BUILD_NUMBER
#define BUILD_NUMBER 39 #define BUILD_NUMBER 41
#endif #endif
#ifndef VERSION #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 #endif
#ifndef VERSION_SHORT #ifndef VERSION_SHORT
#define VERSION_SHORT "v0.1.39" #define VERSION_SHORT "v0.1.41"
#endif #endif
+16 -11
View File
@@ -11,25 +11,30 @@
void setupOTALocal() { void setupOTALocal() {
Serial.println("Booting"); Serial.println("Booting");
char infoBuffer[LCD_COLUMNS];
sprintf(infoBuffer, "W:%s", WIFI_SSID);
showInsideInfo(infoBuffer);
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD); WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.waitForConnectResult() != WL_CONNECTED) { while (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("Connection Failed! Rebooting..."); Serial.println("Connection Failed! Rebooting...");
showInsideInfo("W:Failed");
delay(5000); delay(5000);
ESP.restart(); ESP.restart();
} }
showInsideInfo("W:Connected");
ArduinoOTA.onStart([]() { ArduinoOTA.onStart([]() {
Serial.println("Start"); Serial.println("Start");
showInsideInfo("[LU] Start"); showInsideInfo("LU:Start");
}); });
ArduinoOTA.onEnd([]() { ArduinoOTA.onEnd([]() {
Serial.println("\nEnd"); Serial.println("\nEnd");
showInsideInfo("[LU] Done"); showInsideInfo("LU:Restarting..");
}); });
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress:%u%%\r", (progress / (total / 100))); Serial.printf("Progress:%u%%\r", (progress / (total / 100)));
char infoBuffer[16]; char infoBuffer[LCD_COLUMNS];
sprintf(infoBuffer, "[LU] P:%u%%", (progress / (total / 100))); sprintf(infoBuffer, "LU:P:%u%%", (progress / (total / 100)));
showInsideInfo(infoBuffer); showInsideInfo(infoBuffer);
}); });
ArduinoOTA.onError([](ota_error_t error) { ArduinoOTA.onError([](ota_error_t error) {
@@ -54,21 +59,21 @@ void handleOTARemote() {
WiFiClient client; WiFiClient client;
Serial.println("Updating from remote..."); 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); t_httpUpdate_return ret = ESPhttpUpdate.update(client, "http://patient.bendtherules.in/build/esp12e/firmware.bin", VERSION_SHORT);
switch(ret) { switch(ret) {
case HTTP_UPDATE_FAILED: case HTTP_UPDATE_FAILED:
Serial.print("[update] Update failed. Reason - "); Serial.print("update:Update failed. Reason - ");
Serial.println(ESPhttpUpdate.getLastErrorString()); Serial.println(ESPhttpUpdate.getLastErrorString());
showInsideInfo("[RU] Failed"); showInsideInfo("RU:Failed");
break; break;
case HTTP_UPDATE_NO_UPDATES: case HTTP_UPDATE_NO_UPDATES:
Serial.println("[update] Update no Update."); Serial.println("update:Update no Update.");
showInsideInfo("[RU] Skip"); showInsideInfo("RU:Skip");
break; break;
case HTTP_UPDATE_OK: case HTTP_UPDATE_OK:
Serial.println("[update] Update ok."); // may not be called since we reboot the ESP Serial.println("update:Update ok."); // may not be called since we reboot the ESP
showInsideInfo("[RU] Done"); showInsideInfo("RU:Done");
break; break;
} }
} }
+1 -1
View File
@@ -1 +1 @@
39 41