Merge pull request #17 from DooMMasteR/master

If the AXP192 is present, also display battery voltage and current.
This commit is contained in:
Kyle Gabriel 2020-03-27 21:25:37 -04:00 committed by GitHub
commit f4b7577d05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,8 +39,14 @@ void _screen_header() {
display->setTextAlignment(TEXT_ALIGN_LEFT); display->setTextAlignment(TEXT_ALIGN_LEFT);
display->drawString(0, 2, buffer); display->drawString(0, 2, buffer);
// Datetime // Datetime (if the axp192 PMIC is present, alternate between powerstats and time)
gps_time(buffer, sizeof(buffer)); 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->setTextAlignment(TEXT_ALIGN_CENTER);
display->drawString(display->getWidth()/2, 2, buffer); display->drawString(display->getWidth()/2, 2, buffer);