forked from len0rd/rockbox
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
This commit is contained in:
parent
3b79698f19
commit
420b4e4be9
1 changed files with 3 additions and 6 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue