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: Rockbox for the player
From: Heikki Hannikainen (hessu_at_hes.iki.fi)
Date: 2002-09-12


On Thu, 12 Sep 2002, Paul Suade wrote:

> Well, maybe using an average for a short time might flat the flickering
> value; I mean using a small array like a ring to put your battery level and
> computing the average that way :

  This is what we do already - see firmware/powermgmt.c. We take 4 samples
a minute, discard samples taken while the disk is spinning to smooth it
some more, calculate an average of the samples left, and put it in a table
containing one sample per minute.

  battery_level() which returns a "percentage" of battery level calculates
an average over the last three values in the table, ie. average of 3
minutes. This really does not jump up/down too much any more and is much
better than the direct voltage sample which we used before (it varied A
LOT).

  The only jump you will usually get is in the beginning after the first
minute. When the device boots, we quickly take (in power_init()) a single
sample and initialize the history table with it so that we would have
something to use before we have the first full minute sample. At
boot-time, the disk has been spinning for a while loading the firmware,
and the battery is a bit lower than average, and the next sample is
usually a bit higher than the boot-time sample. But I don't think this is
much of a problem.

  - Hessu



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa