diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-01-02 20:24:25 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-01-02 20:24:25 +0000 |
commit | 420b4e4be905c0e0930ec74201e680defb091234 (patch) | |
tree | 71ada7f0edb977e47097962b09db095656cd2dbe /firmware/powermgmt.c | |
parent | 3b79698f19ffbfad07b1a0b74e1a13fbf2cedc92 (diff) |
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/powermgmt.c')
-rw-r--r-- | firmware/powermgmt.c | 9 |
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(); |