From 7a9dbb3b1fed9523b090ea1c483f622cc0b5eac6 Mon Sep 17 00:00:00 2001 From: Steffen Arntz Date: Thu, 5 Mar 2020 11:09:03 +0100 Subject: [PATCH] when the AXP192 is present, also display battery voltage and current. this will give a good estimate on the current battery state. --- main/screen.ino | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main/screen.ino b/main/screen.ino index 9663689..5538895 100644 --- a/main/screen.ino +++ b/main/screen.ino @@ -39,8 +39,14 @@ void _screen_header() { display->setTextAlignment(TEXT_ALIGN_LEFT); display->drawString(0, 2, buffer); - // Datetime - gps_time(buffer, sizeof(buffer)); + // Datetime (if the axp192 PMIC is present, alternate between powerstats and time) + if(axp192_found && millis()%8000 < 3000){ + snprintf(buffer, sizeof(buffer), "%.1fV %.0fmA", axp.getBattVoltage()/1000, axp.getBattChargeCurrent() - axp.getBattDischargeCurrent()); + + } else { + gps_time(buffer, sizeof(buffer)); + } + display->setTextAlignment(TEXT_ALIGN_CENTER); display->drawString(display->getWidth()/2, 2, buffer);