summaryrefslogtreecommitdiff
path: root/apps/debug_menu.c
diff options
context:
space:
mode:
authorHeikki Hannikainen <hessuh@rockbox.org>2002-08-13 16:06:29 +0000
committerHeikki Hannikainen <hessuh@rockbox.org>2002-08-13 16:06:29 +0000
commit9872b66cd100dce18e2e6f4f77ee2beaa50b8075 (patch)
tree6f76e19ceb058560c956a679bc716d6a14c61939 /apps/debug_menu.c
parent677c5cc3b585853a81f1718e603a2b5d93d5b5c8 (diff)
downloadrockbox-9872b66cd100dce18e2e6f4f77ee2beaa50b8075.zip
rockbox-9872b66cd100dce18e2e6f4f77ee2beaa50b8075.tar.gz
rockbox-9872b66cd100dce18e2e6f4f77ee2beaa50b8075.tar.bz2
rockbox-9872b66cd100dce18e2e6f4f77ee2beaa50b8075.tar.xz
Use average of two samples at both ends of the range for calculating smoother delta values.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1716 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r--apps/debug_menu.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index cc1ca2c..c557129 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -507,15 +507,19 @@ void view_battery(void)
lcd_puts(0, 4, buf);
#endif
y = ( power_history[POWER_HISTORY_LEN-1] * 100
+ + power_history[POWER_HISTORY_LEN-2] * 100
+ - power_history[POWER_HISTORY_LEN-1-CHARGE_END_NEGD+1] * 100
- power_history[POWER_HISTORY_LEN-1-CHARGE_END_NEGD] * 100 )
- / CHARGE_END_NEGD;
+ / CHARGE_END_NEGD / 2;
snprintf(buf, 30, "short delta: %d", y);
lcd_puts(0, 5, buf);
y = ( power_history[POWER_HISTORY_LEN-1] * 100
+ + power_history[POWER_HISTORY_LEN-2] * 100
+ - power_history[POWER_HISTORY_LEN-1-CHARGE_END_ZEROD+1] * 100
- power_history[POWER_HISTORY_LEN-1-CHARGE_END_ZEROD] * 100 )
- / CHARGE_END_ZEROD;
+ / CHARGE_END_ZEROD / 2;
snprintf(buf, 30, "long delta: %d", y);
lcd_puts(0, 6, buf);