diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-01-27 23:22:06 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-01-27 23:22:06 +0000 |
commit | 91e8ab61a0ec6b25350f5aac16b110e88c68ef93 (patch) | |
tree | 0384e4a5d34fb46666eeb6796ca1d5264a163594 /apps/plugins/battery_test.c | |
parent | 6660f8e91060593cfd6a50c5acf58a653bd284e0 (diff) | |
download | rockbox-91e8ab61a0ec6b25350f5aac16b110e88c68ef93.tar.gz rockbox-91e8ab61a0ec6b25350f5aac16b110e88c68ef93.zip |
Battery_test plugin: (1) Fixed the button handling to work as intended. (2) Corrected the playback buffer time calculation. (3) Display info about dummy file creation for MMC (Ondio).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5684 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/battery_test.c')
-rw-r--r-- | apps/plugins/battery_test.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/apps/plugins/battery_test.c b/apps/plugins/battery_test.c index bc6e580dcc..48aeff5249 100644 --- a/apps/plugins/battery_test.c +++ b/apps/plugins/battery_test.c | |||
@@ -31,8 +31,7 @@ | |||
31 | 31 | ||
32 | /* variable button definitions */ | 32 | /* variable button definitions */ |
33 | #if CONFIG_KEYPAD == RECORDER_PAD | 33 | #if CONFIG_KEYPAD == RECORDER_PAD |
34 | #define BATTERY_TEST_QUIT BUTTON_ON | 34 | #define BATTERY_TEST_QUIT BUTTON_OFF |
35 | #define BATTERY_TEST_QUIT2 BUTTON_OFF | ||
36 | #elif CONFIG_KEYPAD == ONDIO_PAD | 35 | #elif CONFIG_KEYPAD == ONDIO_PAD |
37 | #define BATTERY_TEST_QUIT BUTTON_OFF | 36 | #define BATTERY_TEST_QUIT BUTTON_OFF |
38 | #elif CONFIG_KEYPAD == PLAYER_PAD | 37 | #elif CONFIG_KEYPAD == PLAYER_PAD |
@@ -48,6 +47,11 @@ int init(void) | |||
48 | { | 47 | { |
49 | int f; | 48 | int f; |
50 | buffer = rb->plugin_get_mp3_buffer(&buffersize); | 49 | buffer = rb->plugin_get_mp3_buffer(&buffersize); |
50 | |||
51 | #ifdef HAVE_MMC | ||
52 | /* present info what's going on. MMC is slow. */ | ||
53 | rb->splash(0, true, "Creating dummy file."); | ||
54 | #endif | ||
51 | 55 | ||
52 | /* create a big dummy file */ | 56 | /* create a big dummy file */ |
53 | f = rb->creat("/battery.dummy", 0); | 57 | f = rb->creat("/battery.dummy", 0); |
@@ -101,24 +105,15 @@ enum plugin_status loop(void) | |||
101 | t->tm_hour, t->tm_min, t->tm_sec, batt); | 105 | t->tm_hour, t->tm_min, t->tm_sec, batt); |
102 | rb->splash(0, true, buf); | 106 | rb->splash(0, true, buf); |
103 | 107 | ||
104 | /* simulate 128kbit/s (16kbyte/s) playback duration */ | 108 | /* simulate 128 kbit/s (16000 byte/s) playback duration */ |
105 | do { | 109 | rb->button_clear_queue(); |
106 | button = rb->button_get_w_tmo(HZ * (buffersize / 16384) - HZ*10); | 110 | button = rb->button_get_w_tmo(HZ * buffersize / 16000) - HZ*10); |
107 | 111 | ||
108 | switch (button) { | 112 | if (button == BATTERY_TEST_QUIT) |
109 | /* Check if we shall exit the plugin */ | 113 | return PLUGIN_OK; |
110 | case BATTERY_TEST_QUIT: | 114 | |
111 | #ifdef BATTERY_TEST_QUIT2 | 115 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) |
112 | case BATTERY_TEST_QUIT2: | 116 | return PLUGIN_USB_CONNECTED; |
113 | #endif | ||
114 | return PLUGIN_OK; | ||
115 | |||
116 | default: | ||
117 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) | ||
118 | return PLUGIN_USB_CONNECTED; | ||
119 | break; | ||
120 | } | ||
121 | } while (!(button&(BUTTON_REL|BUTTON_REPEAT))); | ||
122 | 117 | ||
123 | /* simulate filling the mp3 buffer */ | 118 | /* simulate filling the mp3 buffer */ |
124 | f = rb->open("/battery.dummy", O_RDONLY); | 119 | f = rb->open("/battery.dummy", O_RDONLY); |