summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2010-01-02 20:24:25 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2010-01-02 20:24:25 +0000
commit420b4e4be905c0e0930ec74201e680defb091234 (patch)
tree71ada7f0edb977e47097962b09db095656cd2dbe /firmware
parent3b79698f19ffbfad07b1a0b74e1a13fbf2cedc92 (diff)
downloadrockbox-420b4e4be905c0e0930ec74201e680defb091234.tar.gz
rockbox-420b4e4be905c0e0930ec74201e680defb091234.tar.bz2
rockbox-420b4e4be905c0e0930ec74201e680defb091234.zip
Submit FS#10718. Small fix to calculation of estimated runtime to avoid negative results.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24146 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/powermgmt.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 041fed0361..5f488810ac 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -282,17 +282,14 @@ static void battery_status_update(void)
else
#endif
/* discharging: remaining running time */
- if ((battery_millivolts + 20) > percent_to_volt_discharge[0][0]) {
+ if (battery_millivolts > percent_to_volt_discharge[0][0]) {
+ /* linear extrapolation */
powermgmt_est_runningtime_min = (level + battery_percent)*60
* battery_capacity / 200 / runcurrent();
}
- else if (battery_millivolts <= battery_level_shutoff[0]) {
+ if (0 > powermgmt_est_runningtime_min) {
powermgmt_est_runningtime_min = 0;
}
- else {
- powermgmt_est_runningtime_min =
- (battery_millivolts - battery_level_shutoff[0]) / 2;
- }
battery_percent = level;
send_battery_level_event();