Battery percentage based on real measurements

This commit is contained in:
Krzysiek Egzmont
2023-09-27 00:09:20 +02:00
parent 99ef859a52
commit 634fe4b883
8 changed files with 53 additions and 20 deletions

View File

@@ -669,8 +669,7 @@ void UI_DisplayMenu(void)
{ // 2nd text line .. percentage
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage;
const uint16_t percent = (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v);
const uint16_t percent = BATTERY_VoltsToPercent(gBatteryVoltageAverage);
sprintf(String, "%u%%", percent);
UI_PrintString(String, menu_item_x1, menu_item_x2, 3, 8);
#if 0