summaryrefslogtreecommitdiff
path: root/apps/plugins/test_boost.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-04-01 17:50:36 +0000
committerThomas Martitz <kugel@rockbox.org>2010-04-01 17:50:36 +0000
commit44e48393665f5fdb0dbe93fdab5f9b94057ad658 (patch)
treedc0b5e16af81374a71d04a608414c9273b33e778 /apps/plugins/test_boost.c
parenteef7f343c24ecd4597f6fd7e9b16ea81d38dab52 (diff)
Fix test_boost boost handling. Also show the number of loops per second.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25429 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/test_boost.c')
-rw-r--r--apps/plugins/test_boost.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/apps/plugins/test_boost.c b/apps/plugins/test_boost.c
index 0cd2696e33..cd38932b1b 100644
--- a/apps/plugins/test_boost.c
+++ b/apps/plugins/test_boost.c
@@ -29,32 +29,46 @@ enum plugin_status plugin_start(const void* parameter)
bool done = false;
bool boost = false;
int count = 0;
+ int last_count = 0;
+ int last_tick = *rb->current_tick;
+ int per_sec = 0;
rb->lcd_setfont(FONT_SYSFIXED);
while (!done)
{
- char buf[32];
int j,x;
for (j=1; j<100000; j++)
x = j*11;
- rb->lcd_clear_display();
- rb->snprintf(buf,sizeof buf, "%s %d",boost?"boost":"normal",count);
- rb->lcd_putsxy(0, 0, buf);
- rb->lcd_update();
+ rb->screens[0]->clear_display();
+ rb->screens[0]->putsf(0, 0, "%s: %d",boost?"boost":"normal",count);
+ if (TIME_AFTER(*rb->current_tick, last_tick+HZ))
+ {
+ last_tick = *rb->current_tick;
+ per_sec = count-last_count;
+ last_count = count;
+ }
+ rb->screens[0]->putsf(0, 1, "loops/s: %d", per_sec);
+ rb->screens[0]->update();
count++;
int button = rb->button_get(false);
switch (button)
{
case BUTTON_UP:
- boost = true;
- rb->cpu_boost(boost);
+ if (!boost)
+ {
+ rb->cpu_boost(true);
+ boost = true;
+ }
break;
case BUTTON_DOWN:
- boost = false;
- rb->cpu_boost(boost);
+ if (boost)
+ {
+ rb->cpu_boost(false);
+ boost = false;
+ }
break;
case BUTTON_LEFT: