diff options
author | Michael Giacomelli <giac2000@hotmail.com> | 2010-03-16 17:13:25 +0000 |
---|---|---|
committer | Michael Giacomelli <giac2000@hotmail.com> | 2010-03-16 17:13:25 +0000 |
commit | 589abcd416165827f935c49e5c05582b2c35e9eb (patch) | |
tree | 61b25666deb1140a8a34f7118924edd16dbf969c /firmware/powermgmt.c | |
parent | 3b5418e8145152158fc6f72bace1eb8d4a7cb13e (diff) | |
download | rockbox-589abcd416165827f935c49e5c05582b2c35e9eb.tar.gz rockbox-589abcd416165827f935c49e5c05582b2c35e9eb.tar.bz2 rockbox-589abcd416165827f935c49e5c05582b2c35e9eb.zip |
Disable runtime estimation altogether when there is no runtime current defined. It doens't work and people somehow got confused by seeing obviously wrong values. Now it will just return -1 if you try to estimate runtime without having the current defined.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25222 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r-- | firmware/powermgmt.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index f8c3995e1a..f1dd83ef52 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -113,7 +113,10 @@ static long last_event_tick; static int voltage_to_battery_level(int battery_millivolts); static void battery_status_update(void); + +#ifdef CURRENT_NORMAL /*only used if we have run current*/ static int runcurrent(void); +#endif void battery_read_info(int *voltage, int *level) { @@ -272,6 +275,8 @@ static void battery_status_update(void) { int level = voltage_to_battery_level(battery_millivolts); +#ifdef CURRENT_NORMAL /*don't try to estimate run or charge + time without normal current defined*/ /* calculate estimated remaining running time */ #if CONFIG_CHARGING >= CHARGING_MONITOR if (charging_state()) { @@ -281,6 +286,7 @@ static void battery_status_update(void) } else #endif + /* discharging: remaining running time */ if (battery_millivolts > percent_to_volt_discharge[0][0]) { /* linear extrapolation */ @@ -290,6 +296,9 @@ static void battery_status_update(void) if (0 > powermgmt_est_runningtime_min) { powermgmt_est_runningtime_min = 0; } +#else + powermgmt_est_runningtime_min=-1; +#endif battery_percent = level; send_battery_level_event(); @@ -364,14 +373,14 @@ static void handle_auto_poweroff(void) } } +#ifdef CURRENT_NORMAL /*check that we have a current defined in a config file*/ + /* * Estimate how much current we are drawing just to run. */ static int runcurrent(void) { - int current; - - current = CURRENT_NORMAL; + int current = CURRENT_NORMAL; #ifndef BOOTLOADER if (usb_inserted() @@ -406,10 +415,11 @@ static int runcurrent(void) current += CURRENT_REMOTE; #endif #endif /* BOOTLOADER */ - + return current; } +#endif /* CURRENT_NORMAL */ /* Check to see whether or not we've received an alarm in the last second */ #ifdef HAVE_RTC_ALARM |