Rockbox mail archiveSubject: Re: Complicated loop in powermgm.c
Re: Complicated loop in powermgm.c
From: Heikki Hannikainen <hessu_at_hes.iki.fi>
Date: Fri, 9 Aug 2002 11:56:52 +0300 (EEST)
On Thu, 8 Aug 2002, Uwe Freese wrote:
> Isn't this a little bit comlicated, or did I miss the point?
My math is a bit rusted already, but I'd guess you're right about this,
the loop is not necessary. I'll fix it next week if you (or Linus or
someone else) won't do it over the weekend while I'm on the countryside
> for (i = 0; i < CHARGE_END_ZEROD; i++)
> delta += power_history[POWER_HISTORY_LEN-1-i]*100 - power_history[POWER_HISTORY_LEN-1-i-1]*100;
> (x2-x1) + (x3-x2) = (x3-x1) ?
> So instead of the loop, a
> delta = power_history[POWER_HISTORY_LEN-1]*100 - power_history[POWER_HISTORY_LEN-1-CHARGE_END_ZEROD]*100;
> will do it!
Received on 2002-08-09