summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-10-22 00:22:07 +0000
committerJens Arnold <amiconn@rockbox.org>2004-10-22 00:22:07 +0000
commit2afdf95401e243373050b9bda554e8f216664fd0 (patch)
treea0ce4423108d03d7c556ded59604dbb6cdf54de2
parent3a931c113f88009ba8b468f11bd6ebe3d02a4b70 (diff)
downloadrockbox-2afdf95401e243373050b9bda554e8f216664fd0.tar.gz
rockbox-2afdf95401e243373050b9bda554e8f216664fd0.zip
Plugin rework 5: (all) Now using the default event handler, standard placement is in switch() default case. (splitedit,star,vu_meter) Compile-time keyboard configuration, for Ondio adaption. (splitedit) Timing kludge for MMC. (star) Completed USB support.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5321 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/SOURCES6
-rw-r--r--apps/plugins/euroconverter.c19
-rw-r--r--apps/plugins/jackpot.c15
-rw-r--r--apps/plugins/nim.c17
-rw-r--r--apps/plugins/splitedit.c96
-rw-r--r--apps/plugins/star.c190
-rw-r--r--apps/plugins/vu_meter.c48
7 files changed, 285 insertions, 106 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 0e6ecdd74b..1ce417d847 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -31,7 +31,10 @@ snake2.c
snow.c
sokoban.c
solitaire.c
+splitedit.c
+star.c
video.c
+vu_meter.c
#ifdef HAVE_RTC /* Recorder models only */
calendar.c
@@ -40,9 +43,6 @@ clock.c
#if CONFIG_KEYPAD != ONDIO_PAD
/* gradually bring in the ones not working yet */
-splitedit.c
-star.c
-vu_meter.c
wormlet.c
#endif /* #if CONFIG_KEYPAD != ONDIO_PAD */
#endif /*#ifdef HAVE_LCD_BITMAP */
diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c
index ccf37ae7e0..a417015606 100644
--- a/apps/plugins/euroconverter.c
+++ b/apps/plugins/euroconverter.c
@@ -381,8 +381,10 @@ static int euro_menu(void)
/* Call when the program end */
-static void euro_exit(void)
+static void euro_exit(void *parameter)
{
+ (void)parameter;
+
//Restore the old pattern (i don't find another way to do this. An idea?)
rb->lcd_unlock_pattern(heuro);
rb->lcd_unlock_pattern(hhome);
@@ -397,6 +399,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
bool end, pos;
long long e,h,old_e,old_h;
+ int button;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
@@ -439,7 +442,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
/*Main loop*/
while(end!=true)
{
- switch (rb->button_get(true))
+ button = rb->button_get(true);
+ switch (button)
{
case BUTTON_MENU|BUTTON_REL:
switch (euro_menu())
@@ -586,10 +590,11 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
}
break;
- case SYS_USB_CONNECTED:
- rb->usb_screen();
- euro_exit();
- return PLUGIN_USB_CONNECTED;
+ default:
+ if (rb->default_event_handler_ex(button, euro_exit, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
+ break;
}
/*Display*/
if (!pos) /*Euro>home*/
@@ -598,7 +603,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
e=mydiv(h,currency[country]);
display(e,h,pos);
}
- euro_exit();
+ euro_exit(NULL);
return PLUGIN_OK;
}
diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c
index 7cf6e10588..e392c3b35a 100644
--- a/apps/plugins/jackpot.c
+++ b/apps/plugins/jackpot.c
@@ -64,8 +64,10 @@ static void display_first_line(int g)
}
/*Call when the program exit*/
-static void jackpot_exit(void)
+static void jackpot_exit(void *parameter)
{
+ (void)parameter;
+
/* Restore the old pattern (i don't find another way to do this. Any
idea?) */
rb->lcd_unlock_pattern(h1);
@@ -154,10 +156,11 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
}
break;
- case SYS_USB_CONNECTED:
- rb->usb_screen();
- jackpot_exit();
- return PLUGIN_USB_CONNECTED;
+ default:
+ if (rb->default_event_handler_ex(button, jackpot_exit,
+ NULL) == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
+ break;
}
}
@@ -270,7 +273,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
}
/* This is the end */
- jackpot_exit();
+ jackpot_exit(NULL);
/* Bye */
return PLUGIN_OK;
}
diff --git a/apps/plugins/nim.c b/apps/plugins/nim.c
index 13cc51d299..48e0937908 100644
--- a/apps/plugins/nim.c
+++ b/apps/plugins/nim.c
@@ -118,8 +118,10 @@ static void display_first_line(int x)
}
/* Call when the program end */
-static void nim_exit(void)
+static void nim_exit(void *parameter)
{
+ (void)parameter;
+
/*Restore the old pattern*/
rb->lcd_unlock_pattern(h1);
rb->lcd_unlock_pattern(h2);
@@ -194,7 +196,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
case BUTTON_STOP|BUTTON_REL:
go = true;
- nim_exit();
+ nim_exit(NULL);
return PLUGIN_OK;
break;
@@ -214,10 +216,11 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
y++;
break;
- case SYS_USB_CONNECTED:
- rb->usb_screen();
- nim_exit();
- return PLUGIN_USB_CONNECTED;
+ default:
+ if (rb->default_event_handler_ex(button, nim_exit,
+ NULL) == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
+ break;
}
display_first_line(x);
rb->snprintf(str,sizeof(str),"[%d..%d]?=%d",min,v,y);
@@ -289,7 +292,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
min=1;
}
}
- nim_exit();
+ nim_exit(NULL);
return PLUGIN_OK;
}
#endif
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c
index 24b2b6939f..6f1631f6e2 100644
--- a/apps/plugins/splitedit.c
+++ b/apps/plugins/splitedit.c
@@ -22,6 +22,29 @@
#ifndef SIMULATOR
#ifdef HAVE_LCD_BITMAP
+/* variable button definitions */
+#if CONFIG_KEYPAD == RECORDER_PAD
+#define SPLITEDIT_QUIT BUTTON_OFF
+#define SPLITEDIT_PLAY BUTTON_PLAY
+#define SPLITEDIT_SAVE BUTTON_F1
+#define SPLITEDIT_LOOP_MODE BUTTON_F2
+#define SPLITEDIT_SCALE BUTTON_F3
+#define SPLITEDIT_SPEED50 (BUTTON_ON | BUTTON_LEFT)
+#define SPLITEDIT_SPEED100 (BUTTON_ON | BUTTON_PLAY)
+#define SPLITEDIT_SPEED150 (BUTTON_ON | BUTTON_RIGHT)
+#define SPLITEDIT_MENU_RUN BUTTON_PLAY
+
+#elif CONFIG_KEYPAD == ONDIO_PAD
+#define SPLITEDIT_QUIT BUTTON_OFF
+#define SPLITEDIT_PLAY_PRE BUTTON_MENU
+#define SPLITEDIT_PLAY (BUTTON_MENU | BUTTON_REL)
+#define SPLITEDIT_SAVE (BUTTON_MENU | BUTTON_LEFT)
+#define SPLITEDIT_LOOP_MODE (BUTTON_MENU | BUTTON_UP)
+#define SPLITEDIT_SCALE (BUTTON_MENU | BUTTON_RIGHT)
+#define SPLITEDIT_MENU_RUN BUTTON_RIGHT
+
+#endif
+
#define BMPHEIGHT 7
#define BMPWIDTH 13
unsigned char LOOP_BMP[][13] =
@@ -499,7 +522,7 @@ static void generateFileName(char* file_name, int part_no)
}
else
{
- rb->splash(0, true, "name to long");
+ rb->splash(0, true, "name too long");
rb->button_get(true);
rb->button_get(true);
@@ -765,7 +788,7 @@ static void save_editor(struct mp3entry *mp3, int splittime)
choice = (choice + 1) % SE_COUNT;
break;
- case BUTTON_PLAY:
+ case SPLITEDIT_MENU_RUN:
switch (choice)
{
int saved;
@@ -806,9 +829,17 @@ static void save_editor(struct mp3entry *mp3, int splittime)
}
break;
- case BUTTON_OFF:
+ case SPLITEDIT_QUIT:
exit_request = true;
break;
+
+ default:
+ if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
+ {
+ splitedit_exit_code = PLUGIN_USB_CONNECTED;
+ exit_request = true;
+ }
+ break;
}
}
}
@@ -821,6 +852,7 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
unsigned int range)
{
int button = BUTTON_NONE;
+ int lastbutton = BUTTON_NONE;
struct mp3entry *mp3 = mp3_to_split;
unsigned int last_elapsed = 0;
int lastx = OSCI_X + (OSCI_WIDTH / 2);
@@ -943,12 +975,24 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
case LOOP_MODE_TO:
rb->mpeg_pause();
rb->mpeg_ff_rewind(range_start);
+#ifdef HAVE_MMC
+/* MMC is slow - wait some time to allow track reload to finish */
+ rb->sleep(HZ/20);
+ if (mp3->elapsed > play_end) /* reload in progress */
+ rb->splash(10*HZ, true, "Wait - reloading");
+#endif
rb->mpeg_resume();
break;
case LOOP_MODE_FROM:
rb->mpeg_pause();
rb->mpeg_ff_rewind(xpos_to_time(split_x));
+#ifdef HAVE_MMC
+/* MMC is slow - wait some time to allow track reload to finish */
+ rb->sleep(HZ/20);
+ if (mp3->elapsed > play_end) /* reload in progress */
+ rb->splash(10*HZ, true, "Wait - reloading");
+#endif
rb->mpeg_resume();
break;
@@ -964,7 +1008,6 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
rb->lcd_update();
break;
}
-
}
}
@@ -977,17 +1020,11 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
/* key_scheme_execute(button, &scheme); */
switch (button)
{
- case SYS_USB_CONNECTED:
- rb->usb_screen();
- splitedit_exit_code = PLUGIN_USB_CONNECTED;
- exit_request = true;
- break;
-
- case BUTTON_OFF:
- exit_request = true;
- break;
-
- case BUTTON_PLAY:
+ case SPLITEDIT_PLAY:
+#ifdef SPLITEDIT_PLAY_PRE
+ if (lastbutton != SPLITEDIT_PLAY_PRE)
+ break;
+#endif
rb->mpeg_pause();
rb->mpeg_ff_rewind(xpos_to_time(split_x));
rb->mpeg_resume();
@@ -1004,21 +1041,23 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
break;
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
- case BUTTON_ON | BUTTON_RIGHT:
+#if defined(SPLITEDIT_SPEED150) && defined(SPLITEDIT_SPEED100) && defined(SPLITEDIT_SPEED50)
+ case SPLITEDIT_SPEED150:
rb->mpeg_set_pitch(1500);
splitedit_invalidate_osci();
break;
- case BUTTON_ON | BUTTON_PLAY:
+ case SPLITEDIT_SPEED100:
rb->mpeg_set_pitch(1000);
splitedit_invalidate_osci();
break;
- case BUTTON_ON | BUTTON_LEFT:
+ case SPLITEDIT_SPEED50:
rb->mpeg_set_pitch(500);
splitedit_invalidate_osci();
break;
#endif
+#endif
case BUTTON_LEFT:
case BUTTON_LEFT | BUTTON_REPEAT:
@@ -1046,7 +1085,7 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
}
break;
- case BUTTON_F1 | BUTTON_REL:
+ case SPLITEDIT_SAVE:
save_editor(mp3, xpos_to_time(split_x));
rb->lcd_clear_display();
update_osci();
@@ -1054,19 +1093,34 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
update_icons();
break;
- case BUTTON_F2:
+ case SPLITEDIT_LOOP_MODE:
splitedit_set_loop_mode(splitedit_get_loop_mode() + 1);
update_icons();
break;
- case BUTTON_F3:
+ case SPLITEDIT_SCALE:
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
rb->peak_meter_set_use_dbfs(rb->peak_meter_get_use_dbfs() +1);
#endif
splitedit_invalidate_osci();
update_icons();
break;
+
+ case SPLITEDIT_QUIT:
+ exit_request = true;
+ break;
+
+ default:
+ if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
+ {
+ splitedit_exit_code = PLUGIN_USB_CONNECTED;
+ exit_request = true;
+ }
+ break;
+
}
+ if (button != BUTTON_NONE)
+ lastbutton = button;
if (validation_start == ~(unsigned int)0)
{
diff --git a/apps/plugins/star.c b/apps/plugins/star.c
index 8ab8bec0b1..e2f11a5c07 100644
--- a/apps/plugins/star.c
+++ b/apps/plugins/star.c
@@ -59,6 +59,32 @@
#define STAR_CONTROL_BALL 0
#define STAR_CONTROL_BLOCK 1
+/* variable button definitions */
+#if CONFIG_KEYPAD == RECORDER_PAD
+#define STAR_QUIT BUTTON_OFF
+#define STAR_TOGGLE_CONTROL BUTTON_ON
+#define STAR_TOGGLE_CONTROL2 BUTTON_PLAY
+#define STAR_LEVEL_UP BUTTON_F3
+#define STAR_LEVEL_DOWN BUTTON_F1
+#define STAR_LEVEL_REPEAT BUTTON_F2
+#define STAR_MENU_RUN BUTTON_PLAY
+#define STAR_MENU_RUN2 BUTTON_RIGHT
+#define STAR_MENU_RUN3 BUTTON_ON
+
+#elif CONFIG_KEYPAD == ONDIO_PAD
+#define STAR_QUIT BUTTON_OFF
+#define STAR_TOGGLE_CONTROL_PRE BUTTON_MENU
+#define STAR_TOGGLE_CONTROL (BUTTON_MENU | BUTTON_REL)
+#define STAR_LEVEL_UP (BUTTON_MENU | BUTTON_RIGHT)
+#define STAR_LEVEL_DOWN (BUTTON_MENU | BUTTON_LEFT)
+#define STAR_LEVEL_REPEAT (BUTTON_MENU | BUTTON_UP)
+#define STAR_MENU_RUN BUTTON_RIGHT
+
+#endif
+
+/* function returns because of USB? */
+static bool usb_detected = false;
+
/* position of the ball */
static int ball_x, ball_y;
@@ -328,6 +354,7 @@ static void star_display_text(char *str, bool waitkey)
int i;
char line[255];
int key;
+ bool go_on;
rb->lcd_clear_display();
@@ -384,10 +411,26 @@ static void star_display_text(char *str, bool waitkey)
{
current_line = 0;
rb->lcd_update();
- if (waitkey)
- while ((key = rb->button_get(true)) != BUTTON_PLAY
- && key != BUTTON_ON
- && key != BUTTON_DOWN);
+ go_on = false;
+ while (waitkey && !go_on)
+ {
+ key = rb->button_get(true);
+ switch (key)
+ {
+ case STAR_MENU_RUN:
+ case BUTTON_DOWN:
+ go_on = true;
+ break;
+
+ default:
+ if (rb->default_event_handler(key) == SYS_USB_CONNECTED)
+ {
+ usb_detected = true;
+ go_on = true;
+ break;
+ }
+ }
+ }
rb->lcd_clear_display();
}
} while (*ptr_char != '\0');
@@ -518,6 +561,8 @@ static int star_run_game(void)
int move_x = 0;
int move_y = 0;
int i;
+ int key;
+ int lastkey = BUTTON_NONE;
int label_offset_y;
@@ -531,58 +576,75 @@ static int star_run_game(void)
move_x = 0;
move_y = 0;
- switch (rb->button_get(true))
+ while ((move_x == 0) && (move_y == 0))
{
- case BUTTON_OFF:
- return PLUGIN_OK;
+ key = rb->button_get(true);
+ switch (key)
+ {
+ case STAR_QUIT:
+ return 0;
- case BUTTON_LEFT:
- move_x = -1;
- break;
-
- case BUTTON_RIGHT:
- move_x = 1;
- break;
+ case BUTTON_LEFT:
+ move_x = -1;
+ break;
- case BUTTON_UP:
- move_y = -1;
- break;
+ case BUTTON_RIGHT:
+ move_x = 1;
+ break;
- case BUTTON_DOWN:
- move_y = 1;
- break;
+ case BUTTON_UP:
+ move_y = -1;
+ break;
- case BUTTON_F1:
- if (current_level > 0)
- {
- current_level--;
- star_load_level(current_level);
- }
- continue;
+ case BUTTON_DOWN:
+ move_y = 1;
+ break;
- case BUTTON_F2:
- star_load_level(current_level);
- continue;
+ case STAR_LEVEL_DOWN:
+ if (current_level > 0)
+ {
+ current_level--;
+ star_load_level(current_level);
+ }
+ break;
- case BUTTON_F3:
- if (current_level < STAR_LEVEL_COUNT - 1)
- {
- current_level++;
+ case STAR_LEVEL_REPEAT:
star_load_level(current_level);
- }
- continue;
+ break;
- case BUTTON_PLAY:
- case BUTTON_ON:
- if (control == STAR_CONTROL_BALL)
- control = STAR_CONTROL_BLOCK;
- else
- control = STAR_CONTROL_BALL;
- star_display_board_info();
- continue;
+ case STAR_LEVEL_UP:
+ if (current_level < STAR_LEVEL_COUNT - 1)
+ {
+ current_level++;
+ star_load_level(current_level);
+ }
+ break;
- default:
- continue;
+ case STAR_TOGGLE_CONTROL:
+#ifdef STAR_TOGGLE_CONTROL_PRE
+ if (lastkey != STAR_TOGGLE_CONTROL_PRE)
+ break;
+#endif
+#ifdef STAR_TOGGLE_CONTROL2
+ case STAR_TOGGLE_CONTROL2:
+#endif
+ if (control == STAR_CONTROL_BALL)
+ control = STAR_CONTROL_BLOCK;
+ else
+ control = STAR_CONTROL_BALL;
+ star_display_board_info();
+ break;
+
+ default:
+ if (rb->default_event_handler(key) == SYS_USB_CONNECTED)
+ {
+ usb_detected = true;
+ return 0;
+ }
+ break;
+ }
+ if (key != BUTTON_NONE)
+ lastkey = key;
}
if (control == STAR_CONTROL_BALL)
@@ -673,6 +735,7 @@ static int star_menu(void)
unsigned char *menu[4] = {"Start", "Information", "Keys", "Exit"};
int menu_count = sizeof(menu) / sizeof(unsigned char *);
int menu_offset_y;
+ int key;
menu_offset_y = LCD_HEIGHT - char_height * menu_count;
@@ -700,9 +763,10 @@ static int star_menu(void)
rb->sleep(STAR_SLEEP);
anim_state++;
- switch (rb->button_get(false))
+ key = rb->button_get(false);
+ switch (key)
{
- case BUTTON_OFF:
+ case STAR_QUIT:
return PLUGIN_OK;
case BUTTON_UP:
if (menu_y > 0)
@@ -713,15 +777,18 @@ static int star_menu(void)
move_y = 1;
break;
- case BUTTON_ON:
- case BUTTON_PLAY:
- case BUTTON_RIGHT:
+ case STAR_MENU_RUN:
+#ifdef STAR_MENU_RUN3
+ case STAR_MENU_RUN2:
+ case STAR_MENU_RUN3:
+#endif
refresh = true;
switch (menu_y)
{
case 0:
if (!star_run_game())
- return PLUGIN_OK;
+ return usb_detected ?
+ PLUGIN_USB_CONNECTED : PLUGIN_OK;
break;
case 1:
star_display_text(
@@ -732,24 +799,33 @@ static int star_menu(void)
"take \"o\".", true);
break;
case 2:
+#if CONFIG_KEYPAD == RECORDER_PAD
star_display_text("KEYS\n\n"
"[ON] Toggle Ctl.\n"
"[OFF] Exit\n"
"[F1] Prev. level\n"
"[F2] Reset level\n"
"[F3] Next level", true);
+#elif CONFIG_KEYPAD == ONDIO_PAD
+ star_display_text("KEYS\n\n"
+ "[MENU] Toggle Ctl\n"
+ "[OFF] Exit\n"
+ "[M <] Prev. level\n"
+ "[M ^] Reset level\n"
+ "[M >] Next level", true);
+#endif
break;
case 3:
return PLUGIN_OK;
}
+ if (usb_detected)
+ return PLUGIN_USB_CONNECTED;
break;
- case SYS_USB_CONNECTED:
- rb->usb_screen();
- return PLUGIN_USB_CONNECTED;
-
default:
- continue;
+ if (rb->default_event_handler(key) == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
+ break;
}
for (i = 0 ; i < char_height ; i++)
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c
index effb47999c..1cb37e4161 100644
--- a/apps/plugins/vu_meter.c
+++ b/apps/plugins/vu_meter.c
@@ -19,6 +19,25 @@
#ifdef HAVE_LCD_BITMAP
+/* variable button definitions */
+#if CONFIG_KEYPAD == RECORDER_PAD
+#define VUMETER_QUIT BUTTON_OFF
+#define VUMETER_HELP BUTTON_ON
+#define VUMETER_MENU BUTTON_F1
+#define VUMETER_MENU_EXIT BUTTON_F1
+#define VUMETER_MENU_EXIT2 BUTTON_OFF
+
+#elif CONFIG_KEYPAD == ONDIO_PAD
+#define VUMETER_QUIT BUTTON_OFF
+#define VUMETER_HELP_PRE BUTTON_MENU
+#define VUMETER_HELP (BUTTON_MENU | BUTTON_REL)
+#define VUMETER_MENU_PRE BUTTON_MENU
+#define VUMETER_MENU (BUTTON_MENU | BUTTON_REPEAT)
+#define VUMETER_MENU_EXIT BUTTON_MENU
+#define VUMETER_MENU_EXIT2 BUTTON_OFF
+
+#endif
+
const struct plugin_api* rb;
#ifdef SIMULATOR
@@ -97,7 +116,11 @@ void load_settings(void) {
}
else {
reset_settings();
+#if CONFIG_KEYPAD == RECORDER_PAD
rb->splash(HZ, true, "Press ON for help");
+#elif CONFIG_KEYPAD == ONDIO_PAD
+ rb->splash(HZ, true, "Press MENU for help");
+#endif
}
}
@@ -195,8 +218,8 @@ void change_settings(void)
switch(rb->button_get_w_tmo(1))
{
- case BUTTON_F1:
- case BUTTON_OFF:
+ case VUMETER_MENU_EXIT:
+ case VUMETER_MENU_EXIT2:
quit = true;
break;
@@ -385,6 +408,7 @@ void digital_meter(void) {
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
int button;
+ int lastbutton = BUTTON_NONE;
TEST_PLUGIN_API(api);
(void) parameter;
@@ -409,21 +433,33 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
button = rb->button_get_w_tmo(1);
switch (button)
{
- case BUTTON_OFF:
+ case VUMETER_QUIT:
save_settings();
return PLUGIN_OK;
break;
- case BUTTON_ON:
+ case VUMETER_HELP:
+#ifdef VUMETER_HELP_PRE
+ if (lastbutton != VUMETER_HELP_PRE)
+ break;
+#endif
rb->lcd_clear_display();
rb->lcd_puts(0, 0, "OFF: Exit");
+#if CONFIG_KEYPAD == RECORDER_PAD
rb->lcd_puts(0, 1, "F1: Settings");
+#elif CONFIG_KEYPAD == ONDIO_PAD
+ rb->lcd_puts(0, 1, "MENU..: Settings");
+#endif
rb->lcd_puts(0, 2, "UP/DOWN: Volume");
rb->lcd_update();
rb->sleep(HZ*3);
break;
- case BUTTON_F1:
+ case VUMETER_MENU:
+#ifdef VUMETER_MENU_PRE
+ if (lastbutton != VUMETER_MENU_PRE)
+ break;
+#endif
change_settings();
break;
@@ -442,6 +478,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
return PLUGIN_USB_CONNECTED;
break;
}
+ if (button != BUTTON_NONE)
+ lastbutton = button;
}
}
#endif /* #ifdef HAVE_LCD_BITMAP */