summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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[] =
#endif
#ifdef CONFIG_BACKLIGHT
+ {1, S_O(bl_filter_first_keypress),
#ifdef HAVE_LCD_COLOR
- {1, S_O(bl_filter_first_keypress), true, "backlight filters first keypress", off_on },
+ true,
#else
- {1, S_O(bl_filter_first_keypress), false, "backlight filters first keypress", off_on },
+ false,
#endif
+ "backlight filters first keypress", off_on },
+#ifdef HAVE_REMOTE_LCD
+ {1, S_O(remote_bl_filter_first_keypress), false,
+ "backlight filters first remote keypress", off_on },
+#endif
+
#endif
/* new stuff to be added here */
@@ -1126,6 +1133,9 @@ void settings_apply(void)
#ifdef CONFIG_BACKLIGHT
set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
+#ifdef HAVE_REMOTE_LCD
+ set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
+#endif
#endif
}
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
#ifdef CONFIG_BACKLIGHT
bool bl_filter_first_keypress; /* filter first keypress when dark? */
+#ifdef HAVE_REMOTE_LCD
+ bool remote_bl_filter_first_keypress; /* filter first remote keypress when remote dark? */
+#endif
#endif
};
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)
set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
return result;
}
+#ifdef HAVE_REMOTE_LCD
+static bool set_remote_bl_filter_first_keypress(void)
+{
+ bool result = set_bool( str(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS),
+ &global_settings.remote_bl_filter_first_keypress );
+ set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
+ return result;
+}
+#endif
#endif
static bool ff_rewind_accel(void)
@@ -1694,6 +1703,7 @@ static bool lcd_remote_settings_menu(void)
remote_backlight_timer_plugged },
#endif
{ ID2P(LANG_CAPTION_BACKLIGHT), remote_caption_backlight },
+ { ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_remote_bl_filter_first_keypress },
{ ID2P(LANG_CONTRAST), remote_contrast },
{ ID2P(LANG_INVERT), remote_invert },
{ 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
Fredrik Öhrn
Nicolas Pennequin
Ralf Herz
-Michael DiFebbo \ No newline at end of file
+Michael DiFebbo
+David 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)
remote_backlight_on();
}
#endif
+
+/* return value in ticks; 0 means always on, <0 means always off */
+int remote_backlight_get_current_timeout(void)
+{
+#ifdef HAVE_CHARGING
+ if (charger_inserted()
+#ifdef HAVE_USB_POWER
+ || usb_powered()
+#endif
+ )
+ return remote_backlight_timeout_plugged;
+ else
+ return remote_backlight_timeout;
+#else
+ return remote_backlight_timeout;
+#endif
+}
+
+bool is_remote_backlight_on(void)
+{
+ if (remote_backlight_timer != 0 || !remote_backlight_get_current_timeout())
+ return true;
+ else
+ return false;
+}
+
#endif /* HAVE_REMOTE_LCD */
#else /* no backlight, empty dummy functions */
@@ -620,6 +646,7 @@ bool is_backlight_on(void) {return true;}
void remote_backlight_on(void) {}
void remote_backlight_off(void) {}
void remote_backlight_set_timeout(int index) {(void)index;}
+bool is_remote_backlight_on(void) {return true;}
#endif
#endif /* #ifdef CONFIG_BACKLIGHT */
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 @@
#include "system.h"
#include "powermgmt.h"
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) \
- || (CONFIG_KEYPAD == IRIVER_H300_PAD)
+#ifdef HAVE_REMOTE_LCD
#include "lcd-remote.h"
#endif
@@ -54,6 +53,9 @@ static bool flipped; /* buttons can be flipped to match the LCD flip */
#endif
#ifdef CONFIG_BACKLIGHT
static bool filter_first_keypress;
+#ifdef HAVE_REMOTE_LCD
+static bool remote_filter_first_keypress;
+#endif
#endif
/* how often we check to see if a button is pressed */
@@ -403,6 +405,12 @@ static void button_tick(void)
static int repeat_count = 0;
static bool repeat = false;
static bool post = false;
+#ifdef CONFIG_BACKLIGHT
+ static bool skip_release = false;
+#ifdef HAVE_REMOTE_LCD
+ static bool skip_remote_release = false;
+#endif
+#endif
int diff;
int btn;
@@ -425,7 +433,22 @@ static void button_tick(void)
diff = btn ^ lastbtn;
if(diff && (btn & diff) == 0)
{
+#ifdef CONFIG_BACKLIGHT
+#ifdef HAVE_REMOTE_LCD
+ if(diff & BUTTON_REMOTE)
+ if(!skip_remote_release)
+ queue_post(&button_queue, BUTTON_REL | diff, NULL);
+ else
+ skip_remote_release = false;
+ else
+#endif
+ if(!skip_release)
+ queue_post(&button_queue, BUTTON_REL | diff, NULL);
+ else
+ skip_release = false;
+#else
queue_post(&button_queue, BUTTON_REL | diff, NULL);
+#endif
}
else
{
@@ -502,15 +525,44 @@ static void button_tick(void)
{
queue_post(
&button_queue, BUTTON_REPEAT | btn, NULL);
+#ifdef CONFIG_BACKLIGHT
+#ifdef HAVE_REMOTE_LCD
+ if(btn & BUTTON_REMOTE)
+ {
+ if(skip_remote_release)
+ skip_remote_release = false;
+ }
+ else
+#endif
+ if(skip_release)
+ skip_release = false;
+#endif
post = false;
}
}
else
{
#ifdef CONFIG_BACKLIGHT
- if ( !filter_first_keypress || is_backlight_on())
+#ifdef HAVE_REMOTE_LCD
+ if (btn & BUTTON_REMOTE) {
+ if (!remote_filter_first_keypress || is_remote_backlight_on()
+#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
+ ||(remote_type()==REMOTETYPE_H300_NONLCD)
+#endif
+ )
+ queue_post(&button_queue, btn, NULL);
+ else
+ skip_remote_release = true;
+ }
+ else
+#endif
+ if (!filter_first_keypress || is_backlight_on())
+ queue_post(&button_queue, btn, NULL);
+ else
+ skip_release = true;
+#else /* no backlight, nothing to skip */
+ queue_post(&button_queue, btn, NULL);
#endif
- queue_post(&button_queue, btn, NULL);
post = false;
}
#ifdef HAVE_REMOTE_LCD
@@ -637,6 +689,9 @@ void button_init(void)
#endif
#ifdef CONFIG_BACKLIGHT
filter_first_keypress = false;
+#ifdef HAVE_REMOTE_LCD
+ remote_filter_first_keypress = false;
+#endif
#endif
}
@@ -701,6 +756,12 @@ void set_backlight_filter_keypress(bool value)
{
filter_first_keypress = value;
}
+#ifdef HAVE_REMOTE_LCD
+void set_remote_backlight_filter_keypress(bool value)
+{
+ remote_filter_first_keypress = value;
+}
+#endif
#endif
/*
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);
void remote_backlight_off(void);
void remote_backlight_set_timeout(int index);
void remote_backlight_set_timeout_plugged(int index);
+bool is_remote_backlight_on(void);
#endif
#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 */
#endif
#ifdef CONFIG_BACKLIGHT
void set_backlight_filter_keypress(bool value);
+#ifdef HAVE_REMOTE_LCD
+void set_remote_backlight_filter_keypress(bool value);
+#endif
#endif
#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)
{
filter_first_keypress = value;
}
+#ifdef HAVE_REMOTE_LCD
+static bool remote_filter_first_keypress;
+
+void set_remote_backlight_filter_keypress(bool value)
+{
+ remote_filter_first_keypress = value;
+}
+#endif
#endif
void button_event(int key, bool pressed)
@@ -56,6 +64,12 @@ void button_event(int key, bool pressed)
static int repeat_count = 0;
static bool repeat = false;
static bool post = false;
+#ifdef CONFIG_BACKLIGHT
+ static bool skip_release = false;
+#ifdef HAVE_REMOTE_LCD
+ static bool skip_remote_release = false;
+#endif
+#endif
switch (key)
{
@@ -169,11 +183,26 @@ void button_event(int key, bool pressed)
/* Find out if a key has been released */
diff = btn ^ lastbtn;
-
if(diff && (btn & diff) == 0)
{
+#ifdef CONFIG_BACKLIGHT
+#ifdef HAVE_REMOTE_LCD
+ if(diff & BUTTON_REMOTE)
+ if(!skip_remote_release)
+ queue_post(&button_queue, BUTTON_REL | diff, NULL);
+ else
+ skip_remote_release = false;
+ else
+#endif
+ if(!skip_release)
+ queue_post(&button_queue, BUTTON_REL | diff, NULL);
+ else
+ skip_release = false;
+#else
queue_post(&button_queue, BUTTON_REL | diff, NULL);
+#endif
}
+
else
{
if ( btn )
@@ -223,15 +252,40 @@ void button_event(int key, bool pressed)
if (queue_empty(&button_queue))
{
queue_post(&button_queue, BUTTON_REPEAT | btn, NULL);
+#ifdef CONFIG_BACKLIGHT
+#ifdef HAVE_REMOTE_LCD
+ if(btn & BUTTON_REMOTE)
+ {
+ if(skip_remote_release)
+ skip_remote_release = false;
+ }
+ else
+#endif
+ if(skip_release)
+ skip_release = false;
+#endif
post = false;
}
}
else
{
#ifdef CONFIG_BACKLIGHT
- if ( !filter_first_keypress || is_backlight_on())
-#endif
+#ifdef HAVE_REMOTE_LCD
+ if (btn & BUTTON_REMOTE) {
+ if (!remote_filter_first_keypress || is_remote_backlight_on())
+ queue_post(&button_queue, btn, NULL);
+ else
+ skip_remote_release = true;
+ }
+ else
+#endif
+ if (!filter_first_keypress || is_backlight_on())
+ queue_post(&button_queue, btn, NULL);
+ else
+ skip_release = true;
+#else /* no backlight, nothing to skip */
queue_post(&button_queue, btn, NULL);
+#endif
post = false;
}