From faa2cb99429214de745bbc3e64e48a7432db51ae Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sun, 18 Dec 2022 21:13:15 +0100 Subject: plugins: Improve usability of iPod keymaps - Reduce need to press multiple buttons at the same time to quit a plugin - Have "Menu" be default way to quit plugins or to access plugin menu - Fall back to (Long) "Select" or Long "Menu" in cases where Menu button isn't available (e.g. in ImageViewer and many games) out of scope: boomshine, lua_scripts, Rockpaint, Doom, Duke3D, Pacbox, Quake, Sgt-Puzzles, Wolf3D, XWorld, Minesweeper, Pixel Painter, Spacerocks Change-Id: I6d4dc7174695fe4b8ee9cbaccb21bdbfe6af5c48 --- apps/plugins/fft/fft.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'apps/plugins/fft') diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c index f612a0ea35..4d36302ddf 100644 --- a/apps/plugins/fft/fft.c +++ b/apps/plugins/fft/fft.c @@ -40,13 +40,22 @@ GREY_INFO_STRUCT /* this set the context to use with PLA */ static const struct button_mapping *plugin_contexts[] = { pla_main_ctx }; -#define FFT_PREV_GRAPH PLA_LEFT -#define FFT_NEXT_GRAPH PLA_RIGHT -#define FFT_ORIENTATION PLA_CANCEL -#define FFT_WINDOW PLA_SELECT -#define FFT_AMP_SCALE PLA_UP -#define FFT_FREQ_SCALE PLA_DOWN -#define FFT_QUIT PLA_EXIT +#define FFT_PREV_GRAPH PLA_LEFT +#define FFT_NEXT_GRAPH PLA_RIGHT +#define FFT_ORIENTATION PLA_CANCEL +#define FFT_WINDOW PLA_SELECT_REL +#define FFT_AMP_SCALE PLA_SELECT_REPEAT +#define FFT_AMP_SCALE_PRE PLA_SELECT +#define FFT_FREQ_SCALE PLA_DOWN + + +#if (CONFIG_KEYPAD == IPOD_1G2G_PAD) \ + || (CONFIG_KEYPAD == IPOD_3G_PAD) \ + || (CONFIG_KEYPAD == IPOD_4G_PAD) +#define FFT_QUIT PLA_UP +#else +#define FFT_QUIT PLA_EXIT +#endif #ifdef HAVE_LCD_COLOR #include "pluginbitmaps/fft_colors.h" @@ -1257,6 +1266,10 @@ enum plugin_status plugin_start(const void* parameter) if(!fft_setup()) return PLUGIN_ERROR; +#if defined(FFT_AMP_SCALE_PRE) + int lastbutton = BUTTON_NONE; +#endif + while(run) { long delay = fft_draw(); @@ -1300,6 +1313,10 @@ enum plugin_status plugin_start(const void* parameter) break; case FFT_AMP_SCALE: +#ifdef FFT_AMP_SCALE_PRE + if (lastbutton != FFT_AMP_SCALE_PRE) + break; +#endif if (++fft.amp_scale >= FFT_MAX_AS) fft.amp_scale = FFT_MIN_AS; @@ -1328,6 +1345,11 @@ enum plugin_status plugin_start(const void* parameter) exit_on_usb(button); break; } + +#if defined(FFT_AMP_SCALE_PRE) + if (button != BUTTON_NONE) + lastbutton = button; +#endif } return PLUGIN_OK; -- cgit v1.2.3