From dc87e9e9f3c383b63c3cb3713886a6c93b6a79d1 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Tue, 22 Nov 2016 06:21:31 +0100 Subject: Selective Backlight/Advanced Softlock - Selective actions based on context Selective backlight allows the user to choose actions that will not enable the backlight when pressed. Advanced softlock allows user to choose actions that will not be blocked by screenlock on devices without a hold button. Both only occur in FM and WPS Contexts. Update: Back from the dead -Cleaned up code, removed unnecessary calls, re-arranged last filter action timeout conditional to work in case last_filtered_action_tick was never set -Added entries to the manual -Fixed back button on some menus not activating backlight -Made menus more intuitive, no actions selected now changes menu item to off. -Added talk fuctionality. -Added option to disable selective backlight while on external power. -Rewrote backlight and softlock handling code to fix issue with scrollwheels -Menu changed to have toggle(yes/no) and settings -Optimized selective actions lookup -Added option to disable notification of 'buttons locked' while softlocked -Removed uneeded code, consolidated action lookup to single function -Fixed incorrect name on selective softlock menu -Added option to disable touch on touchscreen devices -Fixed backlight on original screenlock without selective screenlock active -Added text selection in mask_select for when show_icons is off -Fixed voice in mask_select to speak if voice is defined instead of spelling -Added more lang defines (play skip seek) -Added option to disable unknown keys turning on backlight -Fixed Conditional argument In wrong place causing players without backlight to fail to build -Fixed Disable Unknown blocking detection of context change -Fixed canceling menu didn't update new settings -Added Autolock on backlight off -Removed backlight_on_force from backlight.c, Now sets ignore next to false and uses backlight_on -Cleaned up autolock code added strings to lang file -Fixed issue where rapid presses would bypass softlock -Removed old softlock code, Cleaned selective actions code -Changed menu to match existing RB menus -Fixed Backlight_on_Hold blocked by backlight_ignore_next -Fixed ignore_next for ipod -Fixed bug allowing context with softlock to bypass selective backlight -Changed mask_select to no longer prompt for changes to be saved -Changed menu names -Added ignore timeout to allow ipod scroll wheel to work properly and other players to still work properly, removed some previous code including ignore_event -Increased ignore timeout to prevent sd card accesses from interrupting action code and turning on backlight -Changed Unknown action to unmapped action in menu, changed handling code -Removed unneeded logic and variables for handling unfiltered actions -Reverted unmapped action code to previous functionality -Added manual entries (thanks JohnB) -Removed elusive unhandled unicode character from manual, changed formatting slightly Actions: Volume,Play,Seek,Skip Extras: Disable unmapped actions Disable selective backlight on external power Disable touch during softlock on touchscreen devices Disable softlock notifications (power button still notifies) Autolock on backlight off Method: Adds a function to ignore backlight on next call If selected action occurs backlight is forced on, Filter_first_keypress stays intact. Selective softlock allows selected actions through, bypasses the normal softlock routine. ToDo: DONE previous commit (#1) has attribution for folder_select.c which mask_select is based from. Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4 --- apps/settings_list.c | 69 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 26 deletions(-) (limited to 'apps/settings_list.c') diff --git a/apps/settings_list.c b/apps/settings_list.c index 62f232610c..58be3d2575 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -159,7 +159,7 @@ /* for settings which use the set_int() setting screen. unit is the UNIT_ define to display/talk. the first one saves a string to the config file, - the second one saves the variable value to the config file */ + the second one saves the variable value to the config file */ #define INT_SETTING_W_CFGVALS(flags, var, lang_id, default, name, cfg_vals, \ unit, min, max, step, formatter, get_talk_id, cb) \ {flags|F_INT_SETTING|F_T_INT, &global_settings.var, \ @@ -864,7 +864,7 @@ const struct settings_list settings[] = { MAX_CONTRAST_SETTING, 1, NULL, NULL }}}}, #endif #ifdef HAVE_BACKLIGHT - TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, backlight_timeout, LANG_BACKLIGHT, + TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, backlight_timeout, LANG_BACKLIGHT, DEFAULT_BACKLIGHT_TIMEOUT, "backlight timeout", off_on, UNIT_SEC, backlight_formatter, backlight_getlang, backlight_set_timeout, 20, @@ -957,7 +957,7 @@ const struct settings_list settings[] = { 0,1,2,3,4,5,6,7,8,9,10,15,30,45,60), SYSTEM_SETTING(NVRAM(4), runtime, 0), SYSTEM_SETTING(NVRAM(4), topruntime, 0), - INT_SETTING(F_BANFROMQS, max_files_in_playlist, + INT_SETTING(F_BANFROMQS, max_files_in_playlist, LANG_MAX_FILES_IN_PLAYLIST, #if MEMORYSIZE > 1 10000, @@ -1071,9 +1071,26 @@ const struct settings_list settings[] = { /** End of old RTC config block **/ +#ifndef HAS_BUTTON_HOLD + OFFON_SETTING(0, bt_selective_softlock_actions, + LANG_ACTION_ENABLED, false, + "No Screen Lock For Selected Actions", NULL), + INT_SETTING(0, bt_selective_softlock_actions_mask, LANG_SOFTLOCK_SELECTIVE, + 0, "Selective Screen Lock Actions", UNIT_INT, + 0, 2048,2, NULL, NULL, NULL), +#endif /* !HAS_BUTTON_HOLD */ + #ifdef HAVE_BACKLIGHT OFFON_SETTING(0, caption_backlight, LANG_CAPTION_BACKLIGHT, false, "caption backlight", NULL), + + OFFON_SETTING(0, bl_selective_actions, + LANG_ACTION_ENABLED, false, + "No Backlight On Selected Actions", NULL), + + INT_SETTING(0, bl_selective_actions_mask, LANG_BACKLIGHT_SELECTIVE, + 0, "Selective Backlight Actions", UNIT_INT, + 0, 2048,2, NULL, NULL, NULL), #ifdef HAVE_REMOTE_LCD OFFON_SETTING(0, remote_caption_backlight, LANG_CAPTION_BACKLIGHT, false, "remote caption backlight", NULL), @@ -1351,7 +1368,7 @@ const struct settings_list settings[] = { ID2P(LANG_TIME), ID2P(LANG_FILESIZE)), {F_T_INT|F_RECSETTING, &global_settings.rec_source, LANG_RECORDING_SOURCE, INT(0), "rec source", - &HAVE_MIC_REC_(",mic") + &HAVE_MIC_REC_(",mic") HAVE_LINE_REC_(",line") HAVE_SPDIF_REC_(",spdif") HAVE_FMRADIO_REC_(",fmradio")[1], @@ -1427,17 +1444,17 @@ const struct settings_list settings[] = { INT_SETTING(F_RECSETTING, rec_stop_thres_linear, LANG_RECORD_STOP_THRESHOLD, 10, "trigger stop threshold linear", UNIT_PERCENT, 0, 100, 1, NULL, NULL, NULL), TABLE_SETTING(F_RECSETTING, rec_start_duration, LANG_MIN_DURATION, 0, - "trigger start duration", + "trigger start duration", "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min", UNIT_SEC, NULL, NULL, NULL, 13, 0,1,2,5,10,15,20,25,30,60,120,300,600), TABLE_SETTING(F_RECSETTING, rec_stop_postrec, LANG_MIN_DURATION, 0, - "trigger stop duration", + "trigger stop duration", "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min", UNIT_SEC, NULL, NULL, NULL, 13, 0,1,2,5,10,15,20,25,30,60,120,300,600), TABLE_SETTING(F_RECSETTING, rec_stop_gap, LANG_RECORD_STOP_GAP, 1, - "trigger min gap", + "trigger min gap", "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min", UNIT_SEC, NULL, NULL, NULL, 13, 0,1,2,5,10,15,20,25,30,60,120,300,600), @@ -1469,7 +1486,7 @@ const struct settings_list settings[] = { LANG_SET_BOOL_YES, LANG_SET_BOOL_NO, NULL), #ifdef HAVE_TAGCACHE -#if CONFIG_CODEC == SWCODEC +#if CONFIG_CODEC == SWCODEC BOOL_SETTING(0, autoresume_enable, LANG_AUTORESUME, false, "autoresume enable", off_on, LANG_SET_BOOL_YES, LANG_SET_BOOL_NO, NULL), @@ -1482,7 +1499,7 @@ const struct settings_list settings[] = { ID2P(LANG_AUTORESUME_CUSTOM)), TEXT_SETTING(0, autoresume_paths, "autoresume next track paths", "/podcast:/podcasts", NULL, NULL), -#endif +#endif OFFON_SETTING(0, runtimedb, LANG_RUNTIMEDB_ACTIVE, false, "gather runtime data", NULL), @@ -1741,11 +1758,11 @@ const struct settings_list settings[] = { CHOICE_SETTING(F_SOUNDSETTING|F_NO_WRAP, compressor_settings.knee, LANG_COMPRESSOR_KNEE, 1, "compressor knee", "hard knee,soft knee", compressor_set, 2, - ID2P(LANG_COMPRESSOR_HARD_KNEE), ID2P(LANG_COMPRESSOR_SOFT_KNEE)), + ID2P(LANG_COMPRESSOR_HARD_KNEE), ID2P(LANG_COMPRESSOR_SOFT_KNEE)), INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.attack_time, LANG_COMPRESSOR_ATTACK, 5, "compressor attack time", UNIT_MS, 0, 30, - 5, NULL, NULL, compressor_set), + 5, NULL, NULL, compressor_set), INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.release_time, LANG_COMPRESSOR_RELEASE, 500, "compressor release time", UNIT_MS, 100, 1000, @@ -1933,38 +1950,38 @@ const struct settings_list settings[] = { UNIT_SEC, formatter_unit_0_is_skip_track, getlang_unit_0_is_skip_track, NULL, 19, -1,0,1,2,3,5,7,10,15,20,30,45,60,90,120,180,300,600,900), - CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, + CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, "start in screen", "previous,root,files," -#ifdef HAVE_TAGCACHE +#ifdef HAVE_TAGCACHE #define START_DB_COUNT 1 "db," -#else +#else #define START_DB_COUNT 0 #endif "wps,menu," #ifdef HAVE_RECORDING #define START_REC_COUNT 1 "recording," -#else +#else #define START_REC_COUNT 0 #endif #if CONFIG_TUNER #define START_TUNER_COUNT 1 "radio," -#else +#else #define START_TUNER_COUNT 0 #endif "bookmarks" #ifdef HAVE_PICTUREFLOW_INTEGRATION #define START_PF_COUNT 1 ",pictureflow" -#else +#else #define START_PF_COUNT 0 #endif , NULL, (6 + START_DB_COUNT + START_REC_COUNT + START_TUNER_COUNT + START_PF_COUNT), ID2P(LANG_PREVIOUS_SCREEN), ID2P(LANG_MAIN_MENU), - ID2P(LANG_DIR_BROWSER), + ID2P(LANG_DIR_BROWSER), #ifdef HAVE_TAGCACHE ID2P(LANG_TAGCACHE), #endif @@ -2025,7 +2042,7 @@ const struct settings_list settings[] = { 2, "list_accel_start_delay", UNIT_SEC, 0, 10, 1, formatter_unit_0_is_off, getlang_unit_0_is_off, NULL), INT_SETTING(0, list_accel_wait, LANG_LISTACCEL_ACCEL_SPEED, - 3, "list_accel_wait", UNIT_SEC, 1, 10, 1, + 3, "list_accel_wait", UNIT_SEC, 1, 10, 1, scanaccel_formatter, getlang_unit_0_is_off, NULL), #endif /* HAVE_WHEEL_ACCELERATION */ #if CONFIG_CODEC == SWCODEC @@ -2108,7 +2125,7 @@ const struct settings_list settings[] = { CHOICE_SETTING(0, touch_mode, LANG_TOUCHSCREEN_MODE, DEFAULT_TOUCHSCREEN_MODE, "touchscreen mode", "point,grid", NULL, 2, ID2P(LANG_TOUCHSCREEN_POINT), ID2P(LANG_TOUCHSCREEN_GRID)), - CUSTOM_SETTING(0, ts_calibration_data, -1, + CUSTOM_SETTING(0, ts_calibration_data, -1, &default_calibration_parameters, "touchscreen calibration", tsc_load_from_cfg, tsc_write_to_cfg, tsc_is_changed, tsc_set_default), @@ -2165,21 +2182,21 @@ const struct settings_list settings[] = { TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_wps, LANG_HOTKEY_WPS, HOTKEY_VIEW_PLAYLIST, "hotkey wps", "off,view playlist,show track info,pitchscreen,open with,delete" -#ifdef HAVE_PICTUREFLOW_INTEGRATION +#ifdef HAVE_PICTUREFLOW_INTEGRATION ",pictureflow" #endif - ,UNIT_INT, hotkey_formatter, hotkey_getlang, NULL, -#ifdef HAVE_PICTUREFLOW_INTEGRATION - 7, + ,UNIT_INT, hotkey_formatter, hotkey_getlang, NULL, +#ifdef HAVE_PICTUREFLOW_INTEGRATION + 7, #else 6, #endif HOTKEY_OFF, HOTKEY_VIEW_PLAYLIST, HOTKEY_SHOW_TRACK_INFO, HOTKEY_PITCHSCREEN, HOTKEY_OPEN_WITH, HOTKEY_DELETE -#ifdef HAVE_PICTUREFLOW_INTEGRATION +#ifdef HAVE_PICTUREFLOW_INTEGRATION , HOTKEY_PICTUREFLOW -#endif +#endif ), TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree, LANG_HOTKEY_FILE_BROWSER, HOTKEY_OFF, "hotkey tree", -- cgit v1.2.3