dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: Rockbox for the player

Re: Rockbox for the player

From: Heikki Hannikainen <>
Date: Thu, 12 Sep 2002 09:50:30 +0300 (EEST)

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

  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
Received on 2002-09-12

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