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



Rockbox mail archive

Subject: Complicated loop in powermgm.c

Complicated loop in powermgm.c

From: Uwe Freese <mail_at_uwe-freese.de>
Date: Thu, 8 Aug 2002 12:19:12 +0200

Hello,

Isn't this a little bit comlicated, or did I miss the point?

  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;

Is

(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!

Bye, Uwe.
Received on 2002-08-08

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