Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Charging, etc (Re: Why rockbox is playing with my battery level ?)

Re: Charging, etc (Re: Why rockbox is playing with my battery level ?)

From: Magnus Holmgren <lear_at_algonet.se>
Date: Wed, 06 Aug 2003 12:08:07 +0200

idc-dragon_at_gmx.de wrote:

> Hardeeps' point was that Linus once deliberately moved power_init() down, in
> the cvs comment he wrote: "Moved the power_init() call to after the
> mpeg_init() call, this is supposed to solve the startup voltage bug".
> I don't see the charging related to mpeg_init(), but there may be an old bug
> which was circumvented instead of fixed. I'd be curious on what Linus may
> have to say about this.

I noticed that the move made a difference, and later on found out why:
adc_init starts a ticker task that does the ADC conversions. This meant
the power level wasn't available until after 7 or 8 ticks, so power_init
didn't get any reasonable value to initialize the power history unless
it was called after mpeg_init (giving the ADC ticker task the time it
needed). This was the "startup voltage bug" (battery level started off
from zero, to slowly increase to the proper level over a number of minutes).

I sent in a patch to do a better fix, which is to do a conversion of all
values in adc_init (it was applied by you, IIRC :). This shouldn't mess
things up, but it does change the power level seen by power_init a bit,
since the power measurment is done earlier (before the HD has been started).

Btw, looking at powermgmt.c, I saw something interesting:

     if (battery_level_cached == -1) { /* first run of this procedure */
         /* the battery voltage is usually a little lower directly after
            turning on, because the disk was used heavily raise it by 5 % */
         battery_level_cached = (level > 95) ? 100 : level + 5;

This isn't quite true any more, since the first run is now before the HD
has been started...

-- 
Magnus Holmgren
Received on 2003-08-06

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy