avoid flickering of battery level during the first minute of uptime by taking a voltage sample at power_init

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1758 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Heikki Hannikainen 2002-08-15 11:32:01 +00:00
parent fae5b82d60
commit dd2bae49eb

View File

@ -235,6 +235,9 @@ void power_init(void)
{
/* init history to 0 */
memset(power_history, 0x00, sizeof(power_history));
/* initialize the history with a single sample to prevent level
flickering during the first minute of execution */
power_history[POWER_HISTORY_LEN-1] = (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) / 10000;
#ifdef HAVE_CHARGE_CTRL
snprintf(power_message, POWER_MESSAGE_LEN, "Powermgmt started");