From 6c2b2b6c5fbeff7d875b5bdc21b38fe6381b58e1 Mon Sep 17 00:00:00 2001 From: Tony Mamacos Date: Thu, 16 Jan 2020 15:23:04 +0200 Subject: [PATCH] Save the battery code put in place --- game.cpp | 4 ++-- platform/esp32.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/game.cpp b/game.cpp index 50a58d1..ad9b3dc 100644 --- a/game.cpp +++ b/game.cpp @@ -255,8 +255,8 @@ void gameLoop() } drawString(gameBuff,(char*)"LOW BATTERY!",0,0,0xE0,0); - drawString(gameBuff,(char*)"PLEASE CHARGE!",0,0,0xE0,0); - + drawString(gameBuff,(char*)"PLEASE CHARGE!",0,16,0xE0,0); + return; } calcFPS(); diff --git a/platform/esp32.h b/platform/esp32.h index 27e6047..5d2767b 100644 --- a/platform/esp32.h +++ b/platform/esp32.h @@ -38,7 +38,7 @@ static float battery_voltage = 0.0f; static uint64_t timeStamp = 0; float getVoltage() { - if (millis() - timeStamp > 10000) { + if (millis() - timeStamp > 2000) { float v = ((float)analogRead(ADC_PIN) / 4095.0) * 2.0 * 3.3 * (vref / 1000.0); if (v > 0) { battery_voltage = v;