You've already forked TEF6686_ESP32
Better way
This way will respond faster
This commit is contained in:
@@ -3979,11 +3979,10 @@ void ShowBattery() {
|
||||
return;
|
||||
}
|
||||
|
||||
int16_t batteryadc = analogRead(BATTERY_PIN);
|
||||
battery = map(constrain(batteryadc, BAT_LEVEL_EMPTY, BAT_LEVEL_FULL), BAT_LEVEL_EMPTY, BAT_LEVEL_FULL, 0, BAT_LEVEL_STAGE);
|
||||
battery = map(constrain(analogRead(BATTERY_PIN), BAT_LEVEL_EMPTY, BAT_LEVEL_FULL), BAT_LEVEL_EMPTY, BAT_LEVEL_FULL, 0, BAT_LEVEL_STAGE);
|
||||
if (batteryold != battery) {
|
||||
if (batterydetect) {
|
||||
if (batteryadc < BAT_LEVEL_WARN) {
|
||||
if (battery == 0) {
|
||||
tft.drawRect(300, 8, 12, 20, TFT_RED);
|
||||
tft.fillRect(303, 4, 6, 4, TFT_RED);
|
||||
tft.fillRect(302, 10, 8, 16, TFT_BLACK);
|
||||
|
||||
Reference in New Issue
Block a user