1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2005-01-27 23:22:06 +00:00
parent 6660f8e910
commit 91e8ab61a0

View file

@ -31,8 +31,7 @@
/* variable button definitions */ /* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD #if CONFIG_KEYPAD == RECORDER_PAD
#define BATTERY_TEST_QUIT BUTTON_ON #define BATTERY_TEST_QUIT BUTTON_OFF
#define BATTERY_TEST_QUIT2 BUTTON_OFF
#elif CONFIG_KEYPAD == ONDIO_PAD #elif CONFIG_KEYPAD == ONDIO_PAD
#define BATTERY_TEST_QUIT BUTTON_OFF #define BATTERY_TEST_QUIT BUTTON_OFF
#elif CONFIG_KEYPAD == PLAYER_PAD #elif CONFIG_KEYPAD == PLAYER_PAD
@ -48,6 +47,11 @@ int init(void)
{ {
int f; int f;
buffer = rb->plugin_get_mp3_buffer(&buffersize); buffer = rb->plugin_get_mp3_buffer(&buffersize);
#ifdef HAVE_MMC
/* present info what's going on. MMC is slow. */
rb->splash(0, true, "Creating dummy file.");
#endif
/* create a big dummy file */ /* create a big dummy file */
f = rb->creat("/battery.dummy", 0); f = rb->creat("/battery.dummy", 0);
@ -101,24 +105,15 @@ enum plugin_status loop(void)
t->tm_hour, t->tm_min, t->tm_sec, batt); t->tm_hour, t->tm_min, t->tm_sec, batt);
rb->splash(0, true, buf); rb->splash(0, true, buf);
/* simulate 128kbit/s (16kbyte/s) playback duration */ /* simulate 128 kbit/s (16000 byte/s) playback duration */
do { rb->button_clear_queue();
button = rb->button_get_w_tmo(HZ * (buffersize / 16384) - HZ*10); button = rb->button_get_w_tmo(HZ * buffersize / 16000) - HZ*10);
switch (button) { if (button == BATTERY_TEST_QUIT)
/* Check if we shall exit the plugin */ return PLUGIN_OK;
case BATTERY_TEST_QUIT:
#ifdef BATTERY_TEST_QUIT2 if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
case BATTERY_TEST_QUIT2: return PLUGIN_USB_CONNECTED;
#endif
return PLUGIN_OK;
default:
if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
return PLUGIN_USB_CONNECTED;
break;
}
} while (!(button&(BUTTON_REL|BUTTON_REPEAT)));
/* simulate filling the mp3 buffer */ /* simulate filling the mp3 buffer */
f = rb->open("/battery.dummy", O_RDONLY); f = rb->open("/battery.dummy", O_RDONLY);