mirror of
https://github.com/bendtherules/Patient-counter-esp8266.git
synced 2026-08-18 13:52:39 +00:00
Add lcd infos
This commit is contained in:
Binary file not shown.
+2
-1
@@ -6,4 +6,5 @@ enum DISPLAY_POSITION {
|
||||
};
|
||||
|
||||
void setupDisplay();
|
||||
void showNumber(uint8_t number);
|
||||
void showNumber(uint8_t number);
|
||||
void showInsideInfo(const char* text);
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
#ifndef BUILD_NUMBER
|
||||
#define BUILD_NUMBER 32
|
||||
#define BUILD_NUMBER 39
|
||||
#endif
|
||||
#ifndef VERSION
|
||||
#define VERSION "v0.1.32 - 2023-11-28 13:50:39.195748"
|
||||
#define VERSION "v0.1.39 - 2023-11-28 18:19:04.992246"
|
||||
#endif
|
||||
#ifndef VERSION_SHORT
|
||||
#define VERSION_SHORT "v0.1.32"
|
||||
#define VERSION_SHORT "v0.1.39"
|
||||
#endif
|
||||
|
||||
@@ -109,6 +109,7 @@ void handleKeyPress(char pressedKey) {
|
||||
if (pressedKey == 'R') {
|
||||
Serial.println("Pressed restart. Rstarting..");
|
||||
Serial.flush();
|
||||
showInsideInfo("Restarting..");
|
||||
playBuzzer(BUZZER_PIN, TONE_BEEP_LONG);
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
+14
-2
@@ -174,9 +174,16 @@ void showOutsideNumber(uint8_t number) {
|
||||
FastLED.show();
|
||||
}
|
||||
|
||||
void clearLCDLine(int line) {
|
||||
lcd.setCursor(0, line);
|
||||
for(int n = 0; n < LCD_COLUMNS; n++){
|
||||
lcd.print(" ");
|
||||
}
|
||||
lcd.setCursor(0, line);
|
||||
}
|
||||
|
||||
void showInsideNumber(int number) {
|
||||
lcd.clear();
|
||||
lcd.setCursor(0,0);
|
||||
clearLCDLine(0);
|
||||
lcd.print(number);
|
||||
}
|
||||
|
||||
@@ -185,6 +192,11 @@ void showNumber(uint8_t number) {
|
||||
showInsideNumber(number);
|
||||
}
|
||||
|
||||
void showInsideInfo(const char* text) {
|
||||
clearLCDLine(1);
|
||||
lcd.print(text);
|
||||
}
|
||||
|
||||
void setupDisplay() {
|
||||
// LED matrix setup
|
||||
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <ArduinoOTA.h>
|
||||
#include <ESP8266httpUpdate.h>
|
||||
#include <WiFiClientSecure.h>
|
||||
#include "myDisplay.h"
|
||||
|
||||
void setupOTALocal() {
|
||||
Serial.println("Booting");
|
||||
@@ -19,12 +20,17 @@ void setupOTALocal() {
|
||||
}
|
||||
ArduinoOTA.onStart([]() {
|
||||
Serial.println("Start");
|
||||
showInsideInfo("[LU] Start");
|
||||
});
|
||||
ArduinoOTA.onEnd([]() {
|
||||
Serial.println("\nEnd");
|
||||
showInsideInfo("[LU] Done");
|
||||
});
|
||||
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)));
|
||||
showInsideInfo(infoBuffer);
|
||||
});
|
||||
ArduinoOTA.onError([](ota_error_t error) {
|
||||
Serial.printf("Error[%u]: ", error);
|
||||
@@ -48,17 +54,21 @@ void handleOTARemote() {
|
||||
WiFiClient client;
|
||||
|
||||
Serial.println("Updating from remote...");
|
||||
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.println(ESPhttpUpdate.getLastErrorString());
|
||||
showInsideInfo("[RU] Failed");
|
||||
break;
|
||||
case HTTP_UPDATE_NO_UPDATES:
|
||||
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");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
32
|
||||
39
|
||||
Reference in New Issue
Block a user