forked from len0rd/rockbox
m:robe 100 - remove ugly workaround for false initial voltage readings and wait until readings have settled instead
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16626 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c194b388fa
commit
6a6c820f5f
2 changed files with 4 additions and 6 deletions
|
|
@ -798,6 +798,9 @@ static void power_thread(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Delay reading the first battery level */
|
/* Delay reading the first battery level */
|
||||||
|
#ifdef MROBE_100
|
||||||
|
while(battery_adc_voltage()>4200) /* gives false readings initially */
|
||||||
|
#endif
|
||||||
sleep(HZ/100);
|
sleep(HZ/100);
|
||||||
|
|
||||||
/* initialize the voltages for the exponential filter */
|
/* initialize the voltages for the exponential filter */
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,6 @@
|
||||||
#include "adc.h"
|
#include "adc.h"
|
||||||
#include "powermgmt.h"
|
#include "powermgmt.h"
|
||||||
|
|
||||||
/* FIXME: All voltages copied from H10/Tatung Elio. This will need changing
|
|
||||||
proper power management. */
|
|
||||||
|
|
||||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||||
{
|
{
|
||||||
3450
|
3450
|
||||||
|
|
@ -61,7 +58,5 @@ const unsigned short percent_to_volt_charge[11] =
|
||||||
/* Returns battery voltage from ADC [millivolts] */
|
/* Returns battery voltage from ADC [millivolts] */
|
||||||
unsigned int battery_adc_voltage(void)
|
unsigned int battery_adc_voltage(void)
|
||||||
{
|
{
|
||||||
/* work around the inital (false) high readout */
|
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||||
int readout=adc_read(ADC_UNREG_POWER);
|
|
||||||
return (readout>700) ? 3480 : (readout * BATTERY_SCALE_FACTOR) >> 10;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue