forked from len0rd/rockbox
Remote LCD: added own backlight timeout stuff
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6533 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4cdc7ca987
commit
7477c09b42
5 changed files with 58 additions and 6 deletions
|
@ -343,6 +343,7 @@ int charging_screen(void)
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
backlight_set_timeout(global_settings.backlight_timeout);
|
backlight_set_timeout(global_settings.backlight_timeout);
|
||||||
|
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
|
||||||
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
|
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
|
||||||
status_draw(true);
|
status_draw(true);
|
||||||
|
|
||||||
|
|
|
@ -253,8 +253,10 @@ static const struct bit_entry rtc_bits[] =
|
||||||
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
/* remote lcd */
|
/* remote lcd */
|
||||||
{6, S_O(remote_contrast), 42, "remote_contrast", NULL },
|
{6, S_O(remote_contrast), 42, "remote contrast", NULL },
|
||||||
{1, S_O(remote_invert), false, "remote_invert", off_on },
|
{1, S_O(remote_invert), false, "remote invert", off_on },
|
||||||
|
{5, S_O(remote_backlight_timeout), 5, "remote backlight timeout",
|
||||||
|
"off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90" },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Current sum of bits: 259 (worst case) */
|
/* Current sum of bits: 259 (worst case) */
|
||||||
|
@ -744,8 +746,9 @@ void settings_apply(void)
|
||||||
lcd_set_contrast(global_settings.contrast);
|
lcd_set_contrast(global_settings.contrast);
|
||||||
lcd_scroll_speed(global_settings.scroll_speed);
|
lcd_scroll_speed(global_settings.scroll_speed);
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
lcd_remote_set_contrast(global_settings.remote_contrast);
|
lcd_remote_set_contrast(global_settings.remote_contrast);
|
||||||
lcd_remote_set_invert_display(global_settings.remote_invert);
|
lcd_remote_set_invert_display(global_settings.remote_invert);
|
||||||
|
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
|
||||||
#endif
|
#endif
|
||||||
backlight_set_timeout(global_settings.backlight_timeout);
|
backlight_set_timeout(global_settings.backlight_timeout);
|
||||||
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
|
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
|
||||||
|
|
|
@ -637,6 +637,37 @@ static bool backlight_timer(void)
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BACKLIGHT */
|
#endif /* CONFIG_BACKLIGHT */
|
||||||
|
|
||||||
|
#ifdef HAVE_REMOTE_LCD
|
||||||
|
|
||||||
|
static bool remote_backlight_timer(void)
|
||||||
|
{
|
||||||
|
static const struct opt_items names[] = {
|
||||||
|
{ STR(LANG_OFF) },
|
||||||
|
{ STR(LANG_ON) },
|
||||||
|
{ "1s ", TALK_ID(1, UNIT_SEC) },
|
||||||
|
{ "2s ", TALK_ID(2, UNIT_SEC) },
|
||||||
|
{ "3s ", TALK_ID(3, UNIT_SEC) },
|
||||||
|
{ "4s ", TALK_ID(4, UNIT_SEC) },
|
||||||
|
{ "5s ", TALK_ID(5, UNIT_SEC) },
|
||||||
|
{ "6s ", TALK_ID(6, UNIT_SEC) },
|
||||||
|
{ "7s ", TALK_ID(7, UNIT_SEC) },
|
||||||
|
{ "8s ", TALK_ID(8, UNIT_SEC) },
|
||||||
|
{ "9s ", TALK_ID(9, UNIT_SEC) },
|
||||||
|
{ "10s", TALK_ID(10, UNIT_SEC) },
|
||||||
|
{ "15s", TALK_ID(15, UNIT_SEC) },
|
||||||
|
{ "20s", TALK_ID(20, UNIT_SEC) },
|
||||||
|
{ "25s", TALK_ID(25, UNIT_SEC) },
|
||||||
|
{ "30s", TALK_ID(30, UNIT_SEC) },
|
||||||
|
{ "45s", TALK_ID(45, UNIT_SEC) },
|
||||||
|
{ "60s", TALK_ID(60, UNIT_SEC) },
|
||||||
|
{ "90s", TALK_ID(90, UNIT_SEC) }
|
||||||
|
};
|
||||||
|
return set_option(str(LANG_BACKLIGHT), &global_settings.remote_backlight_timeout,
|
||||||
|
INT, names, 19, backlight_set_timeout );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_REMOTE_LCD */
|
||||||
|
|
||||||
static bool poweroff_idle_timer(void)
|
static bool poweroff_idle_timer(void)
|
||||||
{
|
{
|
||||||
static const struct opt_items names[] = {
|
static const struct opt_items names[] = {
|
||||||
|
@ -1210,6 +1241,7 @@ static bool lcd_remote_settings_menu(void)
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
static const struct menu_item items[] = {
|
static const struct menu_item items[] = {
|
||||||
|
{ ID2P(LANG_BACKLIGHT), remote_backlight_timer },
|
||||||
{ ID2P(LANG_CONTRAST), remote_contrast },
|
{ ID2P(LANG_CONTRAST), remote_contrast },
|
||||||
{ ID2P(LANG_INVERT), remote_invert },
|
{ ID2P(LANG_INVERT), remote_invert },
|
||||||
/* { ID2P(LANG_FLIP_DISPLAY), remote_flip_display },
|
/* { ID2P(LANG_FLIP_DISPLAY), remote_flip_display },
|
||||||
|
|
|
@ -53,10 +53,11 @@ static bool charger_was_inserted = 0;
|
||||||
static bool backlight_on_when_charging = 0;
|
static bool backlight_on_when_charging = 0;
|
||||||
|
|
||||||
static int backlight_timer;
|
static int backlight_timer;
|
||||||
|
static unsigned int backlight_timeout = 5;
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
static int remote_backlight_timer;
|
static int remote_backlight_timer;
|
||||||
|
static unsigned int remote_backlight_timeout = 5;
|
||||||
#endif
|
#endif
|
||||||
static unsigned int backlight_timeout = 5;
|
|
||||||
|
|
||||||
static void __backlight_off(void)
|
static void __backlight_off(void)
|
||||||
{
|
{
|
||||||
|
@ -103,7 +104,7 @@ void backlight_thread(void)
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
case REMOTE_BACKLIGHT_ON:
|
case REMOTE_BACKLIGHT_ON:
|
||||||
remote_backlight_timer =
|
remote_backlight_timer =
|
||||||
HZ*backlight_timeout_value[backlight_timeout];
|
HZ*backlight_timeout_value[remote_backlight_timeout];
|
||||||
|
|
||||||
/* Backlight == OFF in the setting? */
|
/* Backlight == OFF in the setting? */
|
||||||
if(remote_backlight_timer < 0)
|
if(remote_backlight_timer < 0)
|
||||||
|
@ -181,6 +182,15 @@ void remote_backlight_off(void)
|
||||||
{
|
{
|
||||||
queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, NULL);
|
queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void remote_backlight_set_timeout(int index)
|
||||||
|
{
|
||||||
|
if((unsigned)index >= sizeof(backlight_timeout_value))
|
||||||
|
/* if given a weird value, use 0 */
|
||||||
|
index=0;
|
||||||
|
remote_backlight_timeout = index; /* index in the backlight_timeout_value table */
|
||||||
|
remote_backlight_on();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int backlight_get_timeout(void)
|
int backlight_get_timeout(void)
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#ifndef BACKLIGHT_H
|
#ifndef BACKLIGHT_H
|
||||||
#define BACKLIGHT_H
|
#define BACKLIGHT_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
void backlight_init(void);
|
void backlight_init(void);
|
||||||
void backlight_on(void);
|
void backlight_on(void);
|
||||||
void backlight_off(void);
|
void backlight_off(void);
|
||||||
|
@ -31,4 +33,8 @@ void remote_backlight_on(void);
|
||||||
void remote_backlight_off(void);
|
void remote_backlight_off(void);
|
||||||
extern const char backlight_timeout_value[];
|
extern const char backlight_timeout_value[];
|
||||||
|
|
||||||
|
#ifdef HAVE_REMOTE_LCD
|
||||||
|
void remote_backlight_set_timeout(int index);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue