FS#8871 by Tomasz Wasilczyk, avoid negative runtime estimation (that would later be cast to an unsigned giving huge values

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17080 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nils Wallménius 2008-04-12 07:14:13 +00:00
parent ef97db1011
commit 02eb1d83a7
2 changed files with 5 additions and 0 deletions

View file

@ -386,6 +386,7 @@ Andreas Müller
Christopher Williams
Martin Ritter
Justin Hannigan
Tomasz Wasilczyk
The libmad team

View file

@ -478,6 +478,10 @@ static void battery_status_update(void)
if ((battery_millivolts + 20) > percent_to_volt_discharge[0][0])
powermgmt_est_runningtime_min = (level + battery_percent) * 60 *
battery_capacity / 200 / runcurrent();
else if (battery_millivolts <= battery_level_shutoff[0])
powermgmt_est_runningtime_min = 0;
else
powermgmt_est_runningtime_min = (battery_millivolts -
battery_level_shutoff[0]) / 2;