diff options
-rw-r--r-- | apps/lang/english.lang | 6 | ||||
-rw-r--r-- | apps/settings.c | 12 | ||||
-rw-r--r-- | apps/settings.h | 4 | ||||
-rw-r--r-- | apps/settings_menu.c | 10 | ||||
-rw-r--r-- | firmware/backlight.c | 8 | ||||
-rw-r--r-- | firmware/drivers/button.c | 18 | ||||
-rw-r--r-- | firmware/export/backlight.h | 1 | ||||
-rw-r--r-- | firmware/export/button.h | 3 | ||||
-rw-r--r-- | uisimulator/sdl/button.c | 14 |
9 files changed, 74 insertions, 2 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 057282f81a..65e45cff5c 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -3832,3 +3832,9 @@ desc: "pitch" in the pitch screen | |||
3832 | eng: "Pitch" | 3832 | eng: "Pitch" |
3833 | voice: "Pitch" | 3833 | voice: "Pitch" |
3834 | new: | 3834 | new: |
3835 | |||
3836 | id: LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS | ||
3837 | desc: Backlight behaviour setting | ||
3838 | eng: "First keypress enables backlight only" | ||
3839 | voice: "First keypress enables backlight only" | ||
3840 | new: | ||
diff --git a/apps/settings.c b/apps/settings.c index f5c0ba7c2d..4487361e8d 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -296,6 +296,14 @@ static const struct bit_entry rtc_bits[] = | |||
296 | #endif | 296 | #endif |
297 | #endif | 297 | #endif |
298 | 298 | ||
299 | #ifdef CONFIG_BACKLIGHT | ||
300 | #ifdef HAVE_LCD_COLOR | ||
301 | {1, S_O(bl_filter_first_keypress), true, "backlight filters first keypress", off_on }, | ||
302 | #else | ||
303 | {1, S_O(bl_filter_first_keypress), false, "backlight filters first keypress", off_on }, | ||
304 | #endif | ||
305 | #endif | ||
306 | |||
299 | /* new stuff to be added here */ | 307 | /* new stuff to be added here */ |
300 | /* If values are just added to the end, no need to bump the version. */ | 308 | /* If values are just added to the end, no need to bump the version. */ |
301 | 309 | ||
@@ -1115,6 +1123,10 @@ void settings_apply(void) | |||
1115 | #ifdef HAVE_SPDIF_POWER | 1123 | #ifdef HAVE_SPDIF_POWER |
1116 | spdif_power_enable(global_settings.spdif_enable); | 1124 | spdif_power_enable(global_settings.spdif_enable); |
1117 | #endif | 1125 | #endif |
1126 | |||
1127 | #ifdef CONFIG_BACKLIGHT | ||
1128 | set_backlight_filter_keypress(global_settings.bl_filter_first_keypress); | ||
1129 | #endif | ||
1118 | } | 1130 | } |
1119 | 1131 | ||
1120 | 1132 | ||
diff --git a/apps/settings.h b/apps/settings.h index 52e949ea9e..2fd52aea9e 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -472,6 +472,10 @@ struct user_settings | |||
472 | int fg_color; /* foreground color native format */ | 472 | int fg_color; /* foreground color native format */ |
473 | #endif | 473 | #endif |
474 | bool party_mode; /* party mode - unstoppable music */ | 474 | bool party_mode; /* party mode - unstoppable music */ |
475 | |||
476 | #ifdef CONFIG_BACKLIGHT | ||
477 | bool bl_filter_first_keypress; /* filter first keypress when dark? */ | ||
478 | #endif | ||
475 | }; | 479 | }; |
476 | 480 | ||
477 | enum optiontype { INT, BOOL }; | 481 | enum optiontype { INT, BOOL }; |
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 6e8d62191f..70703a23ce 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -1046,6 +1046,15 @@ static bool set_party_mode(void) | |||
1046 | return set_bool( str(LANG_PARTY_MODE), &global_settings.party_mode ); | 1046 | return set_bool( str(LANG_PARTY_MODE), &global_settings.party_mode ); |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | #ifdef CONFIG_BACKLIGHT | ||
1050 | static bool set_bl_filter_first_keypress(void) | ||
1051 | { | ||
1052 | bool result = set_bool( str(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), | ||
1053 | &global_settings.bl_filter_first_keypress ); | ||
1054 | set_backlight_filter_keypress(global_settings.bl_filter_first_keypress); | ||
1055 | return result; | ||
1056 | } | ||
1057 | #endif | ||
1049 | 1058 | ||
1050 | static bool ff_rewind_accel(void) | 1059 | static bool ff_rewind_accel(void) |
1051 | { | 1060 | { |
@@ -1621,6 +1630,7 @@ static bool lcd_settings_menu(void) | |||
1621 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | 1630 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
1622 | { ID2P(LANG_BRIGHTNESS), brightness }, | 1631 | { ID2P(LANG_BRIGHTNESS), brightness }, |
1623 | #endif | 1632 | #endif |
1633 | { ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_bl_filter_first_keypress }, | ||
1624 | #endif /* CONFIG_BACKLIGHT */ | 1634 | #endif /* CONFIG_BACKLIGHT */ |
1625 | { ID2P(LANG_CONTRAST), contrast }, | 1635 | { ID2P(LANG_CONTRAST), contrast }, |
1626 | #ifdef HAVE_LCD_BITMAP | 1636 | #ifdef HAVE_LCD_BITMAP |
diff --git a/firmware/backlight.c b/firmware/backlight.c index 66aa2d7c6c..a04000a426 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c | |||
@@ -522,6 +522,14 @@ void backlight_off(void) | |||
522 | queue_post(&backlight_queue, BACKLIGHT_OFF, NULL); | 522 | queue_post(&backlight_queue, BACKLIGHT_OFF, NULL); |
523 | } | 523 | } |
524 | 524 | ||
525 | bool is_backlight_on(void) | ||
526 | { | ||
527 | if (backlight_timer || !backlight_get_current_timeout()) | ||
528 | return true; | ||
529 | else | ||
530 | return false; | ||
531 | } | ||
532 | |||
525 | /* return value in ticks; 0 means always on, <0 means always off */ | 533 | /* return value in ticks; 0 means always on, <0 means always off */ |
526 | int backlight_get_current_timeout(void) | 534 | int backlight_get_current_timeout(void) |
527 | { | 535 | { |
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index dbdb171bf2..9e649ead5a 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -52,6 +52,9 @@ static long last_read; /* Last button status, for debouncing/filtering */ | |||
52 | #ifdef HAVE_LCD_BITMAP | 52 | #ifdef HAVE_LCD_BITMAP |
53 | static bool flipped; /* buttons can be flipped to match the LCD flip */ | 53 | static bool flipped; /* buttons can be flipped to match the LCD flip */ |
54 | #endif | 54 | #endif |
55 | #ifdef CONFIG_BACKLIGHT | ||
56 | static bool filter_first_keypress; | ||
57 | #endif | ||
55 | 58 | ||
56 | /* how often we check to see if a button is pressed */ | 59 | /* how often we check to see if a button is pressed */ |
57 | #define POLL_FREQUENCY HZ/100 | 60 | #define POLL_FREQUENCY HZ/100 |
@@ -504,7 +507,10 @@ static void button_tick(void) | |||
504 | } | 507 | } |
505 | else | 508 | else |
506 | { | 509 | { |
507 | queue_post(&button_queue, btn, NULL); | 510 | #ifdef CONFIG_BACKLIGHT |
511 | if ( !filter_first_keypress || is_backlight_on()) | ||
512 | #endif | ||
513 | queue_post(&button_queue, btn, NULL); | ||
508 | post = false; | 514 | post = false; |
509 | } | 515 | } |
510 | #ifdef HAVE_REMOTE_LCD | 516 | #ifdef HAVE_REMOTE_LCD |
@@ -629,6 +635,9 @@ void button_init(void) | |||
629 | #ifdef HAVE_LCD_BITMAP | 635 | #ifdef HAVE_LCD_BITMAP |
630 | flipped = false; | 636 | flipped = false; |
631 | #endif | 637 | #endif |
638 | #ifdef CONFIG_BACKLIGHT | ||
639 | filter_first_keypress = false; | ||
640 | #endif | ||
632 | } | 641 | } |
633 | 642 | ||
634 | #ifdef HAVE_LCD_BITMAP /* only bitmap displays can be flipped */ | 643 | #ifdef HAVE_LCD_BITMAP /* only bitmap displays can be flipped */ |
@@ -687,6 +696,13 @@ void button_set_flip(bool flip) | |||
687 | } | 696 | } |
688 | #endif /* HAVE_LCD_BITMAP */ | 697 | #endif /* HAVE_LCD_BITMAP */ |
689 | 698 | ||
699 | #ifdef CONFIG_BACKLIGHT | ||
700 | void set_backlight_filter_keypress(bool value) | ||
701 | { | ||
702 | filter_first_keypress = value; | ||
703 | } | ||
704 | #endif | ||
705 | |||
690 | /* | 706 | /* |
691 | Archos hardware button hookup | 707 | Archos hardware button hookup |
692 | ============================= | 708 | ============================= |
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h index e182803898..f371dc1423 100644 --- a/firmware/export/backlight.h +++ b/firmware/export/backlight.h | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include "config.h" | 22 | #include "config.h" |
23 | 23 | ||
24 | bool is_backlight_on(void); | ||
24 | void backlight_on(void); | 25 | void backlight_on(void); |
25 | void backlight_off(void); | 26 | void backlight_off(void); |
26 | void backlight_set_timeout(int index); | 27 | void backlight_set_timeout(int index); |
diff --git a/firmware/export/button.h b/firmware/export/button.h index 02d91d6a9b..a142540511 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h | |||
@@ -42,6 +42,9 @@ void button_clear_queue(void); | |||
42 | #ifdef HAVE_LCD_BITMAP | 42 | #ifdef HAVE_LCD_BITMAP |
43 | void button_set_flip(bool flip); /* turn 180 degrees */ | 43 | void button_set_flip(bool flip); /* turn 180 degrees */ |
44 | #endif | 44 | #endif |
45 | #ifdef CONFIG_BACKLIGHT | ||
46 | void set_backlight_filter_keypress(bool value); | ||
47 | #endif | ||
45 | 48 | ||
46 | #ifdef HAS_BUTTON_HOLD | 49 | #ifdef HAS_BUTTON_HOLD |
47 | bool button_hold(void); | 50 | bool button_hold(void); |
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c index 00a329924e..bf0396e18d 100644 --- a/uisimulator/sdl/button.c +++ b/uisimulator/sdl/button.c | |||
@@ -37,6 +37,15 @@ struct event_queue button_queue; | |||
37 | 37 | ||
38 | static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ | 38 | static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ |
39 | 39 | ||
40 | #ifdef CONFIG_BACKLIGHT | ||
41 | static bool filter_first_keypress; | ||
42 | |||
43 | void set_backlight_filter_keypress(bool value) | ||
44 | { | ||
45 | filter_first_keypress = value; | ||
46 | } | ||
47 | #endif | ||
48 | |||
40 | void button_event(int key, bool pressed) | 49 | void button_event(int key, bool pressed) |
41 | { | 50 | { |
42 | int new_btn = 0; | 51 | int new_btn = 0; |
@@ -219,7 +228,10 @@ void button_event(int key, bool pressed) | |||
219 | } | 228 | } |
220 | else | 229 | else |
221 | { | 230 | { |
222 | queue_post(&button_queue, btn, NULL); | 231 | #ifdef CONFIG_BACKLIGHT |
232 | if ( !filter_first_keypress || is_backlight_on()) | ||
233 | #endif | ||
234 | queue_post(&button_queue, btn, NULL); | ||
223 | post = false; | 235 | post = false; |
224 | } | 236 | } |
225 | 237 | ||