diff options
Diffstat (limited to 'apps/plugins/battery_test.c')
-rw-r--r-- | apps/plugins/battery_test.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/apps/plugins/battery_test.c b/apps/plugins/battery_test.c index 04be9b0070..bc6e580dcc 100644 --- a/apps/plugins/battery_test.c +++ b/apps/plugins/battery_test.c | |||
@@ -29,6 +29,16 @@ | |||
29 | to watch. | 29 | to watch. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | /* variable button definitions */ | ||
33 | #if CONFIG_KEYPAD == RECORDER_PAD | ||
34 | #define BATTERY_TEST_QUIT BUTTON_ON | ||
35 | #define BATTERY_TEST_QUIT2 BUTTON_OFF | ||
36 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
37 | #define BATTERY_TEST_QUIT BUTTON_OFF | ||
38 | #elif CONFIG_KEYPAD == PLAYER_PAD | ||
39 | #define BATTERY_TEST_QUIT BUTTON_STOP | ||
40 | #endif | ||
41 | |||
32 | static struct plugin_api* rb; | 42 | static struct plugin_api* rb; |
33 | 43 | ||
34 | void* buffer; | 44 | void* buffer; |
@@ -94,19 +104,19 @@ enum plugin_status loop(void) | |||
94 | /* simulate 128kbit/s (16kbyte/s) playback duration */ | 104 | /* simulate 128kbit/s (16kbyte/s) playback duration */ |
95 | do { | 105 | do { |
96 | button = rb->button_get_w_tmo(HZ * (buffersize / 16384) - HZ*10); | 106 | button = rb->button_get_w_tmo(HZ * (buffersize / 16384) - HZ*10); |
97 | |||
98 | /* Check if we shall exit the plugin */ | ||
99 | if (button==BUTTON_ON || | ||
100 | #if CONFIG_KEYPAD == RECORDER_PAD | ||
101 | button==BUTTON_OFF | ||
102 | #else | ||
103 | button==BUTTON_STOP | ||
104 | #endif | ||
105 | ) | ||
106 | return PLUGIN_OK; | ||
107 | 107 | ||
108 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { | 108 | switch (button) { |
109 | return PLUGIN_USB_CONNECTED; | 109 | /* Check if we shall exit the plugin */ |
110 | case BATTERY_TEST_QUIT: | ||
111 | #ifdef BATTERY_TEST_QUIT2 | ||
112 | case BATTERY_TEST_QUIT2: | ||
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; | ||
110 | } | 120 | } |
111 | } while (!(button&(BUTTON_REL|BUTTON_REPEAT))); | 121 | } while (!(button&(BUTTON_REL|BUTTON_REPEAT))); |
112 | 122 | ||