Made battery_level() use the power history table to get an average battery level over the last 3 minutes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1585 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9dbd5eddd0
commit
39243bceed
2 changed files with 0 additions and 42 deletions
|
@ -37,29 +37,6 @@ bool charger_inserted(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Returns battery level in percent */
|
||||
int battery_level(void)
|
||||
{
|
||||
int level;
|
||||
|
||||
level = adc_read(ADC_UNREG_POWER);
|
||||
if(level < 0)
|
||||
level = 0;
|
||||
|
||||
if(level > BATTERY_LEVEL_FULL)
|
||||
level = BATTERY_LEVEL_FULL;
|
||||
|
||||
if(level < BATTERY_LEVEL_EMPTY)
|
||||
level = BATTERY_LEVEL_EMPTY;
|
||||
|
||||
return ((level-BATTERY_LEVEL_EMPTY) * 100) / BATTERY_RANGE;
|
||||
}
|
||||
|
||||
bool battery_level_safe(void)
|
||||
{
|
||||
return adc_read(ADC_UNREG_POWER) > BATTERY_LEVEL_DANGEROUS;
|
||||
}
|
||||
|
||||
void charger_enable(bool on)
|
||||
{
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
|
@ -105,12 +82,6 @@ bool charger_inserted(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Returns battery level in percent */
|
||||
int battery_level(void)
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
void charger_enable(bool on)
|
||||
{
|
||||
on = on;
|
||||
|
|
|
@ -19,13 +19,6 @@
|
|||
#ifndef _POWER_H_
|
||||
#define _POWER_H_
|
||||
|
||||
#define BATTERY_LEVEL_SHUTDOWN (4500000 / BATTERY_SCALE_FACTOR) /* 4.5V */
|
||||
#define BATTERY_LEVEL_EMPTY (4650000 / BATTERY_SCALE_FACTOR) /* 4.65V */
|
||||
#define BATTERY_LEVEL_DANGEROUS (4750000 / BATTERY_SCALE_FACTOR) /* 4.75V */
|
||||
#define BATTERY_LEVEL_FULL (5200000 / BATTERY_SCALE_FACTOR) /* 5.2V */
|
||||
|
||||
#define BATTERY_RANGE (BATTERY_LEVEL_FULL - BATTERY_LEVEL_EMPTY)
|
||||
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
extern bool charger_enabled;
|
||||
#endif
|
||||
|
@ -35,10 +28,4 @@ void charger_enable(bool on);
|
|||
void ide_power_enable(bool on);
|
||||
void power_off(void);
|
||||
|
||||
/* Returns battery level in percent */
|
||||
int battery_level(void);
|
||||
|
||||
/* Tells if the battery level is safe for disk writes */
|
||||
bool battery_level_safe(void);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue