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 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
|
#ifndef BUILD_NUMBER
|
||||||
#define BUILD_NUMBER 32
|
#define BUILD_NUMBER 39
|
||||||
#endif
|
#endif
|
||||||
#ifndef VERSION
|
#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
|
#endif
|
||||||
#ifndef VERSION_SHORT
|
#ifndef VERSION_SHORT
|
||||||
#define VERSION_SHORT "v0.1.32"
|
#define VERSION_SHORT "v0.1.39"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ void handleKeyPress(char pressedKey) {
|
|||||||
if (pressedKey == 'R') {
|
if (pressedKey == 'R') {
|
||||||
Serial.println("Pressed restart. Rstarting..");
|
Serial.println("Pressed restart. Rstarting..");
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
|
showInsideInfo("Restarting..");
|
||||||
playBuzzer(BUZZER_PIN, TONE_BEEP_LONG);
|
playBuzzer(BUZZER_PIN, TONE_BEEP_LONG);
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-2
@@ -174,9 +174,16 @@ void showOutsideNumber(uint8_t number) {
|
|||||||
FastLED.show();
|
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) {
|
void showInsideNumber(int number) {
|
||||||
lcd.clear();
|
clearLCDLine(0);
|
||||||
lcd.setCursor(0,0);
|
|
||||||
lcd.print(number);
|
lcd.print(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,6 +192,11 @@ void showNumber(uint8_t number) {
|
|||||||
showInsideNumber(number);
|
showInsideNumber(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showInsideInfo(const char* text) {
|
||||||
|
clearLCDLine(1);
|
||||||
|
lcd.print(text);
|
||||||
|
}
|
||||||
|
|
||||||
void setupDisplay() {
|
void setupDisplay() {
|
||||||
// LED matrix setup
|
// LED matrix setup
|
||||||
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
|
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <ArduinoOTA.h>
|
#include <ArduinoOTA.h>
|
||||||
#include <ESP8266httpUpdate.h>
|
#include <ESP8266httpUpdate.h>
|
||||||
#include <WiFiClientSecure.h>
|
#include <WiFiClientSecure.h>
|
||||||
|
#include "myDisplay.h"
|
||||||
|
|
||||||
void setupOTALocal() {
|
void setupOTALocal() {
|
||||||
Serial.println("Booting");
|
Serial.println("Booting");
|
||||||
@@ -19,12 +20,17 @@ void setupOTALocal() {
|
|||||||
}
|
}
|
||||||
ArduinoOTA.onStart([]() {
|
ArduinoOTA.onStart([]() {
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
showInsideInfo("[LU] Start");
|
||||||
});
|
});
|
||||||
ArduinoOTA.onEnd([]() {
|
ArduinoOTA.onEnd([]() {
|
||||||
Serial.println("\nEnd");
|
Serial.println("\nEnd");
|
||||||
|
showInsideInfo("[LU] Done");
|
||||||
});
|
});
|
||||||
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];
|
||||||
|
sprintf(infoBuffer, "[LU] P:%u%%", (progress / (total / 100)));
|
||||||
|
showInsideInfo(infoBuffer);
|
||||||
});
|
});
|
||||||
ArduinoOTA.onError([](ota_error_t error) {
|
ArduinoOTA.onError([](ota_error_t error) {
|
||||||
Serial.printf("Error[%u]: ", error);
|
Serial.printf("Error[%u]: ", error);
|
||||||
@@ -48,17 +54,21 @@ void handleOTARemote() {
|
|||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
|
|
||||||
Serial.println("Updating from remote...");
|
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);
|
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");
|
||||||
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");
|
||||||
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");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
32
|
39
|
||||||
Reference in New Issue
Block a user