1
0
Fork 0
forked from len0rd/rockbox

Part of patch #1407541 to improve battery smoothing by absorbing extra precision from the battery scale factor

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8372 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Brandon Low 2006-01-18 16:48:54 +00:00
parent b8530435ec
commit ccc72cc2d0

View file

@ -544,12 +544,12 @@ static void power_thread_sleep(int ticks)
*/ */
if (!ata_disk_is_active() || usb_inserted()) { if (!ata_disk_is_active() || usb_inserted()) {
avgbat = avgbat - (avgbat / BATT_AVE_SAMPLES) + avgbat = avgbat - (avgbat / BATT_AVE_SAMPLES) +
adc_read(ADC_UNREG_POWER); adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR;
/* /*
* battery_centivolts is the centivolt-scaled filtered battery value. * battery_centivolts is the centivolt-scaled filtered battery value.
*/ */
battery_centivolts = ((avgbat / BATT_AVE_SAMPLES) * battery_centivolts = avgbat / BATT_AVE_SAMPLES / 10000;
BATTERY_SCALE_FACTOR) / 10000;
} }
#if defined(DEBUG_FILE) && defined(HAVE_CHARGE_CTRL) #if defined(DEBUG_FILE) && defined(HAVE_CHARGE_CTRL)
/* /*
@ -585,8 +585,9 @@ static void power_thread(void)
/* initialize the voltages for the exponential filter */ /* initialize the voltages for the exponential filter */
avgbat = adc_read(ADC_UNREG_POWER) * BATT_AVE_SAMPLES; avgbat = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR *
battery_centivolts = ((avgbat / BATT_AVE_SAMPLES) * BATTERY_SCALE_FACTOR) / 10000; BATT_AVE_SAMPLES;
battery_centivolts = avgbat / BATT_AVE_SAMPLES / 10000;
#if defined(DEBUG_FILE) && defined(HAVE_CHARGE_CTRL) #if defined(DEBUG_FILE) && defined(HAVE_CHARGE_CTRL)
fd = -1; fd = -1;