summaryrefslogtreecommitdiffstats
path: root/firmware/powermgmt.c
diff options
context:
space:
mode:
authorBoris Gjenero <boris.gjenero@gmail.com>2012-01-21 12:10:31 -0500
committerBoris Gjenero <boris.gjenero@gmail.com>2012-01-21 12:10:31 -0500
commit109084d5cbaeee26373ecf1b765d9507ccbbe63e (patch)
tree297b433804dca819623ad50c71307ada8c07e031 /firmware/powermgmt.c
parentc7f3a0b3609f9d09e13efcce82f504ea56eb237e (diff)
downloadrockbox-109084d5cbaeee26373ecf1b765d9507ccbbe63e.tar.gz
rockbox-109084d5cbaeee26373ecf1b765d9507ccbbe63e.tar.bz2
rockbox-109084d5cbaeee26373ecf1b765d9507ccbbe63e.zip
Fix FS#12555: Use smoothed battery voltage for level and runtime calculation
The debug screen gets un-smoothed battery status via battery_read_info(). The level and runtime that is normally presented to the user needs to be based on smoothed voltage. Change-Id: Icb448853973aa1d5832e9094176938cfa12b2e48
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r--firmware/powermgmt.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index ca24740221..b31dc81624 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -281,8 +281,11 @@ static int voltage_to_battery_level(int battery_millivolts)
static void battery_status_update(void)
{
- int millivolt, level;
- battery_read_info(&millivolt, &level);
+ int millivolt = battery_voltage();
+ int level = _battery_level();
+
+ if (level < 0)
+ level = voltage_to_battery_level(millivolt);
#ifdef CURRENT_NORMAL /*don't try to estimate run or charge
time without normal current defined*/