summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHristo Kovachev <bger@rockbox.org>2006-03-25 19:16:45 +0000
committerHristo Kovachev <bger@rockbox.org>2006-03-25 19:16:45 +0000
commita70c6b9b1e2bcf7a5a207017d6c40f5254f6ef98 (patch)
treee39563c6b848d65c0700875676c01da43d3f645b
parent7b9ab84e7d37a761a7b4a5817c6da71213cc17ad (diff)
downloadrockbox-a70c6b9b1e2bcf7a5a207017d6c40f5254f6ef98.tar.gz
rockbox-a70c6b9b1e2bcf7a5a207017d6c40f5254f6ef98.zip
Patch #4913 by David Rothenberger with some changes by me: add only backlight on first keypress to the lcd remotes, too.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9253 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/settings.c14
-rw-r--r--apps/settings.h3
-rw-r--r--apps/settings_menu.c10
-rw-r--r--docs/CREDITS3
-rw-r--r--firmware/backlight.c27
-rw-r--r--firmware/drivers/button.c69
-rw-r--r--firmware/export/backlight.h1
-rw-r--r--firmware/export/button.h3
-rw-r--r--uisimulator/sdl/button.c60
9 files changed, 180 insertions, 10 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 4487361e8d..8c4e3dea71 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -297,11 +297,18 @@ static const struct bit_entry rtc_bits[] =
297#endif 297#endif
298 298
299#ifdef CONFIG_BACKLIGHT 299#ifdef CONFIG_BACKLIGHT
300 {1, S_O(bl_filter_first_keypress),
300#ifdef HAVE_LCD_COLOR 301#ifdef HAVE_LCD_COLOR
301 {1, S_O(bl_filter_first_keypress), true, "backlight filters first keypress", off_on }, 302 true,
302#else 303#else
303 {1, S_O(bl_filter_first_keypress), false, "backlight filters first keypress", off_on }, 304 false,
304#endif 305#endif
306 "backlight filters first keypress", off_on },
307#ifdef HAVE_REMOTE_LCD
308 {1, S_O(remote_bl_filter_first_keypress), false,
309 "backlight filters first remote keypress", off_on },
310#endif
311
305#endif 312#endif
306 313
307 /* new stuff to be added here */ 314 /* new stuff to be added here */
@@ -1126,6 +1133,9 @@ void settings_apply(void)
1126 1133
1127#ifdef CONFIG_BACKLIGHT 1134#ifdef CONFIG_BACKLIGHT
1128 set_backlight_filter_keypress(global_settings.bl_filter_first_keypress); 1135 set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
1136#ifdef HAVE_REMOTE_LCD
1137 set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
1138#endif
1129#endif 1139#endif
1130} 1140}
1131 1141
diff --git a/apps/settings.h b/apps/settings.h
index 2fd52aea9e..424341f340 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -475,6 +475,9 @@ struct user_settings
475 475
476#ifdef CONFIG_BACKLIGHT 476#ifdef CONFIG_BACKLIGHT
477 bool bl_filter_first_keypress; /* filter first keypress when dark? */ 477 bool bl_filter_first_keypress; /* filter first keypress when dark? */
478#ifdef HAVE_REMOTE_LCD
479 bool remote_bl_filter_first_keypress; /* filter first remote keypress when remote dark? */
480#endif
478#endif 481#endif
479}; 482};
480 483
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index e5aa7f44d7..ab0e21d098 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -1082,6 +1082,15 @@ static bool set_bl_filter_first_keypress(void)
1082 set_backlight_filter_keypress(global_settings.bl_filter_first_keypress); 1082 set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
1083 return result; 1083 return result;
1084} 1084}
1085#ifdef HAVE_REMOTE_LCD
1086static bool set_remote_bl_filter_first_keypress(void)
1087{
1088 bool result = set_bool( str(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS),
1089 &global_settings.remote_bl_filter_first_keypress );
1090 set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
1091 return result;
1092}
1093#endif
1085#endif 1094#endif
1086 1095
1087static bool ff_rewind_accel(void) 1096static bool ff_rewind_accel(void)
@@ -1694,6 +1703,7 @@ static bool lcd_remote_settings_menu(void)
1694 remote_backlight_timer_plugged }, 1703 remote_backlight_timer_plugged },
1695#endif 1704#endif
1696 { ID2P(LANG_CAPTION_BACKLIGHT), remote_caption_backlight }, 1705 { ID2P(LANG_CAPTION_BACKLIGHT), remote_caption_backlight },
1706 { ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_remote_bl_filter_first_keypress },
1697 { ID2P(LANG_CONTRAST), remote_contrast }, 1707 { ID2P(LANG_CONTRAST), remote_contrast },
1698 { ID2P(LANG_INVERT), remote_invert }, 1708 { ID2P(LANG_INVERT), remote_invert },
1699 { ID2P(LANG_FLIP_DISPLAY), remote_flip_display }, 1709 { ID2P(LANG_FLIP_DISPLAY), remote_flip_display },
diff --git a/docs/CREDITS b/docs/CREDITS
index 4b3646ebf8..8cd0603762 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -186,4 +186,5 @@ Eli Sherer
186Fredrik Öhrn 186Fredrik Öhrn
187Nicolas Pennequin 187Nicolas Pennequin
188Ralf Herz 188Ralf Herz
189Michael DiFebbo \ No newline at end of file 189Michael DiFebbo
190David Rothenberger
diff --git a/firmware/backlight.c b/firmware/backlight.c
index a205511157..1d9e4b54c4 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -597,6 +597,32 @@ void remote_backlight_set_timeout_plugged(int index)
597 remote_backlight_on(); 597 remote_backlight_on();
598} 598}
599#endif 599#endif
600
601/* return value in ticks; 0 means always on, <0 means always off */
602int remote_backlight_get_current_timeout(void)
603{
604#ifdef HAVE_CHARGING
605 if (charger_inserted()
606#ifdef HAVE_USB_POWER
607 || usb_powered()
608#endif
609 )
610 return remote_backlight_timeout_plugged;
611 else
612 return remote_backlight_timeout;
613#else
614 return remote_backlight_timeout;
615#endif
616}
617
618bool is_remote_backlight_on(void)
619{
620 if (remote_backlight_timer != 0 || !remote_backlight_get_current_timeout())
621 return true;
622 else
623 return false;
624}
625
600#endif /* HAVE_REMOTE_LCD */ 626#endif /* HAVE_REMOTE_LCD */
601 627
602#else /* no backlight, empty dummy functions */ 628#else /* no backlight, empty dummy functions */
@@ -620,6 +646,7 @@ bool is_backlight_on(void) {return true;}
620void remote_backlight_on(void) {} 646void remote_backlight_on(void) {}
621void remote_backlight_off(void) {} 647void remote_backlight_off(void) {}
622void remote_backlight_set_timeout(int index) {(void)index;} 648void remote_backlight_set_timeout(int index) {(void)index;}
649bool is_remote_backlight_on(void) {return true;}
623#endif 650#endif
624#endif /* #ifdef CONFIG_BACKLIGHT */ 651#endif /* #ifdef CONFIG_BACKLIGHT */
625 652
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 9e649ead5a..6855feb1a8 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -40,8 +40,7 @@
40#include "system.h" 40#include "system.h"
41#include "powermgmt.h" 41#include "powermgmt.h"
42 42
43#if (CONFIG_KEYPAD == IRIVER_H100_PAD) \ 43#ifdef HAVE_REMOTE_LCD
44 || (CONFIG_KEYPAD == IRIVER_H300_PAD)
45#include "lcd-remote.h" 44#include "lcd-remote.h"
46#endif 45#endif
47 46
@@ -54,6 +53,9 @@ static bool flipped; /* buttons can be flipped to match the LCD flip */
54#endif 53#endif
55#ifdef CONFIG_BACKLIGHT 54#ifdef CONFIG_BACKLIGHT
56static bool filter_first_keypress; 55static bool filter_first_keypress;
56#ifdef HAVE_REMOTE_LCD
57static bool remote_filter_first_keypress;
58#endif
57#endif 59#endif
58 60
59/* how often we check to see if a button is pressed */ 61/* how often we check to see if a button is pressed */
@@ -403,6 +405,12 @@ static void button_tick(void)
403 static int repeat_count = 0; 405 static int repeat_count = 0;
404 static bool repeat = false; 406 static bool repeat = false;
405 static bool post = false; 407 static bool post = false;
408#ifdef CONFIG_BACKLIGHT
409 static bool skip_release = false;
410#ifdef HAVE_REMOTE_LCD
411 static bool skip_remote_release = false;
412#endif
413#endif
406 int diff; 414 int diff;
407 int btn; 415 int btn;
408 416
@@ -425,7 +433,22 @@ static void button_tick(void)
425 diff = btn ^ lastbtn; 433 diff = btn ^ lastbtn;
426 if(diff && (btn & diff) == 0) 434 if(diff && (btn & diff) == 0)
427 { 435 {
436#ifdef CONFIG_BACKLIGHT
437#ifdef HAVE_REMOTE_LCD
438 if(diff & BUTTON_REMOTE)
439 if(!skip_remote_release)
440 queue_post(&button_queue, BUTTON_REL | diff, NULL);
441 else
442 skip_remote_release = false;
443 else
444#endif
445 if(!skip_release)
446 queue_post(&button_queue, BUTTON_REL | diff, NULL);
447 else
448 skip_release = false;
449#else
428 queue_post(&button_queue, BUTTON_REL | diff, NULL); 450 queue_post(&button_queue, BUTTON_REL | diff, NULL);
451#endif
429 } 452 }
430 else 453 else
431 { 454 {
@@ -502,15 +525,44 @@ static void button_tick(void)
502 { 525 {
503 queue_post( 526 queue_post(
504 &button_queue, BUTTON_REPEAT | btn, NULL); 527 &button_queue, BUTTON_REPEAT | btn, NULL);
528#ifdef CONFIG_BACKLIGHT
529#ifdef HAVE_REMOTE_LCD
530 if(btn & BUTTON_REMOTE)
531 {
532 if(skip_remote_release)
533 skip_remote_release = false;
534 }
535 else
536#endif
537 if(skip_release)
538 skip_release = false;
539#endif
505 post = false; 540 post = false;
506 } 541 }
507 } 542 }
508 else 543 else
509 { 544 {
510#ifdef CONFIG_BACKLIGHT 545#ifdef CONFIG_BACKLIGHT
511 if ( !filter_first_keypress || is_backlight_on()) 546#ifdef HAVE_REMOTE_LCD
547 if (btn & BUTTON_REMOTE) {
548 if (!remote_filter_first_keypress || is_remote_backlight_on()
549#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
550 ||(remote_type()==REMOTETYPE_H300_NONLCD)
551#endif
552 )
553 queue_post(&button_queue, btn, NULL);
554 else
555 skip_remote_release = true;
556 }
557 else
558#endif
559 if (!filter_first_keypress || is_backlight_on())
560 queue_post(&button_queue, btn, NULL);
561 else
562 skip_release = true;
563#else /* no backlight, nothing to skip */
564 queue_post(&button_queue, btn, NULL);
512#endif 565#endif
513 queue_post(&button_queue, btn, NULL);
514 post = false; 566 post = false;
515 } 567 }
516#ifdef HAVE_REMOTE_LCD 568#ifdef HAVE_REMOTE_LCD
@@ -637,6 +689,9 @@ void button_init(void)
637#endif 689#endif
638#ifdef CONFIG_BACKLIGHT 690#ifdef CONFIG_BACKLIGHT
639 filter_first_keypress = false; 691 filter_first_keypress = false;
692#ifdef HAVE_REMOTE_LCD
693 remote_filter_first_keypress = false;
694#endif
640#endif 695#endif
641} 696}
642 697
@@ -701,6 +756,12 @@ void set_backlight_filter_keypress(bool value)
701{ 756{
702 filter_first_keypress = value; 757 filter_first_keypress = value;
703} 758}
759#ifdef HAVE_REMOTE_LCD
760void set_remote_backlight_filter_keypress(bool value)
761{
762 remote_filter_first_keypress = value;
763}
764#endif
704#endif 765#endif
705 766
706/* 767/*
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h
index f371dc1423..508d472381 100644
--- a/firmware/export/backlight.h
+++ b/firmware/export/backlight.h
@@ -43,6 +43,7 @@ void remote_backlight_on(void);
43void remote_backlight_off(void); 43void remote_backlight_off(void);
44void remote_backlight_set_timeout(int index); 44void remote_backlight_set_timeout(int index);
45void remote_backlight_set_timeout_plugged(int index); 45void remote_backlight_set_timeout_plugged(int index);
46bool is_remote_backlight_on(void);
46#endif 47#endif
47 48
48#ifdef SIMULATOR 49#ifdef SIMULATOR
diff --git a/firmware/export/button.h b/firmware/export/button.h
index a142540511..2290b284ce 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -44,6 +44,9 @@ void button_set_flip(bool flip); /* turn 180 degrees */
44#endif 44#endif
45#ifdef CONFIG_BACKLIGHT 45#ifdef CONFIG_BACKLIGHT
46void set_backlight_filter_keypress(bool value); 46void set_backlight_filter_keypress(bool value);
47#ifdef HAVE_REMOTE_LCD
48void set_remote_backlight_filter_keypress(bool value);
49#endif
47#endif 50#endif
48 51
49#ifdef HAS_BUTTON_HOLD 52#ifdef HAS_BUTTON_HOLD
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c
index bf0396e18d..b371643c6f 100644
--- a/uisimulator/sdl/button.c
+++ b/uisimulator/sdl/button.c
@@ -44,6 +44,14 @@ void set_backlight_filter_keypress(bool value)
44{ 44{
45 filter_first_keypress = value; 45 filter_first_keypress = value;
46} 46}
47#ifdef HAVE_REMOTE_LCD
48static bool remote_filter_first_keypress;
49
50void set_remote_backlight_filter_keypress(bool value)
51{
52 remote_filter_first_keypress = value;
53}
54#endif
47#endif 55#endif
48 56
49void button_event(int key, bool pressed) 57void button_event(int key, bool pressed)
@@ -56,6 +64,12 @@ void button_event(int key, bool pressed)
56 static int repeat_count = 0; 64 static int repeat_count = 0;
57 static bool repeat = false; 65 static bool repeat = false;
58 static bool post = false; 66 static bool post = false;
67#ifdef CONFIG_BACKLIGHT
68 static bool skip_release = false;
69#ifdef HAVE_REMOTE_LCD
70 static bool skip_remote_release = false;
71#endif
72#endif
59 73
60 switch (key) 74 switch (key)
61 { 75 {
@@ -169,11 +183,26 @@ void button_event(int key, bool pressed)
169 183
170 /* Find out if a key has been released */ 184 /* Find out if a key has been released */
171 diff = btn ^ lastbtn; 185 diff = btn ^ lastbtn;
172
173 if(diff && (btn & diff) == 0) 186 if(diff && (btn & diff) == 0)
174 { 187 {
188#ifdef CONFIG_BACKLIGHT
189#ifdef HAVE_REMOTE_LCD
190 if(diff & BUTTON_REMOTE)
191 if(!skip_remote_release)
192 queue_post(&button_queue, BUTTON_REL | diff, NULL);
193 else
194 skip_remote_release = false;
195 else
196#endif
197 if(!skip_release)
198 queue_post(&button_queue, BUTTON_REL | diff, NULL);
199 else
200 skip_release = false;
201#else
175 queue_post(&button_queue, BUTTON_REL | diff, NULL); 202 queue_post(&button_queue, BUTTON_REL | diff, NULL);
203#endif
176 } 204 }
205
177 else 206 else
178 { 207 {
179 if ( btn ) 208 if ( btn )
@@ -223,15 +252,40 @@ void button_event(int key, bool pressed)
223 if (queue_empty(&button_queue)) 252 if (queue_empty(&button_queue))
224 { 253 {
225 queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); 254 queue_post(&button_queue, BUTTON_REPEAT | btn, NULL);
255#ifdef CONFIG_BACKLIGHT
256#ifdef HAVE_REMOTE_LCD
257 if(btn & BUTTON_REMOTE)
258 {
259 if(skip_remote_release)
260 skip_remote_release = false;
261 }
262 else
263#endif
264 if(skip_release)
265 skip_release = false;
266#endif
226 post = false; 267 post = false;
227 } 268 }
228 } 269 }
229 else 270 else
230 { 271 {
231#ifdef CONFIG_BACKLIGHT 272#ifdef CONFIG_BACKLIGHT
232 if ( !filter_first_keypress || is_backlight_on()) 273#ifdef HAVE_REMOTE_LCD
233#endif 274 if (btn & BUTTON_REMOTE) {
275 if (!remote_filter_first_keypress || is_remote_backlight_on())
276 queue_post(&button_queue, btn, NULL);
277 else
278 skip_remote_release = true;
279 }
280 else
281#endif
282 if (!filter_first_keypress || is_backlight_on())
283 queue_post(&button_queue, btn, NULL);
284 else
285 skip_release = true;
286#else /* no backlight, nothing to skip */
234 queue_post(&button_queue, btn, NULL); 287 queue_post(&button_queue, btn, NULL);
288#endif
235 post = false; 289 post = false;
236 } 290 }
237 291