New option: First keypress enables backlight only. Patch #2920 by Nicolas Pennequin.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9228 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
86f1e2ead2
commit
da5fb18bca
9 changed files with 74 additions and 2 deletions
|
@ -3832,3 +3832,9 @@ desc: "pitch" in the pitch screen
|
||||||
eng: "Pitch"
|
eng: "Pitch"
|
||||||
voice: "Pitch"
|
voice: "Pitch"
|
||||||
new:
|
new:
|
||||||
|
|
||||||
|
id: LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS
|
||||||
|
desc: Backlight behaviour setting
|
||||||
|
eng: "First keypress enables backlight only"
|
||||||
|
voice: "First keypress enables backlight only"
|
||||||
|
new:
|
||||||
|
|
|
@ -294,6 +294,14 @@ static const struct bit_entry rtc_bits[] =
|
||||||
#ifdef HAVE_REMOTE_LCD_TICKING
|
#ifdef HAVE_REMOTE_LCD_TICKING
|
||||||
{1, S_O(remote_reduce_ticking), false, "remote reduce ticking", off_on },
|
{1, S_O(remote_reduce_ticking), false, "remote reduce ticking", off_on },
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
{1, S_O(bl_filter_first_keypress), true, "backlight filters first keypress", off_on },
|
||||||
|
#else
|
||||||
|
{1, S_O(bl_filter_first_keypress), false, "backlight filters first keypress", off_on },
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* new stuff to be added here */
|
/* new stuff to be added here */
|
||||||
|
@ -1115,6 +1123,10 @@ void settings_apply(void)
|
||||||
#ifdef HAVE_SPDIF_POWER
|
#ifdef HAVE_SPDIF_POWER
|
||||||
spdif_power_enable(global_settings.spdif_enable);
|
spdif_power_enable(global_settings.spdif_enable);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -472,6 +472,10 @@ struct user_settings
|
||||||
int fg_color; /* foreground color native format */
|
int fg_color; /* foreground color native format */
|
||||||
#endif
|
#endif
|
||||||
bool party_mode; /* party mode - unstoppable music */
|
bool party_mode; /* party mode - unstoppable music */
|
||||||
|
|
||||||
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
bool bl_filter_first_keypress; /* filter first keypress when dark? */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
enum optiontype { INT, BOOL };
|
enum optiontype { INT, BOOL };
|
||||||
|
|
|
@ -1046,6 +1046,15 @@ static bool set_party_mode(void)
|
||||||
return set_bool( str(LANG_PARTY_MODE), &global_settings.party_mode );
|
return set_bool( str(LANG_PARTY_MODE), &global_settings.party_mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
static bool set_bl_filter_first_keypress(void)
|
||||||
|
{
|
||||||
|
bool result = set_bool( str(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS),
|
||||||
|
&global_settings.bl_filter_first_keypress );
|
||||||
|
set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool ff_rewind_accel(void)
|
static bool ff_rewind_accel(void)
|
||||||
{
|
{
|
||||||
|
@ -1621,6 +1630,7 @@ static bool lcd_settings_menu(void)
|
||||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||||
{ ID2P(LANG_BRIGHTNESS), brightness },
|
{ ID2P(LANG_BRIGHTNESS), brightness },
|
||||||
#endif
|
#endif
|
||||||
|
{ ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_bl_filter_first_keypress },
|
||||||
#endif /* CONFIG_BACKLIGHT */
|
#endif /* CONFIG_BACKLIGHT */
|
||||||
{ ID2P(LANG_CONTRAST), contrast },
|
{ ID2P(LANG_CONTRAST), contrast },
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
|
|
@ -522,6 +522,14 @@ void backlight_off(void)
|
||||||
queue_post(&backlight_queue, BACKLIGHT_OFF, NULL);
|
queue_post(&backlight_queue, BACKLIGHT_OFF, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_backlight_on(void)
|
||||||
|
{
|
||||||
|
if (backlight_timer || !backlight_get_current_timeout())
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* return value in ticks; 0 means always on, <0 means always off */
|
/* return value in ticks; 0 means always on, <0 means always off */
|
||||||
int backlight_get_current_timeout(void)
|
int backlight_get_current_timeout(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,9 @@ static long last_read; /* Last button status, for debouncing/filtering */
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
static bool flipped; /* buttons can be flipped to match the LCD flip */
|
static bool flipped; /* buttons can be flipped to match the LCD flip */
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
static bool filter_first_keypress;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* how often we check to see if a button is pressed */
|
/* how often we check to see if a button is pressed */
|
||||||
#define POLL_FREQUENCY HZ/100
|
#define POLL_FREQUENCY HZ/100
|
||||||
|
@ -504,6 +507,9 @@ static void button_tick(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
if ( !filter_first_keypress || is_backlight_on())
|
||||||
|
#endif
|
||||||
queue_post(&button_queue, btn, NULL);
|
queue_post(&button_queue, btn, NULL);
|
||||||
post = false;
|
post = false;
|
||||||
}
|
}
|
||||||
|
@ -629,6 +635,9 @@ void button_init(void)
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
flipped = false;
|
flipped = false;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
filter_first_keypress = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP /* only bitmap displays can be flipped */
|
#ifdef HAVE_LCD_BITMAP /* only bitmap displays can be flipped */
|
||||||
|
@ -687,6 +696,13 @@ void button_set_flip(bool flip)
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LCD_BITMAP */
|
#endif /* HAVE_LCD_BITMAP */
|
||||||
|
|
||||||
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
void set_backlight_filter_keypress(bool value)
|
||||||
|
{
|
||||||
|
filter_first_keypress = value;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Archos hardware button hookup
|
Archos hardware button hookup
|
||||||
=============================
|
=============================
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
bool is_backlight_on(void);
|
||||||
void backlight_on(void);
|
void backlight_on(void);
|
||||||
void backlight_off(void);
|
void backlight_off(void);
|
||||||
void backlight_set_timeout(int index);
|
void backlight_set_timeout(int index);
|
||||||
|
|
|
@ -42,6 +42,9 @@ void button_clear_queue(void);
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
void button_set_flip(bool flip); /* turn 180 degrees */
|
void button_set_flip(bool flip); /* turn 180 degrees */
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
void set_backlight_filter_keypress(bool value);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_BUTTON_HOLD
|
#ifdef HAS_BUTTON_HOLD
|
||||||
bool button_hold(void);
|
bool button_hold(void);
|
||||||
|
|
|
@ -37,6 +37,15 @@ struct event_queue button_queue;
|
||||||
|
|
||||||
static int btn = 0; /* Hopefully keeps track of currently pressed keys... */
|
static int btn = 0; /* Hopefully keeps track of currently pressed keys... */
|
||||||
|
|
||||||
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
static bool filter_first_keypress;
|
||||||
|
|
||||||
|
void set_backlight_filter_keypress(bool value)
|
||||||
|
{
|
||||||
|
filter_first_keypress = value;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void button_event(int key, bool pressed)
|
void button_event(int key, bool pressed)
|
||||||
{
|
{
|
||||||
int new_btn = 0;
|
int new_btn = 0;
|
||||||
|
@ -219,6 +228,9 @@ void button_event(int key, bool pressed)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
if ( !filter_first_keypress || is_backlight_on())
|
||||||
|
#endif
|
||||||
queue_post(&button_queue, btn, NULL);
|
queue_post(&button_queue, btn, NULL);
|
||||||
post = false;
|
post = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue