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
This commit is contained in:
William Wilgus 2016-11-22 06:21:31 +01:00
parent 16a9f84571
commit dc87e9e9f3
18 changed files with 1504 additions and 333 deletions

View file

@ -95,6 +95,9 @@ gui/pitchscreen.c
gui/quickscreen.c
#endif
gui/folder_select.c
#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
gui/mask_select.c
#endif
gui/wps.c
gui/scrollbar.c

View file

@ -42,6 +42,16 @@
#include "statusbar-skinned.h"
#endif
#ifdef HAVE_BACKLIGHT
#include "backlight.h"
#if CONFIG_CHARGING
#include "power.h"
#endif
#endif /* HAVE_BACKLIGHT */
#define LOGF_ENABLE
#include "logf.h"
static int last_button = BUTTON_NONE|BUTTON_REL; /* allow the ipod wheel to
work on startup */
static intptr_t last_data = 0;
@ -56,19 +66,34 @@ static bool short_press = false;
#define REPEAT_WINDOW_TICKS HZ/4
static int last_action_tick = 0;
#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
static inline bool is_action_normal(int action);
static inline bool mask_has_flag(unsigned int mask, unsigned int flag);
static inline bool is_action_completed(int button);
#define LAST_FILTER_TICKS HZ/2 /* timeout between filtered actions */
#endif /* defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) */
#ifdef HAVE_BACKLIGHT
static unsigned int backlight_mask = SEL_ACTION_NONE;
static int do_backlight(int action, int context, bool is_pre_btn);
static void handle_backlight(bool backlight, bool ignore_next);
#endif /* HAVE_BACKLIGHT */
/* software keylock stuff */
#ifndef HAS_BUTTON_HOLD
static bool keys_locked = false;
static int unlock_combo = BUTTON_NONE;
static bool screen_has_lock = false;
static unsigned int softlock_mask = SEL_ACTION_NONE;
static inline int do_softlock_unlock_combo(int button, int context);
static int do_softlock(int button, int action, int context, bool is_pre_btn);
#endif /* HAVE_SOFTWARE_KEYLOCK */
/*
* do_button_check is the worker function for get_default_action.
* returns ACTION_UNKNOWN or the requested return value from the list.
* BE AWARE is_pre_button can miss pre buttons if a match is found first.
*/
static inline int do_button_check(const struct button_mapping *items,
int button, int last_button, int *start)
static inline int do_button_check(const struct button_mapping *items,int button,
int last_button, int *start, bool *prebtn)
{
int i = 0;
int ret = ACTION_UNKNOWN;
@ -88,6 +113,8 @@ static inline int do_button_check(const struct button_mapping *items,
break;
}
}
else if (items[i].pre_button_code & button)
*prebtn = true; /* determine if this could be another action */
i++;
}
*start = i;
@ -164,7 +191,7 @@ static inline int get_next_context(const struct button_mapping *items, int i)
static void gui_boost(bool want_to_boost)
{
static bool boosted = false;
if (want_to_boost && !boosted)
{
cpu_boost(true);
@ -177,7 +204,7 @@ static void gui_boost(bool want_to_boost)
}
}
/* gui_unboost_callback() is called GUI_BOOST_TIMEOUT seconds after the
/* gui_unboost_callback() is called GUI_BOOST_TIMEOUT seconds after the
* last wheel scrolling event. */
static int gui_unboost_callback(struct timeout *tmo)
{
@ -188,8 +215,8 @@ static int gui_unboost_callback(struct timeout *tmo)
#endif
/*
* int get_action_worker(int context, struct button_mapping *user_mappings,
int timeout)
* int get_action_worker(int context, int timeout, bool *is_pre_button,
struct button_mapping *user_mappings)
This function searches the button list for the given context for the just
pressed button.
If there is a match it returns the value from the list.
@ -197,12 +224,14 @@ static int gui_unboost_callback(struct timeout *tmo)
the last item in the list "points" to the next context in a chain
so the "chain" is followed until the button is found.
putting ACTION_NONE will get CONTEXT_STD which is always the last list checked.
BE AWARE is_pre_button can miss pre buttons if a match is found first.
it is more for actions that are not yet completed in the desired context
but are defined in a lower 'chained' context.
Timeout can be TIMEOUT_NOBLOCK to return immediatly
TIMEOUT_BLOCK to wait for a button press
Any number >0 to wait that many ticks for a press
*/
static int get_action_worker(int context, int timeout,
static int get_action_worker(int context, int timeout, bool *is_pre_button,
const struct button_mapping* (*get_context_map)(int) )
{
const struct button_mapping *items = NULL;
@ -210,7 +239,7 @@ static int get_action_worker(int context, int timeout,
int i=0;
int ret = ACTION_UNKNOWN;
static int last_context = CONTEXT_STD;
send_event(GUI_EVENT_ACTIONUPDATE, NULL);
if (timeout == TIMEOUT_NOBLOCK)
@ -222,7 +251,7 @@ static int get_action_worker(int context, int timeout,
#if defined(HAVE_GUI_BOOST) && defined(HAVE_ADJUSTABLE_CPU_FREQ)
static struct timeout gui_unboost;
/* Boost the CPU in case of wheel scrolling activity in the defined contexts.
/* Boost the CPU in case of wheel scrolling activity in the defined contexts.
* Call unboost with a timeout of GUI_BOOST_TIMEOUT. */
if (button != BUTTON_NONE)
{
@ -270,7 +299,7 @@ static int get_action_worker(int context, int timeout,
}
return ACTION_NONE;
}
if ((context != last_context) && ((last_button & BUTTON_REL) == 0)
#ifdef HAVE_SCROLLWHEEL
/* Scrollwheel doesn't generate release events */
@ -288,39 +317,24 @@ static int get_action_worker(int context, int timeout,
return ACTION_NONE; /* "safest" return value */
}
last_context = context;
#ifndef HAS_BUTTON_HOLD
screen_has_lock = ((context & ALLOW_SOFTLOCK) == ALLOW_SOFTLOCK);
context &= ~ALLOW_SOFTLOCK;
if (is_keys_locked())
{
if (button == unlock_combo)
{
last_button = BUTTON_NONE;
keys_locked = false;
#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
/* enable back touch device */
button_enable_touch(true);
#endif
splash(HZ/2, str(LANG_KEYLOCK_OFF));
return ACTION_REDRAW;
}
else
#if (BUTTON_REMOTE != 0)
if ((button & BUTTON_REMOTE) == 0)
#endif
{
if ((button & BUTTON_REL))
splash(HZ/2, str(LANG_KEYLOCK_ON));
return ACTION_REDRAW;
}
ret = do_softlock_unlock_combo(button, context);
if (!is_keys_locked())
return ret;
}
#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
else
else if (!mask_has_flag(softlock_mask, SEL_ACTION_NOTOUCH))
{
/* make sure touchpad get reactivated if we quit the screen */
button_enable_touch(true);
}
#endif
context &= ~ALLOW_SOFTLOCK;
#endif /* HAS_BUTTON_HOLD */
#ifdef HAVE_TOUCHSCREEN
@ -348,6 +362,7 @@ static int get_action_worker(int context, int timeout,
#endif
/* logf("%x,%x",last_button,button); */
*is_pre_button = false; /* could the button be another actions pre_button */
while (1)
{
/* logf("context = %x",context); */
@ -363,7 +378,7 @@ static int get_action_worker(int context, int timeout,
if (items == NULL)
break;
ret = do_button_check(items,button,last_button,&i);
ret = do_button_check(items, button, last_button, &i, is_pre_button);
if (ret == ACTION_UNKNOWN)
{
@ -375,24 +390,13 @@ static int get_action_worker(int context, int timeout,
continue;
}
}
/* Action was found or STOPSEARCHING was specified */
break;
}
/* DEBUGF("ret = %x\n",ret); */
#ifndef HAS_BUTTON_HOLD
if (screen_has_lock && (ret == ACTION_STD_KEYLOCK))
{
unlock_combo = button;
keys_locked = true;
splash(HZ/2, str(LANG_KEYLOCK_ON));
#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
/* disable touch device on keylock */
button_enable_touch(false);
#endif
button_clear_queue();
return ACTION_REDRAW;
}
if(screen_has_lock && is_action_normal(ret))
ret = do_softlock(button, ret, last_context & ~ALLOW_SOFTLOCK, is_pre_button);
#endif
if ((current_tick - last_action_tick < REPEAT_WINDOW_TICKS)
&& (ret == last_action))
@ -411,42 +415,46 @@ static int get_action_worker(int context, int timeout,
#endif
return ret;
}
}/* get_action_worker */
int get_action(int context, int timeout)
{
int button = get_action_worker(context,timeout,NULL);
bool is_pre_button = false;
int button = get_action_worker(context, timeout, &is_pre_button, NULL);
#ifdef HAVE_TOUCHSCREEN
if (button == ACTION_TOUCHSCREEN)
button = sb_touch_to_button(context);
#endif
#ifdef HAVE_BACKLIGHT
if (mask_has_flag(backlight_mask, SEL_ACTION_ENABLED) &&
is_action_normal(button))
button = do_backlight(button, context & ~ALLOW_SOFTLOCK, is_pre_button);
#endif
return button;
}
int get_custom_action(int context,int timeout,
const struct button_mapping* (*get_context_map)(int))
{
return get_action_worker(context,timeout,get_context_map);
bool is_pre_button = false;
return get_action_worker(context,timeout, &is_pre_button, get_context_map);
}
bool action_userabort(int timeout)
{
int action = get_action_worker(CONTEXT_STD,timeout,NULL);
bool is_pre_button = false;
int action = get_action_worker(CONTEXT_STD,timeout, &is_pre_button, NULL);
bool ret = (action == ACTION_STD_CANCEL);
if(!ret)
if (!ret)
{
default_event_handler(action);
}
return ret;
}
#ifndef HAS_BUTTON_HOLD
bool is_keys_locked(void)
{
return (screen_has_lock && keys_locked);
}
#endif
intptr_t get_action_data(void)
{
return last_data;
@ -532,4 +540,338 @@ void action_wait_for_release(void)
{
wait_for_release = true;
}
#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
/* HELPER FUNCTIONS
* Selective softlock and backlight use this lookup based on mask to decide
* which actions are filtered, or could be filtered but not currently set.
* returns false if the action isn't found, true if the action is found
*/
static bool is_action_filtered(int action, unsigned int mask, int context)
{
bool match = false;
switch (action)
{
case ACTION_NONE:
break;
/*Actions that are not mapped will not turn on the backlight option NOUNMAPPED*/
case ACTION_UNKNOWN:
match = mask_has_flag(mask, SEL_ACTION_NOUNMAPPED);
break;
case ACTION_WPS_PLAY:
case ACTION_FM_PLAY:
match = mask_has_flag(mask, SEL_ACTION_PLAY);
break;
case ACTION_STD_PREVREPEAT:
case ACTION_STD_NEXTREPEAT:
case ACTION_WPS_SEEKBACK:
case ACTION_WPS_SEEKFWD:
case ACTION_WPS_STOPSEEK:
match = mask_has_flag(mask, SEL_ACTION_SEEK);
break;
case ACTION_STD_PREV:
case ACTION_STD_NEXT:
case ACTION_WPS_SKIPNEXT:
case ACTION_WPS_SKIPPREV:
case ACTION_FM_NEXT_PRESET:
case ACTION_FM_PREV_PRESET:
match = mask_has_flag(mask, SEL_ACTION_SKIP);
break;
case ACTION_WPS_VOLUP:
case ACTION_WPS_VOLDOWN:
match = mask_has_flag(mask, SEL_ACTION_VOL);
break;
case ACTION_SETTINGS_INC:/*FMS*/
case ACTION_SETTINGS_INCREPEAT:/*FMS*/
case ACTION_SETTINGS_DEC:/*FMS*/
case ACTION_SETTINGS_DECREPEAT:/*FMS*/
match = (context == CONTEXT_FM) && mask_has_flag(mask, SEL_ACTION_VOL);
break;
default:
/* display action code of unfiltered actions */
logf ("unfiltered actions: context: %d action: %d, last btn: %d, \
mask: %d", context, action, last_button, mask);
break;
}/*switch*/
return match;
}
/* compares mask to a flag return true if set false otherwise*/
static inline bool mask_has_flag(unsigned int mask, unsigned int flag)
{
return ((mask & flag) != 0);
}
/* returns true if the supplied context is to be filtered by selective BL/SL*/
static inline bool is_context_filtered(int context)
{
return (context == CONTEXT_FM || context == CONTEXT_WPS);
}
/* returns true if action can be passed on to selective backlight/softlock */
static inline bool is_action_normal(int action)
{
return (action != ACTION_REDRAW && (action & SYS_EVENT) == 0);
}
/*returns true if Button & released, repeated; or won't generate those events*/
static inline bool is_action_completed(int button)
{
return ((button & (BUTTON_REPEAT | BUTTON_REL)) != 0
#ifdef HAVE_SCROLLWHEEL
/* Scrollwheel doesn't generate release events */
|| (button & (BUTTON_SCROLL_BACK | BUTTON_SCROLL_FWD)) != 0
#endif
);
}
/* most every action takes two rounds through get_action_worker,
* once for the keypress and once for the key release,
* actions with pre_button codes take even more, some actions however, only
* take once; actions defined with only a button and no release/repeat event,
* these actions should be acted upon immediately except when we have
* selective backlighting/softlock enabled and in this case we only act upon
* them immediately if there is no chance they have another event tied to them
* determined using is_pre_button and is_action_completed()
*returns true if event was not filtered and false if it was
*/
static bool is_action_unfiltered(int action,int button, bool is_pre_button,
bool filtered, int *tick)
{
bool ret = false;
/*directly after a match a key release event may trigger another*/
if (filtered && action != ACTION_UNKNOWN)
*tick = current_tick + LAST_FILTER_TICKS;
/* has button been rel/rep or is this the only action it could be */
if (is_action_completed(button) || !is_pre_button)
{
/* reset last action , if the action is not filtered and
this isn't just a key release event then return true */
if (!filtered && *tick < current_tick)
{
*tick = 0;
ret = true;
}
}/*is_action_completed() || !is_pre_button*/
return ret;
}
#endif /*defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) HELPER FUNCTIONS*/
#ifdef HAVE_BACKLIGHT
static void handle_backlight(bool backlight, bool ignore_next)
{
if (backlight)
{
backlight_on_ignore(false, 0);
backlight_on();
#ifdef HAVE_BUTTON_LIGHT
buttonlight_on_ignore(false, 0);
buttonlight_on();
}
buttonlight_on_ignore(ignore_next, 5*HZ);/* as a precautionary fallback */
#else
}
#endif
backlight_on_ignore(ignore_next, 5*HZ);/*must be set everytime we handle bl*/
}
/* Need to look up actions before we can decide to turn on backlight, if
* selective backlighting is true filter first keypress events need to be
* taken into account as well
*/
static int do_backlight(int action, int context, bool is_pre_btn)
{
static int last_filtered_tick = 0;
bool bl_is_active = is_backlight_on(false);
bool bl_activate = false;
bool filtered;
#if CONFIG_CHARGING /* disable if on external power */
if (!bl_is_active && is_context_filtered(context) &&
!(mask_has_flag(backlight_mask, SEL_ACTION_NOEXT) && power_input_present()))
#else /* skip if backlight is on or incorrect context */
if (!bl_is_active && is_context_filtered(context))
#endif
{
filtered = is_action_filtered(action, backlight_mask, context);
bl_activate = is_action_unfiltered(action, last_button, is_pre_btn,
filtered, &last_filtered_tick);
}/*is_context_filtered(context)*/
else
bl_activate = true;
if (action != ACTION_NONE && bl_activate)
{
handle_backlight(true, true);
if (mask_has_flag(backlight_mask, SEL_ACTION_FFKEYPRESS) && !bl_is_active)
{
action = ACTION_NONE;
last_button = BUTTON_NONE;
}
}
else
handle_backlight(false, true);/* set ignore next true */
return action;
}
/* Enable selected actions to leave the backlight off */
void set_selective_backlight_actions(bool selective, unsigned int mask,
bool filter_fkp)
{
handle_backlight(true, selective);
if (selective) /* we will handle filter_first_keypress here so turn it off*/
{
set_backlight_filter_keypress(false);/* turnoff ffkp in button.c */
backlight_mask = mask | SEL_ACTION_ENABLED;
if(filter_fkp)
backlight_mask |= SEL_ACTION_FFKEYPRESS;
}
else
{
set_backlight_filter_keypress(filter_fkp);
backlight_mask = SEL_ACTION_NONE;
}
}
#endif /* HAVE_BACKLIGHT */
#ifndef HAS_BUTTON_HOLD
bool is_keys_locked(void)
{
return (screen_has_lock && keys_locked);
}
static inline void do_key_lock(bool lock)
{
keys_locked = lock;
last_button = BUTTON_NONE;
button_clear_queue();
#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
/* disable touch device on keylock if std behavior or selected disable touch */
if (!mask_has_flag(softlock_mask, SEL_ACTION_ENABLED) ||
mask_has_flag(softlock_mask, SEL_ACTION_NOTOUCH))
button_enable_touch(!lock);
#endif
}
/* user selected autolock based on backlight timeout; toggles autolock on / off
by ACTION_STD_KEYLOCK presses, Activates autolock if set on backlight timeout
*/
#ifdef HAVE_BACKLIGHT
static inline int do_auto_softlock(int button, int action, int *unlock_combo)
{
if(mask_has_flag(softlock_mask, SEL_ACTION_ALOCK_OK) && !is_backlight_on(false))
do_key_lock(true);
else if (action == ACTION_STD_KEYLOCK)
{
*unlock_combo = button;/* set unlock combo to allow unlock */
softlock_mask ^= SEL_ACTION_ALOCK_OK;
handle_backlight(true, false);
/* If we don't wait for a moment for the backlight queue
* to process, the user will never see the message */
if (!is_backlight_on(false))
sleep(HZ/2);
if (mask_has_flag(softlock_mask, SEL_ACTION_ALOCK_OK))
{
splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_ON));
action = ACTION_REDRAW;
}
else
splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_OFF));
}
return action;
}
#endif
/* Allows unlock softlock when action is not yet known but unlock_combo set*/
static inline int do_softlock_unlock_combo(int button, int context)
{
return do_softlock(button, ACTION_NONE, context, false);
}
/* Handles softlock once action is known */
static int do_softlock(int button, int action, int context, bool is_pre_btn)
{
static int last_filtered_tick = 0;
static int unlock_combo = BUTTON_NONE; /*Moved from GLOBAL*/
bool filtered = true;
bool notify_user = false;
bool sl_activate = true; /* standard softlock behavior */
#ifdef HAVE_BACKLIGHT
if (!keys_locked && mask_has_flag(softlock_mask, SEL_ACTION_AUTOLOCK))
action = do_auto_softlock(button, action, &unlock_combo);
#endif
/* Lock/Unlock toggled by ACTION_STD_KEYLOCK presses*/
if ((action == ACTION_STD_KEYLOCK) || (keys_locked && unlock_combo == button))
{
unlock_combo = button;
do_key_lock(!keys_locked);
notify_user = true;
}
#if (BUTTON_REMOTE != 0)/* Allow remote actions through */
else if (mask_has_flag(button, BUTTON_REMOTE))
notify_user = false;
#endif
else if (keys_locked && action != ACTION_NONE && action != ACTION_REDRAW)
{
if (mask_has_flag(softlock_mask, SEL_ACTION_ENABLED))
{
filtered = is_action_filtered(action, softlock_mask, context);
sl_activate = is_action_unfiltered(action, button, is_pre_btn,
filtered, &last_filtered_tick);
}
/*All non-std softlock options are set to 0 if advanced sl is disabled*/
if (sl_activate)
{
if (!mask_has_flag(softlock_mask, SEL_ACTION_NONOTIFY))
{ /* always true on standard softlock behavior*/
notify_user = mask_has_flag(button, BUTTON_REL);
action = ACTION_REDRAW;
}
else
action = ACTION_NONE;
}
else if (!filtered)/*catch blocked actions on fast repeated presses*/
action = ACTION_NONE;
} /* keys_locked */
#ifdef BUTTON_POWER /*always notify if power button pressed while keys locked*/
notify_user |= (mask_has_flag(button, BUTTON_POWER) && keys_locked);
#endif
if (notify_user)
{
#ifdef HAVE_BACKLIGHT
handle_backlight(true, false);
/* If we don't wait for a moment for the backlight queue
* to process, the user will never see the message */
if (!is_backlight_on(false))
sleep(HZ/2);
#endif
if (keys_locked)
splash(HZ/2, ID2P(LANG_KEYLOCK_ON));
else
splash(HZ/2, ID2P(LANG_KEYLOCK_OFF));
last_button = BUTTON_NONE;
action = ACTION_REDRAW;
button_clear_queue();
}
return action;
}
void set_selective_softlock_actions(bool selective, unsigned int mask)
{
keys_locked = false;
if(selective)
softlock_mask = mask | SEL_ACTION_ENABLED;
else
softlock_mask = SEL_ACTION_NONE;
}
#endif /* HAS_BUTTON_HOLD */

View file

@ -41,37 +41,66 @@
#else
#define ALLOW_SOFTLOCK 0
#endif
#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
/* Selective action selection flags */
#define SEL_ACTION_NONE 0
#define SEL_ACTION_VOL 0x001U
#define SEL_ACTION_PLAY 0x002U
#define SEL_ACTION_SEEK 0x004U
#define SEL_ACTION_SKIP 0x008U
#define SEL_ACTION_NOUNMAPPED 0x010U/* disable backlight on unmapped buttons */
/* Available 0x020U*/
/* Available 0x040U*/
#define SEL_ACTION_NOTOUCH 0x080U/* disable touch screen/pad on screen lock */
#define SEL_ACTION_AUTOLOCK 0x100U/* autolock on backlight off */
#define SEL_ACTION_NOEXT 0x200U/* disable selective backlight while charge*/
#define SEL_ACTION_NONOTIFY 0x200U/* don't notify user softlock is active */
/* Flags below are internal to selective functions */
#define SEL_ACTION_ALOCK_OK 0x400U/*autolock only active after key lock once*/
#define SEL_ACTION_FFKEYPRESS 0x400U/* backlight Filter First Keypress active*/
#define SEL_ACTION_ENABLED 0x800U
/* Selective Actions flags */
#ifndef HAS_BUTTON_HOLD
bool is_keys_locked(void);
void set_selective_softlock_actions(bool selective, unsigned int mask);
#endif
#ifdef HAVE_BACKLIGHT
void set_selective_backlight_actions(bool selective, unsigned int mask,
bool filter_fkp);
#endif
#endif /* defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) */
enum {
CONTEXT_STD = 0,
/* These CONTEXT_ values were here before me,
there values may have significance, so dont touch! */
CONTEXT_WPS = 1,
CONTEXT_TREE = 2,
CONTEXT_TREE = 2,
CONTEXT_RECORD = 3,
CONTEXT_MAINMENU = 4, /* uses CONTEXT_TREE and ACTION_TREE_* */
CONTEXT_ID3DB = 5,
/* Add new contexts here, no need to explicitly define a value for them */
/* Add new contexts here, no need to explicitly define a value for them */
CONTEXT_LIST,
CONTEXT_SETTINGS, /* regular setting screens (and debug screens) */
/* bellow are setting screens which may need to redefine the standard
/* bellow are setting screens which may need to redefine the standard
setting screen keys, targets should return the CONTEXT_SETTINGS
keymap unless they are not adequate for the screen
NOTE: uses ACTION_STD_[NEXT|PREV] so make sure they are there also
NOTE: uses ACTION_STD_[NEXT|PREV] so make sure they are there also
and (possibly) ACTION_SETTINGS_[INC|DEC] */
CONTEXT_SETTINGS_EQ,
CONTEXT_SETTINGS_COLOURCHOOSER,
CONTEXT_SETTINGS_TIME,
CONTEXT_SETTINGS_EQ,
CONTEXT_SETTINGS_COLOURCHOOSER,
CONTEXT_SETTINGS_TIME,
CONTEXT_SETTINGS_RECTRIGGER,
/* The following contexts should use ACTION_STD_[NEXT|PREV]
and (possibly) ACTION_SETTINGS_[INC|DEC]
and (possibly) ACTION_SETTINGS_[INC|DEC]
Also add any extra actions they need */
CONTEXT_BOOKMARKSCREEN, /* uses ACTION_BMS_ defines */
CONTEXT_ALARMSCREEN, /* uses ACTION_AS_ defines */
CONTEXT_ALARMSCREEN, /* uses ACTION_AS_ defines */
CONTEXT_QUICKSCREEN, /* uses ACTION_QS_ defines below */
CONTEXT_PITCHSCREEN, /* uses ACTION_PS_ defines below */
CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */
CONTEXT_RECSCREEN,
CONTEXT_KEYBOARD,
@ -86,7 +115,7 @@ enum {
enum {
ACTION_NONE = BUTTON_NONE,
ACTION_UNKNOWN,
ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */
@ -95,11 +124,11 @@ enum {
ACTION_TOUCHSCREEN_IGNORE, /* used for the 'none' action in skins */
/* standard actions, use these first */
ACTION_STD_PREV,
ACTION_STD_PREV,
ACTION_STD_PREVREPEAT,
ACTION_STD_NEXT,
ACTION_STD_NEXTREPEAT,
ACTION_STD_OK,
ACTION_STD_CANCEL,
ACTION_STD_CONTEXT,
@ -108,10 +137,10 @@ enum {
ACTION_STD_KEYLOCK,
ACTION_STD_REC,
ACTION_STD_HOTKEY,
ACTION_F3, /* just so everything works again, possibly change me */
/* code context actions */
/* WPS codes */
ACTION_WPS_BROWSE,
ACTION_WPS_PLAY,
@ -133,7 +162,7 @@ enum {
ACTION_WPS_CREATE_BOOKMARK,/* optional */
ACTION_WPS_REC,
#if 0
ACTION_WPSAB_SINGLE, /* This needs to be #defined in
ACTION_WPSAB_SINGLE, /* This needs to be #defined in
the config-<target>.h to one of the ACTION_WPS_ actions
so it can be used */
#endif
@ -141,23 +170,23 @@ enum {
ACTION_WPS_ABSETB_NEXTDIR, /* you shouldnt want to change dir in ab-mode */
ACTION_WPS_ABRESET,
ACTION_WPS_HOTKEY,
/* list and tree page up/down */
/* list and tree page up/down */
ACTION_LISTTREE_PGUP,/* optional */
ACTION_LISTTREE_PGDOWN,/* optional */
#ifdef HAVE_VOLUME_IN_LIST
ACTION_LIST_VOLUP,
ACTION_LIST_VOLDOWN,
#endif
/* tree */
/* tree */
ACTION_TREE_ROOT_INIT,
ACTION_TREE_PGLEFT,/* optional */
ACTION_TREE_PGRIGHT,/* optional */
ACTION_TREE_STOP,
ACTION_TREE_WPS,
ACTION_TREE_HOTKEY,
/* radio */
ACTION_FM_MENU,
ACTION_FM_PRESET,
@ -177,7 +206,7 @@ enum {
ACTION_REC_NEWFILE,
ACTION_REC_F2,
ACTION_REC_F3,
/* main menu */
/* These are not strictly actions, but must be here
so they dont conflict with real actions in the menu code */
@ -186,11 +215,11 @@ enum {
ACTION_EXIT_AFTER_THIS_MENUITEM, /* if a menu returns this the menu will exit
once the subitem returns */
ACTION_ENTER_MENUITEM,
/* id3db */
/* list */
/* settings */
ACTION_SETTINGS_INC,
ACTION_SETTINGS_INCREPEAT,
@ -200,16 +229,16 @@ enum {
ACTION_SETTINGS_DECBIGSTEP,
ACTION_SETTINGS_RESET,
ACTION_SETTINGS_SET, /* Used by touchscreen targets */
/* bookmark screen */
ACTION_BMS_DELETE,
/* quickscreen */
ACTION_QS_LEFT,
ACTION_QS_RIGHT,
ACTION_QS_DOWN,
ACTION_QS_TOP,
/* pitchscreen */
/* obviously ignore if you dont have thise screen */
ACTION_PS_INC_SMALL,
@ -225,10 +254,10 @@ enum {
ACTION_PS_EXIT, /* _STD_* isnt going to work here */
ACTION_PS_SLOWER,
ACTION_PS_FASTER,
/* yesno screen */
ACTION_YESNO_ACCEPT,
/* keyboard screen */
ACTION_KBD_LEFT,
ACTION_KBD_RIGHT,
@ -243,7 +272,7 @@ enum {
ACTION_KBD_DOWN,
ACTION_KBD_MORSE_INPUT,
ACTION_KBD_MORSE_SELECT,
#ifdef HAVE_TOUCHSCREEN
/* the following are helper actions for touchscreen targets,
* These are for actions which are not doable or required if buttons are
@ -255,7 +284,7 @@ enum {
ACTION_TOUCH_VOLUME,
ACTION_TOUCH_SOFTLOCK,
ACTION_TOUCH_SETTING,
#endif
#endif
/* USB HID codes */
ACTION_USB_HID_FIRST, /* Place holder */
@ -347,11 +376,8 @@ bool action_userabort(int timeout);
/* no other code should need this apart from action.c */
const struct button_mapping* get_context_mapping(int context);
#ifndef HAS_BUTTON_HOLD
bool is_keys_locked(void);
#endif
/* returns the status code variable from action.c for the button just pressed
/* returns the status code variable from action.c for the button just pressed
If button != NULL it will be set to the actual button code */
#define ACTION_REMOTE 0x1 /* remote was pressed */
#define ACTION_REPEAT 0x2 /* action was repeated (NOT button) */
@ -378,7 +404,7 @@ int action_get_touchscreen_press(short *x, short *y);
* the press was within the viewport,
* ACTION_UNKNOWN (and x1, y1 untouched) if the press was outside
* BUTTON_NONE else
*
*
**/
int action_get_touchscreen_press_in_vp(short *x1, short *y1, struct viewport *vp);
#endif

287
apps/gui/mask_select.c Normal file
View file

@ -0,0 +1,287 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* Copyright (C) 2016 William Wilgus
* Derivative of folder_select.c by:
* Copyright (C) 2012 Jonathan Gordon
* Copyright (C) 2012 Thomas Martitz
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
/* TODO add language defines */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lang.h"
#include "language.h"
#include "list.h"
#include "plugin.h"
#include "mask_select.h"
#include "talk.h"
/*
* Order for changing child states:
* 1) expand folder
* 2) collapse and select
* 3) deselect (skip to 1)
*/
enum child_state {
EXPANDED,
SELECTED,
COLLAPSED,
DESELECTED,
};
/* Children of main categories */
struct child {
const char* name;
struct category *category;
enum child_state state;
int key_value;
};
/* Main Categories in root */
struct category {
const char *name;
struct child *children;
int children_count;
int depth;
struct category* previous;
int key_value; /*values of all children OR|D*/
};
/* empty category for children of root only one level needed */
static struct category empty = {
.name = "",
.children = NULL,
.children_count = 0,
.depth = 1,
.previous = NULL,
};
/* Or | all keyvalues that user selected */
static int calculate_mask_r(struct category *root, int mask)
{
int i = 0;
while (i < root->children_count)
{
struct child *this = &root->children[i];
if (this->state == SELECTED)
mask |= this->key_value;
else if (this->state == EXPANDED)
mask = calculate_mask_r(this->category, mask);
i++;
}
return mask;
}
static int count_items(struct category *start)
{
int count = 0;
int i;
for (i=0; i<start->children_count; i++)
{
struct child *foo = &start->children[i];
if (foo->state == EXPANDED)
count += count_items(foo->category);
count++;
}
return count;
}
static struct child* find_index(struct category *start,
int index,struct category **parent)
{
int i = 0;
*parent = NULL;
while (i < start->children_count)
{
struct child *foo = &start->children[i];
if (i == index)
{
*parent = start;
return foo;
}
i++;
if (foo->state == EXPANDED)
{
struct child *bar = find_index(foo->category, index - i, parent);
if (bar)
{
return bar;
}
index -= count_items(foo->category);
}
}
return NULL;
}
/* simplelist uses this callback to change
the states of the categories/children */
static int item_action_callback(int action, struct gui_synclist *list)
{
struct category *root = (struct category*)list->data;
struct category *parent;
struct child *this = find_index(root, list->selected_item, &parent);
if (action == ACTION_STD_OK)
{
switch (this->state)
{
case EXPANDED:
this->state = SELECTED;
if (global_settings.talk_menu)
talk_id(LANG_ON, false);
break;
case SELECTED:
this->state = this->category->children_count == 0 ?
DESELECTED : COLLAPSED;
if (global_settings.talk_menu && this->category->children_count == 0)
talk_id(LANG_OFF, false);
break;
case COLLAPSED:
if (this->category == NULL)
this->category = root;
this->state = this->category->children_count == 0 ?
SELECTED : EXPANDED;
if (global_settings.talk_menu && this->category->children_count == 0)
talk_id(LANG_ON, false);
break;
case DESELECTED:
this->state = SELECTED;
if (global_settings.talk_menu)
talk_id(LANG_ON, false);
break;
default:
/* do nothing */
return action;
}
list->nb_items = count_items(root);
return ACTION_REDRAW;
}
return action;
}
static const char * item_get_name(int selected_item, void * data,
char * buffer, size_t buffer_len)
{
struct category *root = (struct category*)data;
struct category *parent;
struct child *this = find_index(root, selected_item , &parent);
buffer[0] = '\0';
if (parent->depth >= 0)
for(int i = 0; i <= parent->depth; i++)
strcat(buffer, "\t\0");
/* state of selection needs icons so if icons are disabled use text*/
if (!global_settings.show_icons)
{
if (this->state == SELECTED)
strcat(buffer, "+\0");
else
strcat(buffer," \0");
}
strlcat(buffer, P2STR((const unsigned char *)this->name), buffer_len);
return buffer;
}
static int item_get_talk(int selected_item, void *data)
{
struct category *root = (struct category*)data;
struct category *parent;
struct child *this = find_index(root, selected_item , &parent);
if (global_settings.talk_menu)
{
long id = P2ID((const unsigned char *)(this->name));
if(id>=0)
talk_id(id, true);
else
talk_spell(this->name, true);
talk_id(VOICE_PAUSE,true);
if (this->state == SELECTED)
talk_id(LANG_ON, true);
else if (this->state == DESELECTED)
talk_id(LANG_OFF, true);
}
return 0;
}
static enum themable_icons item_get_icon(int selected_item, void * data)
{
struct category *root = (struct category*)data;
struct category *parent;
struct child *this = find_index(root, selected_item, &parent);
switch (this->state)
{
case SELECTED:
return Icon_Submenu;
case COLLAPSED:
return Icon_NOICON;
case EXPANDED:
return Icon_Submenu_Entered;
default:
return Icon_NOICON;
}
return Icon_NOICON;
}
/* supply your original mask,the page header (ie. User do this..), mask items
and count, they will be selected automatically if the mask includes
them. If user selects new items and chooses to save settings
new mask returned otherwise, original is returned
*/
int mask_select(int mask, const unsigned char* headermsg,
struct s_mask_items *mask_items, size_t items)
{
struct simplelist_info info;
struct child action_child[items];
for (unsigned i = 0; i < items; i++)
{
action_child[i].name = mask_items[i].name;
action_child[i].category = &empty;
action_child[i].key_value = mask_items[i].bit_value;
action_child[i].state = mask_items[i].bit_value & mask ?
SELECTED : DESELECTED;
}
struct category root = {
.name = "",
.children = (struct child*) &action_child,
.children_count = items,
.depth = -1,
.previous = NULL,
};
simplelist_info_init(&info, P2STR(headermsg), count_items(&root), &root);
info.get_name = item_get_name;
info.action_callback = item_action_callback;
info.get_icon = item_get_icon;
info.get_talk = item_get_talk;
simplelist_show_list(&info);
return calculate_mask_r(&root,0);
}

41
apps/gui/mask_select.h Normal file
View file

@ -0,0 +1,41 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2016 William Wilgus
* Derivative of folder_select.h by:
* Copyright (C) 2011 Jonathan Gordon
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef __MASK_SELECT_H__
#define __MASK_SELECT_H__
/**
* A GUI browser to select masks on a target
*
* It reads an original mask supplied to function
* and pre-selects the corresponding actions in the UI. If the user is done it
* returns the new mask, assuming the user confirms the yesno dialog.
*
* Returns new mask if the selected options have changed, otherwise
* returns the mask originally supplied */
struct s_mask_items {
const char* name;
const int bit_value;
};
int mask_select(int mask, const unsigned char* headermsg,
struct s_mask_items *mask_items, size_t items);
#endif /* __MASK_SELECT_H__ */

View file

@ -13479,3 +13479,171 @@
ibassodx90: "Android Debug Bridge"
</voice>
</phrase>
<phrase>
id: LANG_ACTION_ENABLED
desc: Selective Actions
user: core
<source>
*: "Enabled"
</source>
<dest>
*: "Enabled"
</dest>
<voice>
*: "Enabled"
</voice>
</phrase>
<phrase>
id: LANG_ACTION_PLAY
desc: Selective Actions
user: core
<source>
*: "Play"
</source>
<dest>
*: "Play"
</dest>
<voice>
*: "Play"
</voice>
</phrase>
<phrase>
id: LANG_ACTION_SEEK
desc: Selective Actions
user: core
<source>
*: "Seek"
</source>
<dest>
*: "Seek"
</dest>
<voice>
*: "Seek"
</voice>
</phrase>
<phrase>
id: LANG_ACTION_SKIP
desc: Selective Actions
user: core
<source>
*: "Skip"
</source>
<dest>
*: "Skip"
</dest>
<voice>
*: "Skip"
</voice>
</phrase>
<phrase>
id: LANG_BACKLIGHT_SELECTIVE
desc: Backlight behaviour setting
user: core
<source>
*: "Selective Backlight"
</source>
<dest>
*: "Selective Backlight"
</dest>
<voice>
*: "Selective Backlight"
</voice>
</phrase>
<phrase>
id: LANG_ACTION_DISABLE_EXT_POWER
desc: Backlight behaviour setting
user: core
<source>
*: "Disable on External Power"
</source>
<dest>
*: "Disable on External Power"
</dest>
<voice>
*: "Disable on External Power"
</voice>
</phrase>
<phrase>
id: LANG_ACTION_DISABLE_UNMAPPED
desc: Backlight behaviour setting
user: core
<source>
*: "Disable Unmapped Keys"
</source>
<dest>
*: "Disable Unmapped Keys"
</dest>
<voice>
*: "Disable Unmapped Keys"
</voice>
</phrase>
<phrase>
id: LANG_SOFTLOCK_SELECTIVE
desc: Softlock behaviour setting
user: core
<source>
*: "Advanced Key Lock"
</source>
<dest>
*: "Advanced Key Lock"
</dest>
<voice>
*: "Advanced Key Lock"
</voice>
</phrase>
<phrase>
id: LANG_ACTION_AUTOLOCK_ON
desc: Softlock behaviour setting
user: core
<source>
*: "Autolock On"
</source>
<dest>
*: "Autolock On"
</dest>
<voice>
*: "Autolock On"
</voice>
</phrase>
<phrase>
id: LANG_ACTION_AUTOLOCK_OFF
desc: Softlock behaviour setting
user: core
<source>
*: "Autolock Off"
</source>
<dest>
*: "Autolock Off"
</dest>
<voice>
*: "Autolock Off"
</voice>
</phrase>
<phrase>
id: LANG_ACTION_DISABLE_NOTIFY
desc: Softlock behaviour setting
user: core
<source>
*: "Disable Notify"
</source>
<dest>
*: "Disable Notify"
</dest>
<voice>
*: "Disable Notify"
</voice>
</phrase>
<phrase>
id: LANG_ACTION_DISABLE_TOUCH
desc: Softlock behaviour setting
user: core
<source>
*: "Disable Touch"
</source>
<dest>
*: "Disable Touch"
</dest>
<voice>
*: "Disable Touch"
</voice>
</phrase>

View file

@ -38,6 +38,10 @@
#ifdef HAVE_REMOTE_LCD
#include "lcd-remote.h"
#endif
#ifdef HAVE_BACKLIGHT
#include "mask_select.h"
#include "splash.h"
#endif
#ifdef HAVE_TOUCHSCREEN
#include "screens.h"
#endif
@ -46,9 +50,29 @@
#include "rbunicode.h"
#ifdef HAVE_BACKLIGHT
static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item)
static int selectivebacklight_callback(int action,const struct menu_item_ex *this_item)
{
(void)this_item;
switch (action)
{
case ACTION_EXIT_MENUITEM:
case ACTION_STD_MENU:
case ACTION_STD_CANCEL:
set_selective_backlight_actions(
global_settings.bl_selective_actions,
global_settings.bl_selective_actions_mask,
global_settings.bl_filter_first_keypress);
break;
}
return action;
}
static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item)
{
/*(void)this_item;REMOVED*/
switch (action)
{
case ACTION_EXIT_MENUITEM:
@ -56,13 +80,43 @@ static int filterfirstkeypress_callback(int action,const struct menu_item_ex *th
#ifdef HAVE_REMOTE_LCD
set_remote_backlight_filter_keypress(
global_settings.remote_bl_filter_first_keypress);
#endif
#endif /* HAVE_REMOTE_LCD */
selectivebacklight_callback(action,this_item);/*uses Filter First KP*/
break;
}
return action;
}
static int selectivebacklight_set_mask(void* param)
{
(void)param;
int mask = global_settings.bl_selective_actions_mask;
struct s_mask_items maskitems[]={
{ID2P(LANG_VOLUME) , SEL_ACTION_VOL},
{ID2P(LANG_ACTION_PLAY), SEL_ACTION_PLAY},
{ID2P(LANG_ACTION_SEEK), SEL_ACTION_SEEK},
{ID2P(LANG_ACTION_SKIP), SEL_ACTION_SKIP},
{ID2P(LANG_ACTION_DISABLE_UNMAPPED), SEL_ACTION_NOUNMAPPED}
#if CONFIG_CHARGING
,{ID2P(LANG_ACTION_DISABLE_EXT_POWER), SEL_ACTION_NOEXT}
#endif
};
mask = mask_select(mask, ID2P(LANG_BACKLIGHT_SELECTIVE)
, maskitems, ARRAYLEN(maskitems));
if (mask == SEL_ACTION_NONE || mask == SEL_ACTION_NOEXT)
global_settings.bl_selective_actions = false;
else if (global_settings.bl_selective_actions_mask != mask)
global_settings.bl_selective_actions = true;
global_settings.bl_selective_actions_mask = mask;
return true;
}
#endif /* HAVE_BACKLIGHT */
#ifdef HAVE_LCD_FLIP
static int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
{
@ -88,11 +142,11 @@ static int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
#ifdef HAVE_BACKLIGHT
MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL);
#if CONFIG_CHARGING
MENUITEM_SETTING(backlight_timeout_plugged,
MENUITEM_SETTING(backlight_timeout_plugged,
&global_settings.backlight_timeout_plugged, NULL);
#endif
#ifdef HAS_BUTTON_HOLD
MENUITEM_SETTING(backlight_on_button_hold,
MENUITEM_SETTING(backlight_on_button_hold,
&global_settings.backlight_on_button_hold, NULL);
#endif
MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL);
@ -101,9 +155,21 @@ MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL);
MENUITEM_SETTING(backlight_fade_in, &global_settings.backlight_fade_in, NULL);
MENUITEM_SETTING(backlight_fade_out, &global_settings.backlight_fade_out, NULL);
#endif
MENUITEM_SETTING(bl_filter_first_keypress,
&global_settings.bl_filter_first_keypress,
MENUITEM_SETTING(bl_filter_first_keypress,
&global_settings.bl_filter_first_keypress,
filterfirstkeypress_callback);
MENUITEM_SETTING(bl_selective_actions,
&global_settings.bl_selective_actions,
selectivebacklight_callback);
MENUITEM_FUNCTION(sel_backlight_mask, 0, ID2P(LANG_SETTINGS),
selectivebacklight_set_mask, NULL,
selectivebacklight_callback, Icon_Menu_setting);
MAKE_MENU(sel_backlight, ID2P(LANG_BACKLIGHT_SELECTIVE),
NULL, Icon_Menu_setting, &bl_selective_actions, &sel_backlight_mask);
#ifdef HAVE_LCD_SLEEP_SETTING
MENUITEM_SETTING(lcd_sleep_after_backlight_off,
&global_settings.lcd_sleep_after_backlight_off, NULL);
@ -124,6 +190,8 @@ MENUITEM_SETTING(flip_display, &global_settings.flip_display, flipdisplay_callba
#endif
#endif /* HAVE_LCD_BITMAP */
/* now the actual menu */
MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
NULL, Icon_Display_menu
@ -141,6 +209,7 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
,&backlight_fade_in, &backlight_fade_out
#endif
,&bl_filter_first_keypress
,&sel_backlight
# ifdef HAVE_LCD_SLEEP_SETTING
,&lcd_sleep_after_backlight_off
# endif
@ -167,31 +236,31 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
/********************************/
/* Remote LCD settings menu */
#ifdef HAVE_REMOTE_LCD
MENUITEM_SETTING(remote_backlight_timeout,
MENUITEM_SETTING(remote_backlight_timeout,
&global_settings.remote_backlight_timeout, NULL);
#if CONFIG_CHARGING
MENUITEM_SETTING(remote_backlight_timeout_plugged,
MENUITEM_SETTING(remote_backlight_timeout_plugged,
&global_settings.remote_backlight_timeout_plugged, NULL);
#endif
#ifdef HAS_REMOTE_BUTTON_HOLD
MENUITEM_SETTING(remote_backlight_on_button_hold,
MENUITEM_SETTING(remote_backlight_on_button_hold,
&global_settings.remote_backlight_on_button_hold, NULL);
#endif
MENUITEM_SETTING(remote_caption_backlight,
MENUITEM_SETTING(remote_caption_backlight,
&global_settings.remote_caption_backlight, NULL);
MENUITEM_SETTING(remote_bl_filter_first_keypress,
&global_settings.remote_bl_filter_first_keypress,
MENUITEM_SETTING(remote_bl_filter_first_keypress,
&global_settings.remote_bl_filter_first_keypress,
filterfirstkeypress_callback);
MENUITEM_SETTING(remote_contrast,
MENUITEM_SETTING(remote_contrast,
&global_settings.remote_contrast, NULL);
MENUITEM_SETTING(remote_invert,
MENUITEM_SETTING(remote_invert,
&global_settings.remote_invert, NULL);
#ifdef HAVE_LCD_FLIP
MENUITEM_SETTING(remote_flip_display,
#ifdef HAVE_LCD_FLIP
MENUITEM_SETTING(remote_flip_display,
&global_settings.remote_flip_display, flipdisplay_callback);
#endif
@ -207,7 +276,7 @@ static int ticking_callback(int action,const struct menu_item_ex *this_item)
}
return action;
}
MENUITEM_SETTING(remote_reduce_ticking,
MENUITEM_SETTING(remote_reduce_ticking,
&global_settings.remote_reduce_ticking, ticking_callback);
#endif
@ -222,7 +291,7 @@ MAKE_MENU(lcd_remote_settings, ID2P(LANG_LCD_REMOTE_MENU),
#endif
&remote_caption_backlight, &remote_bl_filter_first_keypress,
&remote_contrast, &remote_invert
#ifdef HAVE_LCD_FLIP
,&remote_flip_display
#endif
@ -319,15 +388,15 @@ static int peakmeter_callback(int action,const struct menu_item_ex *this_item)
}
return action;
}
MENUITEM_SETTING(peak_meter_hold,
MENUITEM_SETTING(peak_meter_hold,
&global_settings.peak_meter_hold, peakmeter_callback);
MENUITEM_SETTING(peak_meter_clip_hold,
MENUITEM_SETTING(peak_meter_clip_hold,
&global_settings.peak_meter_clip_hold, peakmeter_callback);
#ifdef HAVE_RECORDING
MENUITEM_SETTING(peak_meter_clipcounter,
&global_settings.peak_meter_clipcounter, NULL);
#endif
MENUITEM_SETTING(peak_meter_release,
MENUITEM_SETTING(peak_meter_release,
&global_settings.peak_meter_release, peakmeter_callback);
/**
* Menu to select wether the scale of the meter
@ -356,7 +425,7 @@ static int peak_meter_scale(void) {
/* we only store -dBfs */
global_settings.peak_meter_min = -peak_meter_get_min() / 100;
global_settings.peak_meter_max = -peak_meter_get_max() / 100;
/* limit the returned value to the allowed range */
if(global_settings.peak_meter_min > 89)
global_settings.peak_meter_min = 89;
@ -472,12 +541,12 @@ MENUITEM_FUNCTION(histogram, 0,
MENUITEM_FUNCTION(peak_meter_scale_item, 0, ID2P(LANG_PM_SCALE),
peak_meter_scale, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(peak_meter_min_item, 0, ID2P(LANG_PM_MIN),
MENUITEM_FUNCTION(peak_meter_min_item, 0, ID2P(LANG_PM_MIN),
peak_meter_min, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(peak_meter_max_item, 0, ID2P(LANG_PM_MAX),
MENUITEM_FUNCTION(peak_meter_max_item, 0, ID2P(LANG_PM_MAX),
peak_meter_max, NULL, NULL, Icon_NOICON);
MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, Icon_NOICON,
&peak_meter_release, &peak_meter_hold,
&peak_meter_release, &peak_meter_hold,
&peak_meter_clip_hold,
#ifdef HAVE_RECORDING
&peak_meter_clipcounter,

View file

@ -49,12 +49,67 @@
#include "dircache.h"
#endif
#include "folder_select.h"
#ifndef HAS_BUTTON_HOLD
#include "mask_select.h"
#endif
#if defined(DX50) || defined(DX90)
#include "governor-ibasso.h"
#include "usb-ibasso.h"
#endif
#ifndef HAS_BUTTON_HOLD
static int selectivesoftlock_callback(int action,
const struct menu_item_ex *this_item)
{
(void)this_item;
switch (action)
{
case ACTION_STD_MENU:
case ACTION_STD_CANCEL:
case ACTION_EXIT_MENUITEM:
set_selective_softlock_actions(
global_settings.bt_selective_softlock_actions,
global_settings.bt_selective_softlock_actions_mask);
break;
}
return action;
}
static int selectivesoftlock_set_mask(void* param)
{
(void)param;
int mask = global_settings.bt_selective_softlock_actions_mask;
struct s_mask_items maskitems[]={
{ID2P(LANG_VOLUME) , SEL_ACTION_VOL},
{ID2P(LANG_ACTION_PLAY), SEL_ACTION_PLAY},
{ID2P(LANG_ACTION_SEEK), SEL_ACTION_SEEK},
{ID2P(LANG_ACTION_SKIP), SEL_ACTION_SKIP},
#ifdef HAVE_BACKLIGHT
{ID2P(LANG_ACTION_AUTOLOCK_ON), SEL_ACTION_AUTOLOCK},
#endif
#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
{ID2P(LANG_ACTION_DISABLE_TOUCH) , SEL_ACTION_NOTOUCH},
#endif
{ID2P(LANG_ACTION_DISABLE_NOTIFY), SEL_ACTION_NONOTIFY}
};
mask = mask_select(mask, ID2P(LANG_SOFTLOCK_SELECTIVE)
, maskitems,ARRAYLEN(maskitems));
if (mask == SEL_ACTION_NONE)
global_settings.bt_selective_softlock_actions = false;
else if (global_settings.bt_selective_softlock_actions_mask != mask)
global_settings.bt_selective_softlock_actions = true;
global_settings.bt_selective_softlock_actions_mask = mask;
return true;
}
#endif /* !HAS_BUTTON_HOLD */
/***********************************/
/* TAGCACHE MENU */
#ifdef HAVE_TAGCACHE
@ -137,7 +192,7 @@ static int clear_start_directory(void)
splash(HZ, ID2P(LANG_RESET_DONE_CLEAR));
return false;
}
MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR),
MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR),
clear_start_directory, NULL, NULL, Icon_file_view_menu);
static int fileview_callback(int action,const struct menu_item_ex *this_item)
{
@ -330,6 +385,19 @@ MENUITEM_SETTING(touchpad_deadzone, &global_settings.touchpad_deadzone, NULL);
MENUITEM_SETTING(shortcuts_replaces_quickscreen, &global_settings.shortcuts_replaces_qs, NULL);
#endif
#ifndef HAS_BUTTON_HOLD
MENUITEM_SETTING(bt_selective_actions,
&global_settings.bt_selective_softlock_actions,
selectivesoftlock_callback);
MENUITEM_FUNCTION(sel_softlock_mask, 0, ID2P(LANG_SETTINGS),
selectivesoftlock_set_mask, NULL,
selectivesoftlock_callback, Icon_Menu_setting);
MAKE_MENU(sel_softlock, ID2P(LANG_SOFTLOCK_SELECTIVE),
NULL, Icon_Menu_setting, &bt_selective_actions, &sel_softlock_mask);
#endif /* !HAS_BUTTON_HOLD */
#if defined(DX50) || defined(DX90)
MENUITEM_SETTING(governor, &global_settings.governor, NULL);
MENUITEM_SETTING(usb_mode, &global_settings.usb_mode, NULL);
@ -380,6 +448,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
#ifdef HAVE_TOUCHPAD_DEADZONE
&touchpad_deadzone,
#endif
#ifndef HAS_BUTTON_HOLD
&sel_softlock,
#endif
#ifdef USB_ENABLE_HID
&usb_hid,
&usb_keypad_mode,
@ -544,7 +615,7 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
/***********************************/
/* AUTORESUME MENU */
#ifdef HAVE_TAGCACHE
#if CONFIG_CODEC == SWCODEC
#if CONFIG_CODEC == SWCODEC
static int autoresume_callback(int action, const struct menu_item_ex *this_item)
{
@ -557,7 +628,7 @@ static int autoresume_callback(int action, const struct menu_item_ex *this_item)
static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY),
ID2P(LANG_TAGCACHE_FORCE_UPDATE)};
static const struct text_message message = {lines, 2};
if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES)
tagcache_rebuild_with_splash();
}
@ -672,9 +743,9 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
&startup_shutdown_menu,
&bookmark_settings_menu,
#ifdef HAVE_TAGCACHE
#if CONFIG_CODEC == SWCODEC
#if CONFIG_CODEC == SWCODEC
&autoresume_menu,
#endif
#endif
#endif
&browse_langs, &voice_settings_menu,
#ifdef HAVE_HOTKEY

View file

@ -146,7 +146,7 @@ static bool read_nvram_data(char* buf, int max_len)
buf[i] = rtc_read(0x14+i);
#endif
/* check magic, version */
if ((buf[0] != 'R') || (buf[1] != 'b')
if ((buf[0] != 'R') || (buf[1] != 'b')
|| (buf[2] != NVRAM_CONFIG_VERSION))
return false;
/* check crc32 */
@ -221,7 +221,7 @@ static bool write_nvram_data(char* buf, int max_len)
supports that, but this will have to do for now 8-) */
for (i=0; i < NVRAM_BLOCK_SIZE; i++ ) {
int r = rtc_write(0x14+i, buf[i]);
if (r)
if (r)
return false;
}
#endif
@ -307,8 +307,8 @@ bool settings_load_config(const char* file, bool apply)
#ifdef HAVE_LCD_COLOR
if (settings[i].flags&F_RGB)
hex_to_rgb(value, (int*)settings[i].setting);
else
#endif
else
#endif
if (settings[i].cfg_vals == NULL)
{
*(int*)settings[i].setting = atoi(value);
@ -392,7 +392,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
const char* start = settings[setting_id].cfg_vals;
char* end = NULL;
int count = 0;
if ((flags&F_T_MASK)==F_T_INT &&
flags&F_TABLE_SETTING)
{
@ -404,7 +404,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
{
if (end == NULL)
strlcpy(buf, start, buf_len);
else
else
{
int len = (buf_len > (end-start))? end-start: buf_len;
strlcpy(buf, start, len+1);
@ -412,7 +412,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
return true;
}
count++;
if (end)
start = end+1;
else
@ -420,7 +420,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
}
return false;
}
while (count < val)
{
start = strchr(start,',');
@ -432,7 +432,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
end = strchr(start,',');
if (end == NULL)
strlcpy(buf, start, buf_len);
else
else
{
int len = (buf_len > (end-start))? end-start: buf_len;
strlcpy(buf, start, len+1);
@ -561,7 +561,7 @@ static bool settings_write_config(const char* filename, int options)
value[0] = '\0';
if (settings[i].flags & F_DEPRECATED)
continue;
switch (options)
{
case SETTINGS_SAVE_CHANGED:
@ -939,7 +939,7 @@ void settings_apply(bool read_disk)
&& global_settings.font_file[0] != '-') {
int font_ui = screens[SCREEN_MAIN].getuifont();
const char* loaded_font = font_filename(font_ui);
snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
global_settings.font_file);
if (!loaded_font || strcmp(loaded_font, buf))
@ -953,7 +953,7 @@ void settings_apply(bool read_disk)
screens[SCREEN_MAIN].setfont(rc);
}
}
#ifdef HAVE_REMOTE_LCD
#ifdef HAVE_REMOTE_LCD
if ( global_settings.remote_font_file[0]
&& global_settings.remote_font_file[0] != '-') {
int font_ui = screens[SCREEN_REMOTE].getuifont();
@ -1064,17 +1064,27 @@ void settings_apply(bool read_disk)
#ifdef HAVE_BACKLIGHT
set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
set_selective_backlight_actions(global_settings.bl_selective_actions,
global_settings.bl_selective_actions_mask,
global_settings.bl_filter_first_keypress);
#ifdef HAVE_REMOTE_LCD
set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
#endif
#ifdef HAS_BUTTON_HOLD
backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
#endif
#ifdef HAVE_LCD_SLEEP_SETTING
lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
#endif
#endif /* HAVE_BACKLIGHT */
#ifndef HAS_BUTTON_HOLD
set_selective_softlock_actions(
global_settings.bt_selective_softlock_actions,
global_settings.bt_selective_softlock_actions_mask);
#endif
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
touchpad_set_sensitivity(global_settings.touchpad_sensitivity);
#endif
@ -1243,7 +1253,7 @@ bool set_int_ex(const unsigned char* string,
(void)unit;
struct settings_list item;
struct int_setting data = {
function, voice_unit, min, max, step,
function, voice_unit, min, max, step,
formatter, get_talk_id
};
item.int_setting = &data;
@ -1269,7 +1279,7 @@ static int32_t set_option_get_talk_id(int value, int unit)
}
bool set_option(const char* string, const void* variable, enum optiontype type,
const struct opt_items* options,
const struct opt_items* options,
int numoptions, void (*function)(int))
{
int temp;
@ -1287,7 +1297,7 @@ bool set_option(const char* string, const void* variable, enum optiontype type,
item.setting = &temp;
if (type == BOOL)
temp = *(bool*)variable? 1: 0;
else
else
temp = *(int*)variable;
if (!option_screen(&item, NULL, false, NULL))
{

View file

@ -529,7 +529,7 @@ struct user_settings
int statusbar; /* STATUSBAR_* enum values */
#ifdef HAVE_REMOTE_LCD
int remote_statusbar;
#endif
#endif
#if CONFIG_KEYPAD == RECORDER_PAD
bool buttonbar; /* 0=hide, 1=show */
@ -670,7 +670,13 @@ struct user_settings
#if CONFIG_CHARGING
int backlight_timeout_plugged;
#endif
#ifndef HAS_BUTTON_HOLD
bool bt_selective_softlock_actions;
int bt_selective_softlock_actions_mask;
#endif
#ifdef HAVE_BACKLIGHT
bool bl_selective_actions; /* backlight disable on some actions */
int bl_selective_actions_mask;/* mask of actions that will not enable backlight */
#ifdef HAS_BUTTON_HOLD
int backlight_on_button_hold; /* what to do with backlight when hold
switch is on */
@ -679,7 +685,8 @@ struct user_settings
int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight
has turned off */
#endif
#endif
#endif /* HAVE_BACKLIGHT */
#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING)
int backlight_fade_in; /* backlight fade in timing: 0..3 */
int backlight_fade_out; /* backlight fade in timing: 0..7 */
@ -687,7 +694,7 @@ struct user_settings
bool backlight_fade_in;
bool backlight_fade_out;
#endif
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
int brightness;
#endif

View file

@ -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",

View file

@ -89,7 +89,7 @@ struct choice_setting {
#define F_CHOICE_SETTING 0x100
#define F_CHOICETALKS 0x200 /* uses .talks in the above struct for the talks */
/* and cfg_vals for the strings to display */
struct table_setting {
void (*option_callback)(int);
const char* (*formatter)(char*, size_t, int, const char*);
@ -113,7 +113,7 @@ struct table_setting {
struct custom_setting {
/* load the saved value from the .cfg
setting: pointer into global_settings
value: the text from the .cfg
value: the text from the .cfg
*/
void (*load_from_cfg)(void* setting, char*value);
/* store the value into a .cfg

View file

@ -654,6 +654,7 @@ Udo Schläpfer
Thomas White
Karl Huber
Adam Sampson
William Wilgus
The libmad team
The wavpack team

View file

@ -103,6 +103,8 @@ static void backlight_thread(void);
static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)];
static const char backlight_thread_name[] = "backlight";
static struct event_queue backlight_queue SHAREDBSS_ATTR;
static bool ignore_backlight_on = false;
static int backlight_ignored_timer = 0;
#ifdef BACKLIGHT_DRIVER_CLOSE
static unsigned int backlight_thread_id = 0;
#endif
@ -123,6 +125,8 @@ static void backlight_timeout_handler(void);
#ifdef HAVE_BUTTON_LIGHT
static int buttonlight_timer;
static int buttonlight_timeout = 5*HZ;
static bool ignore_buttonlight_on = false;
static int buttonlight_ignored_timer = 0;
/* Update state of buttonlight according to timeout setting */
static void buttonlight_update_state(void)
@ -140,10 +144,20 @@ static void buttonlight_update_state(void)
}
/* external interface */
void buttonlight_on(void)
{
queue_remove_from_head(&backlight_queue, BUTTON_LIGHT_ON);
queue_post(&backlight_queue, BUTTON_LIGHT_ON, 0);
if(!ignore_buttonlight_on)
{
queue_remove_from_head(&backlight_queue, BUTTON_LIGHT_ON);
queue_post(&backlight_queue, BUTTON_LIGHT_ON, 0);
}
}
void buttonlight_on_ignore(bool value, int timeout)
{
ignore_buttonlight_on = value;
buttonlight_ignored_timer = timeout;
}
void buttonlight_off(void)
@ -232,7 +246,7 @@ static int backlight_fading_state = NOT_FADING;
/* s15.16 fixed point variables */
static int32_t bl_fade_in_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16)/300;
static int32_t bl_fade_out_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16)/2000;
static int32_t bl_dim_fraction = 0;
static int32_t bl_dim_fraction = 0;
static int bl_dim_target = 0;
static int bl_dim_current = 0;
@ -642,7 +656,7 @@ void backlight_thread(void)
buttonlight_hw_off();
break;
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
case BUTTON_LIGHT_BRIGHTNESS_CHANGED:
case BUTTON_LIGHT_BRIGHTNESS_CHANGED:
buttonlight_hw_brightness((int)ev.data);
break;
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
@ -723,7 +737,19 @@ static void backlight_timeout_handler(void)
buttonlight_hw_off();
}
}
if (buttonlight_ignored_timer > 0)
{
buttonlight_ignored_timer -= BACKLIGHT_THREAD_TIMEOUT;
if (buttonlight_ignored_timer <= 0)
ignore_buttonlight_on = false;
}
#endif /* HAVE_BUTTON_LIGHT */
if (backlight_ignored_timer > 0)
{
backlight_ignored_timer -= BACKLIGHT_THREAD_TIMEOUT;
if (backlight_ignored_timer <= 0)
ignore_backlight_on = false;
}
}
void backlight_init(void)
@ -768,8 +794,17 @@ void backlight_close(void)
void backlight_on(void)
{
queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
queue_post(&backlight_queue, BACKLIGHT_ON, 0);
if(!ignore_backlight_on)
{
queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
queue_post(&backlight_queue, BACKLIGHT_ON, 0);
}
}
void backlight_on_ignore(bool value, int timeout)
{
ignore_backlight_on = value;
backlight_ignored_timer = timeout;
}
void backlight_off(void)
@ -829,8 +864,13 @@ void backlight_set_timeout_plugged(int value)
void backlight_hold_changed(bool hold_button)
{
if (!hold_button || (backlight_on_button_hold > 0))
{
/* if unlocked or override in effect */
backlight_on();
/*backlight_on(); REMOVED*/
queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
queue_post(&backlight_queue, BACKLIGHT_ON, 0);
}
}
void backlight_set_on_button_hold(int index)

View file

@ -31,6 +31,7 @@
#endif
bool is_backlight_on(bool ignore_always_off);
void backlight_on_ignore(bool value, int timeout);
void backlight_on(void);
void backlight_off(void);
void backlight_set_timeout(int value);
@ -38,7 +39,6 @@ void backlight_set_timeout(int value);
#ifdef HAVE_BACKLIGHT
void backlight_init(void) INIT_ATTR;
void backlight_close(void);
int backlight_get_current_timeout(void);
#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING)
@ -99,6 +99,7 @@ void buttonlight_set_brightness(int val);
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#ifdef HAVE_BUTTON_LIGHT
void buttonlight_on_ignore(bool value, int timeout);
void buttonlight_on(void);
void buttonlight_off(void);
void buttonlight_set_timeout(int value);

243
manual/advanced_topics/main.tex Normal file → Executable file
View file

@ -62,12 +62,12 @@ in the font package at \url{http://www.rockbox.org/daily.shtml}.}
\subsection{\label{ref:Loadinglanguages}Loading Languages}
\index{Language files}%
Rockbox can load language files at runtime. Simply copy the \fname{.lng} file
\emph{(do not use the .lang file)} to the \dap\ and ``play'' it in the
Rockbox can load language files at runtime. Simply copy the \fname{.lng} file
\emph{(do not use the .lang file)} to the \dap\ and ``play'' it in the
Rockbox directory browser or select \setting{Settings $\rightarrow$
General Settings $\rightarrow$ Language }from the \setting{Main Menu}.\\
\note{If you want a language to be loaded automatically every time you start
\note{If you want a language to be loaded automatically every time you start
up, it must be located in the \fname{/.rockbox/langs} directory and the filename
must be a maximum of 24 characters long.\\}
@ -78,7 +78,7 @@ file find the instructions on the Rockbox website:
\opt{lcd_color}{
\subsection{\label{ref:ChangingFiletypeColours}Changing Filetype Colours}
Rockbox has the capability to modify the \setting{File Browser} to show
files of different types in different colours, depending on the file extension.
files of different types in different colours, depending on the file extension.
\subsubsection{Set-up}
There are two steps to changing the filetype colours -- creating
@ -100,7 +100,7 @@ file find the instructions on the Rockbox website:
\config{???:FFFFFF}\\*
The permissible extensions are as follows:\\*
\\
\\
\config{folder, m3u, m3u8, cfg, wps, lng, rock, bmark, cue, colours, mpa,
\firmwareextension{}, %
\opt{swcodec}{mp1, }mp2, mp3%
@ -140,7 +140,7 @@ file find the instructions on the Rockbox website:
automatically understands the
\fname{.colours} file format, but an external text editor can
also be used. To edit the \fname{.colours} file using Rockbox,
``play'' it in the \setting{File Browser}. The file will open in
``play'' it in the \setting{File Browser}. The file will open in
the \setting{Text Editor}. Upon selecting a line, the following choices
will appear:\\*
\\
@ -172,7 +172,7 @@ file find the instructions on the Rockbox website:
\subsection{UI Viewport}
By default, the UI is drawn on the whole screen. This can be changed so that
the UI is confined to a specific area of the screen, by use of a UI
viewport. This is done by adding the following line to the
viewport. This is done by adding the following line to the
\fname{.cfg} file for a theme:\\*
\nopt{lcd_non-mono}{\config{ui viewport: X,Y,[width],[height],[font]}}
@ -196,7 +196,7 @@ file find the instructions on the Rockbox website:
}
Only the first two parameters \emph{have} to be specified, the others can
be omitted using `-' as a placeholder. The syntax is very similar to WPS
be omitted using `-' as a placeholder. The syntax is very similar to WPS
viewports (see \reference{ref:Viewports}). Briefly:
\nopt{lcd_non-mono}{\input{advanced_topics/viewports/mono-uivp-syntax.tex}}
@ -226,7 +226,7 @@ file find the instructions on the Rockbox website:
\subsection{\label{ref:CreateYourOwnWPS}Themes -- Create Your Own}
The theme files are simple text files, and can be created (or edited) in your
favourite text editor. To make sure non-English characters
favourite text editor. To make sure non-English characters
display correctly in your theme you must save the theme files with UTF-8
character encoding. This can be done in most editors, for example Notepad in
Windows 2000 or XP (but not in 9x/ME) can do this.
@ -236,7 +236,7 @@ Windows 2000 or XP (but not in 9x/ME) can do this.
WPS files have the extension \fname{.wps}, FM screen files have the extension
\fname{.fms}, and SBS files have the extension \fname{.sbs}. The main theme
file has the extension \fname{.cfg}. All files should have the same name.
The theme \fname{.cfg} file should be placed in the \fname{/.rockbox/themes}
directory, while the \fname{.wps}, \fname{.fms} and \fname{.sbs} files should
be placed in the \fname{/.rockbox/wps} directory. Any images used by the
@ -269,19 +269,19 @@ are discussed below.
\subsubsection{\label{ref:Viewports}Viewports}
By default, a viewport filling the whole screen contains all the elements
defined in each theme file. The
defined in each theme file. The
\opt{lcd_non-mono}{elements in this viewport are displayed
with the same background/\linebreak{}foreground
\opt{lcd_color}{colours}\nopt{lcd_color}{shades} and the}
text is rendered in the
same font as in the main menu. To change this behaviour a custom viewport can
be defined. A viewport is a rectangular window on the screen%
be defined. A viewport is a rectangular window on the screen%
\opt{lcd_non-mono}{ with its own foreground/background
\opt{lcd_color}{colours}\nopt{lcd_color}{shades}}.
This window also has variable dimensions. To
define a viewport a line starting \config{{\%V(\dots}} has to be
present in the theme file. The full syntax will be explained later in
this section. All elements placed before the
this section. All elements placed before the
line defining a viewport are displayed in the default viewport. Elements
defined after a viewport declaration are drawn within that viewport.
\opt{lcd_bitmap}{Loading images (see Appendix \reference{ref:wps_images})
@ -390,25 +390,25 @@ and the WPS, but you can use multiple fonts in each of the individual screens.\\
\item[If/else: ]
Syntax: \config{\%?xx{\textless}true{\textbar}false{\textgreater}}
If the tag specified by ``\config{xx}'' has a value, the text between the
If the tag specified by ``\config{xx}'' has a value, the text between the
``\config{{\textless}}'' and the ``\config{{\textbar}}'' is displayed (the true
part), else the text between the ``\config{{\textbar}}'' and the
part), else the text between the ``\config{{\textbar}}'' and the
``\config{{\textgreater}}'' is displayed (the false part).
The else part is optional, so the ``\config{{\textbar}}'' does not have to be
The else part is optional, so the ``\config{{\textbar}}'' does not have to be
specified if no else part is desired. The conditionals nest, so the text in the
if and else part can contain all \config{\%} commands, including conditionals.
\item[Enumerations: ]
Syntax: \config{\%?xx{\textless}alt1{\textbar}alt2{\textbar}alt3{\textbar}\dots{\textbar}else{\textgreater}}
For tags with multiple values, like Play status, the conditional can hold a
For tags with multiple values, like Play status, the conditional can hold a
list of alternatives, one for each value the tag can have.
Example enumeration:
Example enumeration:
\begin{example}
\%?mp{\textless}Stop{\textbar}Play{\textbar}Pause{\textbar}Ffwd{\textbar}Rew{\textgreater}
\end{example}
The last else part is optional, and will be displayed if the tag has no value.
The last else part is optional, and will be displayed if the tag has no value.
The WPS parser will always display the last part if the tag has no value, or if
the list of alternatives is too short.
\end{description}
@ -419,8 +419,8 @@ about to play after the one currently playing (unless you change the
plan).
If you use the upper-case versions of the
three tags: \config{F}, \config{I} and \config{D}, they will instead refer to
the next song instead of the current one. Example: \config{\%Ig} is the genre
three tags: \config{F}, \config{I} and \config{D}, they will instead refer to
the next song instead of the current one. Example: \config{\%Ig} is the genre
name used in the next song and \config{\%Ff} is the mp3 frequency.\\
\note{The next song information \emph{will not} be available at all
@ -430,8 +430,8 @@ name used in the next song and \config{\%Ff} is the mp3 frequency.\\
\subsubsection{\label{ref:AlternatingSublines}Alternating Sublines}
It is possible to group items on each line into 2 or more groups or
``sublines''. Each subline will be displayed in succession on the line for a
It is possible to group items on each line into 2 or more groups or
``sublines''. Each subline will be displayed in succession on the line for a
specified time, alternating continuously through each defined subline.
Items on a line are broken into sublines with the semicolon
@ -439,9 +439,9 @@ Items on a line are broken into sublines with the semicolon
each subline defaults to 2 seconds unless modified by using the
`\config{\%t}' tag to specify an alternate
time (in seconds and optional tenths of a second) for the subline to be
displayed.
displayed.
Subline related special characters and tags:
Subline related special characters and tags:
\begin{description}
\item[;] Split items on a line into separate sublines
\item[\%t] Set the subline display time. The
@ -469,7 +469,7 @@ Example subline with conditionals:
%?it{\textless}%t(8)%s%it{\textbar}%s%fn{\textgreater};%?ia{\textless}%t(3)%s%ia{\textbar}%t(0){\textgreater}\\
\end{example}
The format above will do two different things depending if ID3 tags are
The format above will do two different things depending if ID3 tags are
present. If the ID3 artist and title are present:
\begin{itemize}
\item Display id3 title for 8 seconds,
@ -481,17 +481,17 @@ If the ID3 artist and title are not present:
\item Display the filename continuously.
\end{itemize}
Note that by using a subline display time of 0 in one branch of a conditional,
a subline can be skipped (not displayed) when that condition is met.
a subline can be skipped (not displayed) when that condition is met.
\subsubsection{Using Images}
You can have as many as 52 images in your WPS. There are various ways of
You can have as many as 52 images in your WPS. There are various ways of
displaying images:
\begin{enumerate}
\item Load and always show the image, using the \config{\%x} tag
\item Preload the image with \config{\%xl} and show it with \config{\%xd}.
\item Preload the image with \config{\%xl} and show it with \config{\%xd}.
This way you can have your images displayed conditionally.
\nopt{archos}{%
\item Load an image and show as backdrop using the \config{\%X} tag. The
\item Load an image and show as backdrop using the \config{\%X} tag. The
image must be of the same exact dimensions as your display.
}%
\end{enumerate}
@ -514,12 +514,12 @@ Example on bitmap preloading and use:
%xl(e,rep\_shuffle.bmp,16,64)
%?mm<%xd(b)|%xd(c)|%xd(d)|%xd(e)>
\end{example}
Four images at the same x and y position are preloaded in the example. Which
Four images at the same x and y position are preloaded in the example. Which
image to display is determined by the \config{\%mm} tag (the repeat mode).
\subsubsection{Example File}
\begin{example}
%s%?in<%in - >%?it<%it|%fn> %?ia<[%ia%?id<, %id>]>
%s%?in<%in - >%?it<%it|%fn> %?ia<[%ia%?id<, %id>]>
%pb%pc/%pt
\end{example}
That is, ``tracknum -- title [artist, album]'', where most fields are only
@ -531,7 +531,7 @@ title [artist]''.
% %s%?it<%?in<%in. |>%it|%fn>
% %s%?ia<%ia|%?d2<%d(2)|(root)>>
% %s%?id<%id|%?d1<%d(1)|(root)>> %?iy<(%iy)|>
%
%
% %al%pc/%pt%ar[%pp:%pe]
% %fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>
% %pb
@ -552,25 +552,25 @@ a \fname{car.cfg} file for the settings that you use while playing your
jukebox in your car, and a \fname{headphones.cfg} file to store the
settings that you use while listening to your \dap{} through headphones.
See \reference{ref:cfg_specs} below for an explanation of the format
See \reference{ref:cfg_specs} below for an explanation of the format
for configuration files. See \reference{ref:manage_settings_menu} for an
explanation of how to create, edit and load configuration files.
\subsection{\label{ref:cfg_specs}Specifications for \fname{.cfg} Files}
The Rockbox configuration file is a plain text file, so once you use the
\setting{Save .cfg file} option to create the file, you can edit the file on
The Rockbox configuration file is a plain text file, so once you use the
\setting{Save .cfg file} option to create the file, you can edit the file on
your computer using any text editor program. See
Appendix \reference{ref:config_file_options} for available settings. Configuration
Appendix \reference{ref:config_file_options} for available settings. Configuration
files use the following formatting rules: %
\begin{enumerate}
\item Each setting must be on a separate line.
\item Each line has the format ``setting: value''.
\item Values must be within the ranges specified in this manual for each
setting.
\item Lines starting with \# are ignored. This lets you write comments into
your configuration files.
\begin{enumerate}
\item Each setting must be on a separate line.
\item Each line has the format ``setting: value''.
\item Values must be within the ranges specified in this manual for each
setting.
\item Lines starting with \# are ignored. This lets you write comments into
your configuration files.
\end{enumerate}
Example of a configuration file:
@ -586,17 +586,17 @@ Example of a configuration file:
lang: /.rockbox/afrikaans.lng
\end{example}
\note{As you can see from the example, configuration files do not need to
contain all of the Rockbox options. You can create configuration files
that change only certain settings. So, for example, suppose you
typically use the \dap{} at one volume in the car, and another when using
headphones. Further, suppose you like to use an inverse LCD when you are
in the car, and a regular LCD setting when you are using headphones. You
could create configuration files that control only the volume and LCD
settings. Create a few different files with different settings, give
each file a different name (such as \fname{car.cfg},
\fname{headphones.cfg}, etc.), and you can then use the \setting{Browse .cfg
files} option to quickly change settings.\\}
\note{As you can see from the example, configuration files do not need to
contain all of the Rockbox options. You can create configuration files
that change only certain settings. So, for example, suppose you
typically use the \dap{} at one volume in the car, and another when using
headphones. Further, suppose you like to use an inverse LCD when you are
in the car, and a regular LCD setting when you are using headphones. You
could create configuration files that control only the volume and LCD
settings. Create a few different files with different settings, give
each file a different name (such as \fname{car.cfg},
\fname{headphones.cfg}, etc.), and you can then use the \setting{Browse .cfg
files} option to quickly change settings.\\}
A special case configuration file can be used to force a particular setting
or settings every time Rockbox starts up (e.g. to set the volume to a safe
@ -604,35 +604,35 @@ Example of a configuration file:
and save it into the \fname{/.rockbox} directory with the filename
\fname{fixed.cfg}.
\subsection{\label{ref:manage_settings_menu}The \setting{Manage Settings}
menu} The \setting{Manage Settings} menu can be found in the \setting{Main
Menu}. The \setting{Manage Settings} menu allows you to save and load
\subsection{\label{ref:manage_settings_menu}The \setting{Manage Settings}
menu} The \setting{Manage Settings} menu can be found in the \setting{Main
Menu}. The \setting{Manage Settings} menu allows you to save and load
\fname{.cfg} files.
\begin{description}
\item [Browse .cfg Files]Opens the \setting{File Browser} in the
\fname{/.rockbox} directory and displays all \fname{.cfg} (configuration)
files. Selecting a \fname{.cfg} file will cause Rockbox to load the settings
contained in that file. Pressing \ActionStdCancel{} will exit back to the
\setting{Manage Settings} menu. See the \setting{Write .cfg files} option on
the \setting{Manage Settings} menu for details of how to save and edit a
the \setting{Manage Settings} menu for details of how to save and edit a
configuration file.
\item [Reset Settings]This wipes the saved settings
in the \dap{} and resets all settings to their default values.
in the \dap{} and resets all settings to their default values.
\opt{IRIVER_H100_PAD,IRIVER_H300_PAD,IAUDIO_X5_PAD,SANSA_E200_PAD,SANSA_C200_PAD%
,PBELL_VIBE500_PAD,SAMSUNG_YH92X_PAD,SAMSUNG_YH820_PAD}{
\note{You can also reset all settings to their default
\note{You can also reset all settings to their default
values by turning off the \dap, turning it back on, and holding the
\ButtonRec{} button immediately after the \dap{} turns on.}
}
}
\opt{IRIVER_H10_PAD}{\note{You can also reset all settings to
their default values by turning off the \dap, and turning it back on
with the \ButtonHold{} button on.}
}
\opt{IPOD_4G_PAD}{\note{You can also reset all settings to their default
\opt{IPOD_4G_PAD}{\note{You can also reset all settings to their default
values by turning off the \dap, turning it back on, and activating the
\ButtonHold{} button immediately after the backlight comes on.}
}
@ -641,23 +641,23 @@ Example of a configuration file:
\ButtonA{} button immediately after the \dap{} turns on.}
}
\item [Save .cfg File]This option writes a \fname{.cfg} file to
your \daps{} disk. The configuration file has the \fname{.cfg}
extension and is used to store all of the user settings that are described
\item [Save .cfg File]This option writes a \fname{.cfg} file to
your \daps{} disk. The configuration file has the \fname{.cfg}
extension and is used to store all of the user settings that are described
throughout this manual.
Hint: Use the \setting{Save .cfg File} feature (\setting{Main Menu
$\rightarrow$ Manage Settings}) to save the current settings, then
use a text editor to customize the settings file. See Appendix
\reference{ref:config_file_options} for the full reference of available
Hint: Use the \setting{Save .cfg File} feature (\setting{Main Menu
$\rightarrow$ Manage Settings}) to save the current settings, then
use a text editor to customize the settings file. See Appendix
\reference{ref:config_file_options} for the full reference of available
options.
\item [Save Sound Settings]This option writes a \fname{.cfg} file to
your \daps{} disk. The configuration file has the \fname{.cfg}
\item [Save Sound Settings]This option writes a \fname{.cfg} file to
your \daps{} disk. The configuration file has the \fname{.cfg}
extension and is used to store all of the sound related settings.
\item [Save Theme Settings]This option writes a \fname{.cfg} file to
your \daps{} disk. The configuration file has the \fname{.cfg}
\item [Save Theme Settings]This option writes a \fname{.cfg} file to
your \daps{} disk. The configuration file has the \fname{.cfg}
extension and is used to store all of the theme related settings.
\end{description}
@ -665,16 +665,16 @@ Example of a configuration file:
\section{\label{ref:FirmwareLoading}Firmware Loading}
\opt{player,recorder,recorderv2fm,ondio}{
When your \dap{} powers on, it loads the Archos firmware in ROM, which
automatically checks your \daps{} root directory for a file named
\firmwarefilename. Note that Archos firmware can only read the first
ten characters of each filename in this process, so do not rename your old
firmware files with names like \firmwarefilename.\fname{old} and so on,
because it is possible that the \dap{} will load a file other than the one
automatically checks your \daps{} root directory for a file named
\firmwarefilename. Note that Archos firmware can only read the first
ten characters of each filename in this process, so do not rename your old
firmware files with names like \firmwarefilename.\fname{old} and so on,
because it is possible that the \dap{} will load a file other than the one
you intended.
}
\subsection{\label{ref:using_rolo}Using ROLO (Rockbox Loader)}
Rockbox is able to load and start another firmware file without rebooting.
Rockbox is able to load and start another firmware file without rebooting.
You just ``play'' a file with the extension %
\opt{recorder,recorderv2fm,ondio}{\fname{.ajz}.} %
\opt{player}{\fname{.mod}.} %
@ -690,76 +690,79 @@ current version.
\opt{archos}{\input{advanced_topics/archos-flashing.tex}}
\section{Optimising battery runtime}
Rockbox offers a lot of settings that have high impact on the battery runtime
Rockbox offers a lot of settings that have high impact on the battery runtime
of your \dap{}. The largest power savings can be achieved through disabling
unneeded hardware components -- for some of those there are settings
available.
available.
\opt{swcodec}{
Another area of savings is avoiding or reducing CPU boosting
through disabling computing intense features (e.g. sound processing) or
using effective audio codecs.
} The following provides a short overview of the most relevant settings and
through disabling computing intense features (e.g. sound processing) or
using effective audio codecs.
} The following provides a short overview of the most relevant settings and
rules of thumb.
\nopt{ondio}{
\subsection{Display backlight}
The active backlight consumes a lot of power. Therefore choose a setting that
disables the backlight after timeout (for setting \setting{Backlight} see
\reference{ref:Displayoptions}). Avoid to have the backlight enabled all the
time.
disables the backlight after timeout (for setting \setting{Backlight} see
\reference{ref:Displayoptions}). Avoid having the backlight enabled all the
time (Activating \setting{selectivebacklight}
\reference{ref:selectivebacklight} can further reduce power consumption).
}
\opt{lcd_sleep}{
\subsection{Display power-off}
Shutting down the display and the display controller saves a reasonable amount
Shutting down the display and the display controller saves a reasonable amount
of power. Choose a setting that will put the display to sleep after timeout
(for setting \setting{Sleep} see \reference{ref:Displayoptions}). Avoid to
(for setting \setting{Sleep} see \reference{ref:Displayoptions}). Avoid to
have the display enabled all the time -- even, if the display is transflective
and is readable without backlight. Depending on your \dap{} it might be
significantly more efficient to re-enable the display and its backlight for a
and is readable without backlight. Depending on your \dap{} it might be
significantly more efficient to re-enable the display and its backlight for a
glimpse a few times per hour than to keep the display enabled.
}
\opt{accessory_supply}{
\subsection{Accessory power supply}
As default your \dap{}'s accessory power supply is always enabled to ensure
proper function of connected accessory devices. Disable this power supply, if
-- or as long as -- you do not use any accessory device with your \dap{} while
proper function of connected accessory devices. Disable this power supply, if
-- or as long as -- you do not use any accessory device with your \dap{} while
running Rockbox (see \reference{ref:AccessoryPowerSupply}).
}
\opt{lineout_poweroff}{
\subsection{Line Out}
Rockbox allows to switch off the line-out on your \dap{}. If you do not need
Rockbox allows to switch off the line-out on your \dap{}. If you do not need
the line-out, switch it off (see \reference{ref:LineoutOnOff}).
}
\opt{spdif_power}{
\subsection{Optical Output}
Rockbox allows to switch off the S/PDIF output on your \dap{}. If you do not
Rockbox allows to switch off the S/PDIF output on your \dap{}. If you do not
need this output, switch it off (see \reference{ref:SPDIF_OnOff}).
}
\opt{disk_storage}{
\subsection{Anti-Skip Buffer}
Having a large anti-skip buffer tends to use more power, and may reduce your
battery life. It is recommended to always use the lowest possible setting
battery life. It is recommended to always use the lowest possible setting
that allows correct and continuous playback (see \reference{ref:AntiSkipBuf}).
}
\opt{swcodec}{
\subsection{Replaygain}
Replaygain is a post processing that equalises the playback volume of audio
files to the same perceived loudness. This post processing applies a factor
to each single PCM sample and is therefore consuming additional CPU time. If
you want to achieve some (minor) savings in runtime, switch this feature off
Replaygain is a post processing that equalises the playback volume of audio
files to the same perceived loudness. This post processing applies a factor
to each single PCM sample and is therefore consuming additional CPU time. If
you want to achieve some (minor) savings in runtime, switch this feature off
(see \reference{ref:ReplayGain}).
}
\opt{lcd_bitmap}{
\subsection{Peak Meter}
The peak meter is a feature of the While Playing Screen and will be updated with a
high framerate. Depending on your \dap{} this might result in a high CPU load. To
The peak meter is a feature of the While Playing Screen and will be updated with a
high framerate. Depending on your \dap{} this might result in a high CPU load. To
save battery runtime you should switch this feature off (see \reference{ref:peak_meter}).
\opt{ipodvideo}{
\note{Especially the \playerman{} \playertype{} suffers from an enabled peak meter.}
@ -770,36 +773,36 @@ current version.
\subsection{Audio format and bitrate}
\opt{swcodec}{
In general the fastest decoding audio format will be the best in terms of
battery runtime on your \dap{}. An overview of different codec's performance
battery runtime on your \dap{}. An overview of different codec's performance
on different \dap{}s can be found at \wikilink{CodecPerformanceComparison}.
}
\opt{flash_storage}{
Your target uses flash that consumes a certain amount of power during access.
The less often the flash needs to be switched on for buffering and the shorter
the buffering duration is, the lower is the overall power consumption.
Therefore the bitrate of the audio files does have an impact on the battery
runtime as well. Lower bitrate audio files will result in longer battery
The less often the flash needs to be switched on for buffering and the shorter
the buffering duration is, the lower is the overall power consumption.
Therefore the bitrate of the audio files does have an impact on the battery
runtime as well. Lower bitrate audio files will result in longer battery
runtime.
}
\opt{disk_storage}{
Your target uses a hard disk which consumes a large amount of power while
spinning -- up to several hundred mA. The less often the hard disk needs to
spin up for buffering and the shorter the buffering duration is, the lower is
the power consumption. Therefore the bitrate of the audio files does have an
impact on the battery runtime as well. Lower bitrate audio files will result
spinning -- up to several hundred mA. The less often the hard disk needs to
spin up for buffering and the shorter the buffering duration is, the lower is
the power consumption. Therefore the bitrate of the audio files does have an
impact on the battery runtime as well. Lower bitrate audio files will result
in longer battery runtime.
}
Please do not re-encode any existing audio files from one lossy format to
Please do not re-encode any existing audio files from one lossy format to
another based upon the above mentioned. This will reduce the audio quality.
If you have the choice, select the best suiting codec when encoding the
If you have the choice, select the best suiting codec when encoding the
original source material.
}
\opt{swcodec}{
\subsection{Sound settings}
In general all kinds of sound processing will need more CPU time and therefore
consume more power. The less sound processing you use, the better it is for
consume more power. The less sound processing you use, the better it is for
the battery runtime (for options see \reference{ref:configure_rockbox_sound}).
}

66
manual/configure_rockbox/display_options.tex Normal file → Executable file
View file

@ -1,6 +1,6 @@
% $Id$ %
\section{\label{ref:Displayoptions}Display}
\begin{description}
\item[LCD Settings.]
@ -32,14 +32,14 @@
\item[Backlight Fade In.]
The amount of time that the backlight will take to fade from off to on
after a button is pressed. If set to \setting{Off} the backlight will
turn on immediately, with no fade in. Can also be set to
turn on immediately, with no fade in. Can also be set to
\setting{500ms}, \setting{1s} or \setting{2s}.
\item[Backlight Fade Out.]
Like Backlight fade in, this controls the amount of time that the
backlight will take to fade from on to off after a button is pressed. If
set to \setting{Off} the backlight will turn off immediately, with no
fade out. Other valid values: \setting{500ms}, \setting{1s},
\setting{2s}, \setting{3s}, \setting{4s}, \setting{5s} or
\setting{2s}, \setting{3s}, \setting{4s}, \setting{5s} or
\setting{10s}.
}
\opt{backlight_fade_bool}{
@ -56,21 +56,51 @@
With this option enabled the first keypress while the backlight is turned
off will only turn the backlight on without having any other effect. When
disabled the first keypress will \emph{also} perform its appropriate action.
\item[\label{ref:selectivebacklight}Selective Backlight]
This option allows some selected actions in While Playing Screen and
FM screen to \emph{not} turn on the backlight in order to save power.
\begin{description}
\item[Enabled.]
Enables/disables the feature.
\item[Settings.]
Allows to select actions that will \emph{not} activate backlight.
\begin{itemize}
\item[Volume.]
Volume up/down.
\item[Play.]
Toggling Play/Pause.
\item[Seek.]
Seeking in a track.
\item[Skip.]
Skipping of a track.
\item[Disable Unmapped Keys.]
Buttons that have no action assigned and accidental button
combinations don't turn on backlight.
\item[Disable on External Power.]
When plugged goes back to regular behavior.
\end{itemize}
Selected actions are indicated by a leading +.
Note: If all options get de-selected, the entire feature is disabled.
\end{description}
\opt{lcd_sleep}{
\item[Sleep (After Backlight Off).]
This setting controls how long rockbox will wait before turning off the
display after the backlight is turned off. Turning off the display
saves battery power but turning on the display takes noticeably longer
saves battery power but turning on the display takes noticeably longer
than just turning on the backlight.
}
\opt{backlight_brightness}{
\item[Brightness.]
Changes the brightness of your LCD display.
}
} % \opt{HAVE_BACKLIGHT}
\opt{lcd_contrast}{
\item[Contrast.]
Changes the contrast of your LCD display.
@ -122,7 +152,7 @@
This setting lets you invert the whole screen, so now you get a
black background and light text and graphics.
\item[Upside Down.]
Displays the screen so that the top of the display is nearest
Displays the screen so that the top of the display is nearest
the buttons. This is sometimes useful when carrying the \dap\ in a
pocket for easy access to the headphone socket.
\opt{remote_ticking}{
@ -138,7 +168,7 @@
the following parameters:
\begin{description}
\item[Scroll Speed.]
Sets how many times per second the automatic horizontal scrolling text
Sets how many times per second the automatic horizontal scrolling text
will move a step.
\item[Scroll Start Delay.]
Controls how many milliseconds Rockbox should wait before a new
@ -184,23 +214,23 @@
useful on slow displays.
\nopt{scrollwheel}{
\item[List Acceleration Start Delay.]
This setting enables the acceleration of scroll speed in lists when
holding \ActionStdPrev{} or \ActionStdNext{}. When set to
\setting{Off} the acceleration is disabled. When any other value is set
This setting enables the acceleration of scroll speed in lists when
holding \ActionStdPrev{} or \ActionStdNext{}. When set to
\setting{Off} the acceleration is disabled. When any other value is set
the acceleration will start to accelerate after holding
\ActionStdPrev{} or \ActionStdNext{} for the chosen time (in
\ActionStdPrev{} or \ActionStdNext{} for the chosen time (in
seconds).
\item[List Acceleration Speed.]
This setting controls how fast the scroll speed accelerates. The scroll
speed will increase every N seconds. For example, selecting
\setting{Speed up every 3s} will increase the scroll speed every 3
This setting controls how fast the scroll speed accelerates. The scroll
speed will increase every N seconds. For example, selecting
\setting{Speed up every 3s} will increase the scroll speed every 3
seconds while \ActionStdPrev{} or \ActionStdNext{} is held.
}
\end{description}
%
\opt{lcd_bitmap}{
\item[Peak Meter.]
The peak meter can be configured with a number of parameters.
The peak meter can be configured with a number of parameters.
\begin{description}
\item[Peak Release.]
This determines how fast the bar shrinks when the music becomes
@ -216,7 +246,7 @@
\item[Clip Hold Time.]
The number of seconds that the clipping indicator will be visible
after clipping is detected.
\opt{recording}{
\opt{recording}{
\item[Clip Counter.]
Show the number of times the clip indicator went active during
recording in front of the peak meters.

71
manual/configure_rockbox/system_options.tex Normal file → Executable file
View file

@ -167,11 +167,11 @@ this option \setting{On}. If it is not required, then turning this setting
\opt{lineout_poweroff}{
\subsection{\label{ref:LineoutOnOff}Line Out}
This option turns the \dap{}'s line-out \setting{On} and \setting{Off}. On some
devices an enabled line-out will consume some power even if not used. If it is
not required, then turning this setting \setting{Off} will save battery and
This option turns the \dap{}'s line-out \setting{On} and \setting{Off}. On some
devices an enabled line-out will consume some power even if not used. If it is
not required, then turning this setting \setting{Off} will save battery and
therefore result in better runtime.
}
}
\opt{HAVE_BUTTON_LIGHTS}{
\opt{e200,e200v2}{
@ -243,6 +243,61 @@ therefore result in better runtime.
\nopt{HAS_BUTTON_HOLD}{
\subsection{Advanced Key Lock}
This option allows users to select actions that when within WPS or FMS will \emph{not} be
blocked by the key lock (software hold switch).
\begin{description}
\item[Enabled.]
Enables/disables the feature.
\item[Settings.]
Allows to select actions that will \emph{not} be blocked by the key lock.
\begin{itemize}
\item[Volume.]
Volume up/down.
\item[Play.]
Toggling Play/Pause.
\item[Seek.]
Seeking in a track.
\item[Skip.]
Skipping of a track.
\opt{HAVE_BACKLIGHT}{
\item[Autolock On.]
When the backlight turns off, softlock will lock the screen,
activates when you press the lock key and if you manually lock
again, while active it then disables autolock.
\begin{itemize}
\item
(Lock Button Pressed \#1) >Auto Lock On
(device still unlocked till backlight timeout).
\item
(Lock Button Pressed \#2) >Auto Lock Off (device locked).
\item
(Lock Button Pressed \#3) >(device unlocked).
\end{itemize}
} %\opt{HAVE_BACKLIGHT}
\opt{touchpad}{
\item[Disable Touch.]
Blocks touch screen buttons like the original.
}
\item[Disable Notify.]
Suppresses the notification 'Buttons Locked'
(still will if power button is pressed).
\note{This is a pre-requisite for \setting{selectivebacklight}
\reference{ref:selectivebacklight} to work also during key lock.}
\end{itemize}
Selected actions are indicated by a leading +.
Note: If all options get de-selected, the entire feature is disabled.
\end{description}
} %\nopt{HAS_BUTTON_HOLD}
\opt{usb_hid}{
\subsection{\label{ref:USB_HID}USB HID}
This option turns the USB HID feature \setting{On} and \setting{Off}.
@ -550,7 +605,7 @@ therefore result in better runtime.
\\
\end{btnmap}
\item [Browser.] This mode lets you control a web browser (e.g.
\item [Browser.] This mode lets you control a web browser (e.g.
Firefox). It uses the \dap{}'s keys to navigate through the web page
and different tabs, navigate through history, and to control zoom.
@ -592,7 +647,7 @@ therefore result in better runtime.
\\
}
% Zoom in / out
% Zoom in / out
\opt{SANSA_FUZEPLUS_PAD}{Long \ButtonBottomRight}
\opt{SANSA_E200_PAD,SANSA_C200_PAD,SANSA_CLIP_PAD}
{Long \ButtonUp / Long \ButtonDown}
@ -707,13 +762,13 @@ therefore result in better runtime.
,SANSA_CLIP_PAD,MROBE100_PAD,PBELL_VIBE500_PAD,SANSA_FUZEPLUS_PAD%
,SAMSUNG_YH92X_PAD,SAMSUNG_YH820_PAD}
{\ButtonUp / \ButtonDown / \ButtonLeft / \ButtonRight}
\opt{IRIVER_H10_PAD}{\ButtonScrollUp / \ButtonScrollDown /
\opt{IRIVER_H10_PAD}{\ButtonScrollUp / \ButtonScrollDown /
\ButtonLeft / \ButtonRight}
\opt{IPOD_4G_PAD,IPOD_3G_PAD,IPOD_1G2G_PAD}
{\ButtonMenu / \ButtonPlay / \ButtonLeft / \ButtonRight}
&
\opt{HAVEREMOTEKEYMAP}{
\opt{MROBE100_RC_PAD}{\ButtonRCPlay / \ButtonRCDisplay /
\opt{MROBE100_RC_PAD}{\ButtonRCPlay / \ButtonRCDisplay /
\ButtonRCRew / \ButtonRCFF}%
&}
Cursor move up / down / left / right, respectively