summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorHeikki Hannikainen <hessuh@rockbox.org>2002-08-15 11:32:01 +0000
committerHeikki Hannikainen <hessuh@rockbox.org>2002-08-15 11:32:01 +0000
commitdd2bae49ebfbe44bf91c8444bc74ffaa600f8ae1 (patch)
tree7c692769299cf30428c85025db8d1f260cd5e287 /firmware
parentfae5b82d604779dd25ea8f1dcaa5a543eff86531 (diff)
downloadrockbox-dd2bae49ebfbe44bf91c8444bc74ffaa600f8ae1.tar.gz
rockbox-dd2bae49ebfbe44bf91c8444bc74ffaa600f8ae1.zip
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
Diffstat (limited to 'firmware')
-rw-r--r--firmware/powermgmt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index df796f9140..8791338ab4 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -235,6 +235,9 @@ void power_init(void)
235{ 235{
236 /* init history to 0 */ 236 /* init history to 0 */
237 memset(power_history, 0x00, sizeof(power_history)); 237 memset(power_history, 0x00, sizeof(power_history));
238 /* initialize the history with a single sample to prevent level
239 flickering during the first minute of execution */
240 power_history[POWER_HISTORY_LEN-1] = (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) / 10000;
238 241
239#ifdef HAVE_CHARGE_CTRL 242#ifdef HAVE_CHARGE_CTRL
240 snprintf(power_message, POWER_MESSAGE_LEN, "Powermgmt started"); 243 snprintf(power_message, POWER_MESSAGE_LEN, "Powermgmt started");