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:
Björn Stenberg 2006-03-24 13:47:24 +00:00
parent 86f1e2ead2
commit da5fb18bca
9 changed files with 74 additions and 2 deletions

View file

@ -3832,3 +3832,9 @@ desc: "pitch" in the pitch screen
eng: "Pitch"
voice: "Pitch"
new:
id: LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS
desc: Backlight behaviour setting
eng: "First keypress enables backlight only"
voice: "First keypress enables backlight only"
new:

View file

@ -294,6 +294,14 @@ static const struct bit_entry rtc_bits[] =
#ifdef HAVE_REMOTE_LCD_TICKING
{1, S_O(remote_reduce_ticking), false, "remote reduce ticking", off_on },
#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
/* new stuff to be added here */
@ -1115,6 +1123,10 @@ void settings_apply(void)
#ifdef HAVE_SPDIF_POWER
spdif_power_enable(global_settings.spdif_enable);
#endif
#ifdef CONFIG_BACKLIGHT
set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
#endif
}

View file

@ -472,6 +472,10 @@ struct user_settings
int fg_color; /* foreground color native format */
#endif
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 };

View file

@ -1046,6 +1046,15 @@ static bool set_party_mode(void)
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)
{
@ -1621,6 +1630,7 @@ static bool lcd_settings_menu(void)
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
{ ID2P(LANG_BRIGHTNESS), brightness },
#endif
{ ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_bl_filter_first_keypress },
#endif /* CONFIG_BACKLIGHT */
{ ID2P(LANG_CONTRAST), contrast },
#ifdef HAVE_LCD_BITMAP

View file

@ -522,6 +522,14 @@ void backlight_off(void)
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 */
int backlight_get_current_timeout(void)
{

View file

@ -52,6 +52,9 @@ static long last_read; /* Last button status, for debouncing/filtering */
#ifdef HAVE_LCD_BITMAP
static bool flipped; /* buttons can be flipped to match the LCD flip */
#endif
#ifdef CONFIG_BACKLIGHT
static bool filter_first_keypress;
#endif
/* how often we check to see if a button is pressed */
#define POLL_FREQUENCY HZ/100
@ -504,7 +507,10 @@ static void button_tick(void)
}
else
{
queue_post(&button_queue, btn, NULL);
#ifdef CONFIG_BACKLIGHT
if ( !filter_first_keypress || is_backlight_on())
#endif
queue_post(&button_queue, btn, NULL);
post = false;
}
#ifdef HAVE_REMOTE_LCD
@ -629,6 +635,9 @@ void button_init(void)
#ifdef HAVE_LCD_BITMAP
flipped = false;
#endif
#ifdef CONFIG_BACKLIGHT
filter_first_keypress = false;
#endif
}
#ifdef HAVE_LCD_BITMAP /* only bitmap displays can be flipped */
@ -687,6 +696,13 @@ void button_set_flip(bool flip)
}
#endif /* HAVE_LCD_BITMAP */
#ifdef CONFIG_BACKLIGHT
void set_backlight_filter_keypress(bool value)
{
filter_first_keypress = value;
}
#endif
/*
Archos hardware button hookup
=============================

View file

@ -21,6 +21,7 @@
#include "config.h"
bool is_backlight_on(void);
void backlight_on(void);
void backlight_off(void);
void backlight_set_timeout(int index);

View file

@ -42,6 +42,9 @@ void button_clear_queue(void);
#ifdef HAVE_LCD_BITMAP
void button_set_flip(bool flip); /* turn 180 degrees */
#endif
#ifdef CONFIG_BACKLIGHT
void set_backlight_filter_keypress(bool value);
#endif
#ifdef HAS_BUTTON_HOLD
bool button_hold(void);

View file

@ -37,6 +37,15 @@ struct event_queue button_queue;
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)
{
int new_btn = 0;
@ -219,7 +228,10 @@ void button_event(int key, bool pressed)
}
else
{
queue_post(&button_queue, btn, NULL);
#ifdef CONFIG_BACKLIGHT
if ( !filter_first_keypress || is_backlight_on())
#endif
queue_post(&button_queue, btn, NULL);
post = false;
}