forked from len0rd/rockbox
Replaced the booolean 'Backlight On When Plugged' setting with a complete alternative 'Backlight When Plugged' timeout setting. * Yield during poweroff to make backlight_off() work. * Bumped config version, save your settings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8053 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
47569223eb
commit
a6d409d9db
9 changed files with 113 additions and 133 deletions
|
@ -680,9 +680,9 @@ voice: "Units Per Read"
|
||||||
new:
|
new:
|
||||||
|
|
||||||
id: LANG_BACKLIGHT_ON_WHEN_CHARGING
|
id: LANG_BACKLIGHT_ON_WHEN_CHARGING
|
||||||
desc: in display_settings_menu
|
desc: in display_settings_menu, backlight timeout with charger connected
|
||||||
eng: "Backlight On When Plugged"
|
eng: "Backlight When Plugged"
|
||||||
voice: "Backlight On When Plugged"
|
voice: "Backlight When Plugged"
|
||||||
new:
|
new:
|
||||||
|
|
||||||
id: LANG_REPEAT
|
id: LANG_REPEAT
|
||||||
|
|
|
@ -313,7 +313,7 @@ int charging_screen(void)
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
|
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
|
||||||
#endif
|
#endif
|
||||||
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
|
backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
gui_syncstatusbar_draw(&statusbars, true);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
|
|
|
@ -85,7 +85,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
|
||||||
#include "dsp.h"
|
#include "dsp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CONFIG_BLOCK_VERSION 32
|
#define CONFIG_BLOCK_VERSION 33
|
||||||
#define CONFIG_BLOCK_SIZE 512
|
#define CONFIG_BLOCK_SIZE 512
|
||||||
#define RTC_BLOCK_SIZE 44
|
#define RTC_BLOCK_SIZE 44
|
||||||
|
|
||||||
|
@ -179,6 +179,11 @@ static const char trig_durations_conf [] =
|
||||||
"0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min";
|
"0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_BACKLIGHT)
|
||||||
|
static const char backlight_times_conf [] =
|
||||||
|
"off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90";
|
||||||
|
#endif
|
||||||
|
|
||||||
/* the part of the settings which ends up in the RTC RAM, where available
|
/* the part of the settings which ends up in the RTC RAM, where available
|
||||||
(those we either need early, save frequently, or without spinup) */
|
(those we either need early, save frequently, or without spinup) */
|
||||||
static const struct bit_entry rtc_bits[] =
|
static const struct bit_entry rtc_bits[] =
|
||||||
|
@ -216,12 +221,11 @@ static const struct bit_entry rtc_bits[] =
|
||||||
/* LCD */
|
/* LCD */
|
||||||
{6, S_O(contrast), 40, "contrast", NULL },
|
{6, S_O(contrast), 40, "contrast", NULL },
|
||||||
#ifdef CONFIG_BACKLIGHT
|
#ifdef CONFIG_BACKLIGHT
|
||||||
|
{5, S_O(backlight_timeout), 5, "backlight timeout", backlight_times_conf },
|
||||||
#ifdef HAVE_CHARGING
|
#ifdef HAVE_CHARGING
|
||||||
{1, S_O(backlight_on_when_charging), false,
|
{5, S_O(backlight_timeout_plugged), 11, "backlight timeout plugged",
|
||||||
"backlight when plugged", off_on },
|
backlight_times_conf },
|
||||||
#endif
|
#endif
|
||||||
{5, S_O(backlight_timeout), 5, "backlight timeout",
|
|
||||||
"off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90" },
|
|
||||||
#endif /* CONFIG_BACKLIGHT */
|
#endif /* CONFIG_BACKLIGHT */
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
{1, S_O(invert), false, "invert", off_on },
|
{1, S_O(invert), false, "invert", off_on },
|
||||||
|
@ -236,6 +240,7 @@ static const struct bit_entry rtc_bits[] =
|
||||||
{1, S_O(volume_type), 0, "volume display", graphic_numeric },
|
{1, S_O(volume_type), 0, "volume display", graphic_numeric },
|
||||||
{1, S_O(battery_display), 0, "battery display", graphic_numeric },
|
{1, S_O(battery_display), 0, "battery display", graphic_numeric },
|
||||||
{1, S_O(timeformat), 0, "time format", "24hour,12hour" },
|
{1, S_O(timeformat), 0, "time format", "24hour,12hour" },
|
||||||
|
{1, S_O(bidi_support), false, "bidi hebrew/arabic", off_on },
|
||||||
#endif /* HAVE_LCD_BITMAP */
|
#endif /* HAVE_LCD_BITMAP */
|
||||||
{1, S_O(show_icons), true, "show icons", off_on },
|
{1, S_O(show_icons), true, "show icons", off_on },
|
||||||
/* system */
|
/* system */
|
||||||
|
@ -268,23 +273,16 @@ static const struct bit_entry rtc_bits[] =
|
||||||
/* 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" },
|
|
||||||
{1, S_O(remote_flip_display), false, "remote flip display", off_on },
|
{1, S_O(remote_flip_display), false, "remote flip display", off_on },
|
||||||
|
{5, S_O(remote_backlight_timeout), 5, "remote backlight timeout",
|
||||||
|
backlight_times_conf },
|
||||||
|
#ifdef HAVE_CHARGING
|
||||||
|
{5, S_O(remote_backlight_timeout_plugged), 11,
|
||||||
|
"remote backlight timeout plugged", backlight_times_conf },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP /* move to LCD next time we bump version */
|
|
||||||
{1, S_O(bidi_support), false, "bidi hebrew/arabic", off_on },
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_REMOTE_LCD /* move to REMOTE_LCD next time we bump version */
|
|
||||||
#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
|
||||||
#ifdef HAVE_CHARGING
|
|
||||||
{1, S_O(remote_backlight_on_when_charging), false,
|
|
||||||
"remote backlight when plugged", off_on },
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* new stuff to be added here */
|
/* new stuff to be added here */
|
||||||
|
@ -871,11 +869,14 @@ void settings_apply(void)
|
||||||
lcd_remote_emireduce(global_settings.remote_reduce_ticking);
|
lcd_remote_emireduce(global_settings.remote_reduce_ticking);
|
||||||
#endif
|
#endif
|
||||||
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
|
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
|
||||||
|
#ifdef HAVE_CHARGING
|
||||||
|
remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_BACKLIGHT
|
#ifdef CONFIG_BACKLIGHT
|
||||||
backlight_set_timeout(global_settings.backlight_timeout);
|
backlight_set_timeout(global_settings.backlight_timeout);
|
||||||
#ifdef HAVE_CHARGING
|
#ifdef HAVE_CHARGING
|
||||||
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
|
backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
|
||||||
#endif
|
#endif
|
||||||
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
|
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
|
||||||
backlight_set_fade_in(global_settings.backlight_fade_in);
|
backlight_set_fade_in(global_settings.backlight_fade_in);
|
||||||
|
|
|
@ -221,7 +221,7 @@ struct user_settings
|
||||||
int backlight_timeout; /* backlight off timeout: 0-18 0=never,
|
int backlight_timeout; /* backlight off timeout: 0-18 0=never,
|
||||||
1=always,
|
1=always,
|
||||||
then according to timeout_values[] */
|
then according to timeout_values[] */
|
||||||
bool backlight_on_when_charging;
|
int backlight_timeout_plugged;
|
||||||
#if CONFIG_BACKLIGHT == BL_IRIVER_H100
|
#if CONFIG_BACKLIGHT == BL_IRIVER_H100
|
||||||
int backlight_fade_in; /* backlight fade in timing: 0..3 */
|
int backlight_fade_in; /* backlight fade in timing: 0..3 */
|
||||||
int backlight_fade_out; /* backlight fade in timing: 0..7 */
|
int backlight_fade_out; /* backlight fade in timing: 0..7 */
|
||||||
|
@ -343,7 +343,7 @@ struct user_settings
|
||||||
int remote_backlight_timeout; /* backlight off timeout: 0-18 0=never,
|
int remote_backlight_timeout; /* backlight off timeout: 0-18 0=never,
|
||||||
1=always,
|
1=always,
|
||||||
then according to timeout_values[] */
|
then according to timeout_values[] */
|
||||||
bool remote_backlight_on_when_charging;
|
int remote_backlight_timeout_plugged;
|
||||||
bool remote_caption_backlight; /* turn on backlight at end and start of track */
|
bool remote_caption_backlight; /* turn on backlight at end and start of track */
|
||||||
#ifdef HAVE_REMOTE_LCD_TICKING
|
#ifdef HAVE_REMOTE_LCD_TICKING
|
||||||
bool remote_reduce_ticking; /* 0=normal operation,
|
bool remote_reduce_ticking; /* 0=normal operation,
|
||||||
|
|
|
@ -135,25 +135,7 @@ static bool remote_reduce_ticking(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_BACKLIGHT
|
#ifdef CONFIG_BACKLIGHT
|
||||||
static bool caption_backlight(void)
|
static const struct opt_items backlight_timeouts[] = {
|
||||||
{
|
|
||||||
return set_bool( str(LANG_CAPTION_BACKLIGHT),
|
|
||||||
&global_settings.caption_backlight);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_CHARGING
|
|
||||||
static bool backlight_on_when_charging(void)
|
|
||||||
{
|
|
||||||
bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
|
|
||||||
&global_settings.backlight_on_when_charging);
|
|
||||||
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static bool backlight_timer(void)
|
|
||||||
{
|
|
||||||
static const struct opt_items names[] = {
|
|
||||||
{ STR(LANG_OFF) },
|
{ STR(LANG_OFF) },
|
||||||
{ STR(LANG_ON) },
|
{ STR(LANG_ON) },
|
||||||
{ "1s ", TALK_ID(1, UNIT_SEC) },
|
{ "1s ", TALK_ID(1, UNIT_SEC) },
|
||||||
|
@ -174,8 +156,29 @@ static bool backlight_timer(void)
|
||||||
{ "60s", TALK_ID(60, UNIT_SEC) },
|
{ "60s", TALK_ID(60, UNIT_SEC) },
|
||||||
{ "90s", TALK_ID(90, UNIT_SEC) }
|
{ "90s", TALK_ID(90, UNIT_SEC) }
|
||||||
};
|
};
|
||||||
return set_option(str(LANG_BACKLIGHT), &global_settings.backlight_timeout,
|
|
||||||
INT, names, 19, backlight_set_timeout );
|
static bool caption_backlight(void)
|
||||||
|
{
|
||||||
|
return set_bool( str(LANG_CAPTION_BACKLIGHT),
|
||||||
|
&global_settings.caption_backlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_CHARGING
|
||||||
|
static bool backlight_timer_plugged(void)
|
||||||
|
{
|
||||||
|
return set_option(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
|
||||||
|
&global_settings.backlight_timeout_plugged,
|
||||||
|
INT, backlight_timeouts, 19,
|
||||||
|
backlight_set_timeout_plugged );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static bool backlight_timer(void)
|
||||||
|
{
|
||||||
|
return set_option(str(LANG_BACKLIGHT),
|
||||||
|
&global_settings.backlight_timeout,
|
||||||
|
INT, backlight_timeouts, 19,
|
||||||
|
backlight_set_timeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
|
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
|
||||||
|
@ -215,39 +218,19 @@ static bool backlight_fade_out(void)
|
||||||
|
|
||||||
static bool remote_backlight_timer(void)
|
static bool remote_backlight_timer(void)
|
||||||
{
|
{
|
||||||
static const struct opt_items names[] = {
|
return set_option(str(LANG_BACKLIGHT),
|
||||||
{ STR(LANG_OFF) },
|
&global_settings.remote_backlight_timeout,
|
||||||
{ STR(LANG_ON) },
|
INT, backlight_timeouts, 19,
|
||||||
{ "1s ", TALK_ID(1, UNIT_SEC) },
|
remote_backlight_set_timeout );
|
||||||
{ "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, remote_backlight_set_timeout );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CHARGING
|
#ifdef HAVE_CHARGING
|
||||||
static bool remote_backlight_on_when_charging(void)
|
static bool remote_backlight_timer_plugged(void)
|
||||||
{
|
{
|
||||||
bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
|
return set_option(str(LANG_BACKLIGHT_ON_WHEN_CHARGING),
|
||||||
&global_settings.remote_backlight_on_when_charging);
|
&global_settings.remote_backlight_timeout_plugged,
|
||||||
remote_backlight_set_on_when_charging(
|
INT, backlight_timeouts, 19,
|
||||||
global_settings.remote_backlight_on_when_charging);
|
remote_backlight_set_timeout_plugged );
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1532,7 +1515,7 @@ static bool lcd_settings_menu(void)
|
||||||
#ifdef CONFIG_BACKLIGHT
|
#ifdef CONFIG_BACKLIGHT
|
||||||
{ ID2P(LANG_BACKLIGHT), backlight_timer },
|
{ ID2P(LANG_BACKLIGHT), backlight_timer },
|
||||||
#ifdef HAVE_CHARGING
|
#ifdef HAVE_CHARGING
|
||||||
{ ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging },
|
{ ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_timer_plugged },
|
||||||
#endif
|
#endif
|
||||||
{ ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight },
|
{ ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight },
|
||||||
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
|
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
|
||||||
|
@ -1565,7 +1548,7 @@ static bool lcd_remote_settings_menu(void)
|
||||||
{ ID2P(LANG_BACKLIGHT), remote_backlight_timer },
|
{ ID2P(LANG_BACKLIGHT), remote_backlight_timer },
|
||||||
#ifdef HAVE_CHARGING
|
#ifdef HAVE_CHARGING
|
||||||
{ ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING),
|
{ ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING),
|
||||||
remote_backlight_on_when_charging },
|
remote_backlight_timer_plugged },
|
||||||
#endif
|
#endif
|
||||||
{ ID2P(LANG_CAPTION_BACKLIGHT), remote_caption_backlight },
|
{ ID2P(LANG_CAPTION_BACKLIGHT), remote_caption_backlight },
|
||||||
{ ID2P(LANG_CONTRAST), remote_contrast },
|
{ ID2P(LANG_CONTRAST), remote_contrast },
|
||||||
|
|
|
@ -52,14 +52,18 @@ static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)];
|
||||||
static const char backlight_thread_name[] = "backlight";
|
static const char backlight_thread_name[] = "backlight";
|
||||||
static struct event_queue backlight_queue;
|
static struct event_queue backlight_queue;
|
||||||
|
|
||||||
static bool backlight_on_when_charging = false;
|
|
||||||
static int backlight_timer;
|
static int backlight_timer;
|
||||||
static unsigned int backlight_timeout = 5;
|
static int backlight_timeout = 5*HZ;
|
||||||
|
#ifdef HAVE_CHARGING
|
||||||
|
static int backlight_timeout_plugged = 5*HZ;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
static bool remote_backlight_on_when_charging = false;
|
|
||||||
static int remote_backlight_timer;
|
static int remote_backlight_timer;
|
||||||
static unsigned int remote_backlight_timeout = 5;
|
static int remote_backlight_timeout = 5*HZ;
|
||||||
|
#ifdef HAVE_CHARGING
|
||||||
|
static int remote_backlight_timeout_plugged = 5*HZ;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
|
#if (CONFIG_BACKLIGHT == BL_IRIVER_H100) && !defined(SIMULATOR)
|
||||||
|
@ -304,16 +308,12 @@ void backlight_thread(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
case REMOTE_BACKLIGHT_ON:
|
case REMOTE_BACKLIGHT_ON:
|
||||||
if( remote_backlight_on_when_charging && charger_inserted() )
|
#ifdef HAVE_CHARGING
|
||||||
{
|
if (charger_inserted())
|
||||||
/* Forcing to zero keeps the lights on */
|
remote_backlight_timer = remote_backlight_timeout_plugged;
|
||||||
remote_backlight_timer = 0;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
#endif
|
||||||
remote_backlight_timer =
|
remote_backlight_timer = remote_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)
|
||||||
|
@ -333,15 +333,12 @@ void backlight_thread(void)
|
||||||
|
|
||||||
#endif /* HAVE_REMOTE_LCD */
|
#endif /* HAVE_REMOTE_LCD */
|
||||||
case BACKLIGHT_ON:
|
case BACKLIGHT_ON:
|
||||||
if( backlight_on_when_charging && charger_inserted() )
|
#ifdef HAVE_CHARGING
|
||||||
{
|
if (charger_inserted())
|
||||||
/* Forcing to zero keeps the lights on */
|
backlight_timer = backlight_timeout_plugged;
|
||||||
backlight_timer = 0;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
#endif
|
||||||
backlight_timer = HZ*backlight_timeout_value[backlight_timeout];
|
backlight_timer = backlight_timeout;
|
||||||
}
|
|
||||||
|
|
||||||
if (backlight_timer < 0) /* Backlight == OFF in the setting? */
|
if (backlight_timer < 0) /* Backlight == OFF in the setting? */
|
||||||
{
|
{
|
||||||
|
@ -385,10 +382,8 @@ static void backlight_tick(void)
|
||||||
|
|
||||||
if( charger_was_inserted != charger_is_inserted )
|
if( charger_was_inserted != charger_is_inserted )
|
||||||
{
|
{
|
||||||
if( backlight_on_when_charging )
|
|
||||||
backlight_on();
|
backlight_on();
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
if( remote_backlight_on_when_charging )
|
|
||||||
remote_backlight_on();
|
remote_backlight_on();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -453,9 +448,14 @@ void backlight_off(void)
|
||||||
queue_post(&backlight_queue, BACKLIGHT_OFF, NULL);
|
queue_post(&backlight_queue, BACKLIGHT_OFF, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int backlight_get_timeout(void)
|
/* return value in ticks; 0 means always on, <0 means always off */
|
||||||
|
int backlight_get_current_timeout(void)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_CHARGING
|
||||||
|
return charger_inserted() ? backlight_timeout_plugged : backlight_timeout;
|
||||||
|
#else
|
||||||
return backlight_timeout;
|
return backlight_timeout;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set_timeout(int index)
|
void backlight_set_timeout(int index)
|
||||||
|
@ -463,19 +463,17 @@ void backlight_set_timeout(int index)
|
||||||
if((unsigned)index >= sizeof(backlight_timeout_value))
|
if((unsigned)index >= sizeof(backlight_timeout_value))
|
||||||
/* if given a weird value, use 0 */
|
/* if given a weird value, use 0 */
|
||||||
index=0;
|
index=0;
|
||||||
backlight_timeout = index; /* index in the backlight_timeout_value table */
|
backlight_timeout = HZ * backlight_timeout_value[index];
|
||||||
backlight_on();
|
backlight_on();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CHARGING
|
#ifdef HAVE_CHARGING
|
||||||
bool backlight_get_on_when_charging(void)
|
void backlight_set_timeout_plugged(int index)
|
||||||
{
|
{
|
||||||
return backlight_on_when_charging;
|
if((unsigned)index >= sizeof(backlight_timeout_value))
|
||||||
}
|
/* if given a weird value, use 0 */
|
||||||
|
index=0;
|
||||||
void backlight_set_on_when_charging(bool yesno)
|
backlight_timeout_plugged = HZ * backlight_timeout_value[index];
|
||||||
{
|
|
||||||
backlight_on_when_charging = yesno;
|
|
||||||
backlight_on();
|
backlight_on();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -496,14 +494,17 @@ void remote_backlight_set_timeout(int index)
|
||||||
if((unsigned)index >= sizeof(backlight_timeout_value))
|
if((unsigned)index >= sizeof(backlight_timeout_value))
|
||||||
/* if given a weird value, use 0 */
|
/* if given a weird value, use 0 */
|
||||||
index=0;
|
index=0;
|
||||||
remote_backlight_timeout = index; /* index in the backlight_timeout_value table */
|
remote_backlight_timeout = HZ * backlight_timeout_value[index];
|
||||||
remote_backlight_on();
|
remote_backlight_on();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CHARGING
|
#ifdef HAVE_CHARGING
|
||||||
void remote_backlight_set_on_when_charging(bool yesno)
|
void remote_backlight_set_timeout_plugged(int index)
|
||||||
{
|
{
|
||||||
remote_backlight_on_when_charging = yesno;
|
if((unsigned)index >= sizeof(backlight_timeout_value))
|
||||||
|
/* if given a weird value, use 0 */
|
||||||
|
index=0;
|
||||||
|
remote_backlight_timeout_plugged = HZ * backlight_timeout_value[index];
|
||||||
remote_backlight_on();
|
remote_backlight_on();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -280,7 +280,8 @@ void power_off(void)
|
||||||
or_b(0x08, &PAIORH);
|
or_b(0x08, &PAIORH);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
while(1);
|
while(1)
|
||||||
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -26,13 +26,12 @@ void backlight_off(void);
|
||||||
void backlight_set_timeout(int index);
|
void backlight_set_timeout(int index);
|
||||||
#ifdef CONFIG_BACKLIGHT
|
#ifdef CONFIG_BACKLIGHT
|
||||||
void backlight_init(void);
|
void backlight_init(void);
|
||||||
int backlight_get_timeout(void);
|
int backlight_get_current_timeout(void);
|
||||||
#if CONFIG_BACKLIGHT == BL_IRIVER_H100
|
#if CONFIG_BACKLIGHT == BL_IRIVER_H100
|
||||||
void backlight_set_fade_in(int index);
|
void backlight_set_fade_in(int index);
|
||||||
void backlight_set_fade_out(int index);
|
void backlight_set_fade_out(int index);
|
||||||
#endif
|
#endif
|
||||||
bool backlight_get_on_when_charging(void);
|
void backlight_set_timeout_plugged(int index);
|
||||||
void backlight_set_on_when_charging(bool yesno);
|
|
||||||
extern const char backlight_timeout_value[];
|
extern const char backlight_timeout_value[];
|
||||||
#else
|
#else
|
||||||
#define backlight_init()
|
#define backlight_init()
|
||||||
|
@ -42,7 +41,7 @@ extern const char backlight_timeout_value[];
|
||||||
void remote_backlight_on(void);
|
void remote_backlight_on(void);
|
||||||
void remote_backlight_off(void);
|
void remote_backlight_off(void);
|
||||||
void remote_backlight_set_timeout(int index);
|
void remote_backlight_set_timeout(int index);
|
||||||
void remote_backlight_set_on_when_charging(bool yesno);
|
void remote_backlight_set_timeout_plugged(int index);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
|
|
|
@ -449,13 +449,8 @@ static int runcurrent(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BACKLIGHT) && !defined(BOOTLOADER)
|
#if defined(CONFIG_BACKLIGHT) && !defined(BOOTLOADER)
|
||||||
if ((backlight_get_timeout() == 1) /* LED always on */
|
if (backlight_get_current_timeout() == 0) /* LED always on */
|
||||||
#ifdef HAVE_CHARGE_CTRL
|
|
||||||
|| (charger_inserted() && backlight_get_on_when_charging())
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
current += CURRENT_BACKLIGHT;
|
current += CURRENT_BACKLIGHT;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(current);
|
return(current);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue