summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/lamp.c18
-rw-r--r--apps/plugins/lib/helper.c19
-rw-r--r--apps/plugins/lib/helper.h5
3 files changed, 40 insertions, 2 deletions
diff --git a/apps/plugins/lamp.c b/apps/plugins/lamp.c
index c755219..943cc97 100644
--- a/apps/plugins/lamp.c
+++ b/apps/plugins/lamp.c
@@ -115,6 +115,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
short old_brightness = rb->global_settings->brightness;
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
+#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
+ short old_buttonlight_brightness =
+ rb->global_settings->buttonlight_brightness;
+#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#if LCD_DEPTH > 1
unsigned bg_color=rb->lcd_get_background();
@@ -125,6 +129,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
rb->backlight_set_brightness(MAX_BRIGHTNESS_SETTING);
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
+#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
+ rb->buttonlight_set_brightness(MAX_BRIGHTNESS_SETTING);
+#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#ifdef HAVE_LCD_INVERT
#ifdef OLYMPUS_MROBE_100
@@ -136,9 +143,12 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#endif /* HAVE_LCD_INVERT */
backlight_force_on(rb);
+#ifdef HAVE_BUTTON_LIGHT
+ buttonlight_force_on(rb);
+#endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_LCD_COLOR
- do
+ do
{
if(cs < 0)
cs = NUM_COLORSETS-1;
@@ -198,6 +208,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
/* restore */
backlight_use_settings(rb);
+#ifdef HAVE_BUTTON_LIGHT
+ buttonlight_use_settings(rb);
+#endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_LCD_INVERT
rb->lcd_set_invert_display(rb->global_settings->invert);
@@ -206,6 +219,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
rb->backlight_set_brightness(old_brightness);
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
+#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
+ rb->buttonlight_set_brightness(old_buttonlight_brightness);
+#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#if LCD_DEPTH > 1
rb->lcd_set_background(bg_color);
diff --git a/apps/plugins/lib/helper.c b/apps/plugins/lib/helper.c
index 3af60b5..8ac822b 100644
--- a/apps/plugins/lib/helper.c
+++ b/apps/plugins/lib/helper.c
@@ -72,3 +72,22 @@ void remote_backlight_use_settings(struct plugin_api* rb)
#endif /* CONFIG_CHARGING */
}
#endif /* HAVE_REMOTE_LCD */
+
+#ifdef HAVE_BUTTON_LIGHT
+/* Force the buttonlight on */
+void buttonlight_force_on(struct plugin_api* rb)
+{
+ if (!rb)
+ return;
+ if (rb->global_settings->buttonlight_timeout > 0)
+ rb->buttonlight_set_timeout(0);
+}
+
+/* Reset buttonlight operation to its settings */
+void buttonlight_use_settings(struct plugin_api* rb)
+{
+ if (!rb)
+ return;
+ rb->buttonlight_set_timeout(rb->global_settings->buttonlight_timeout);
+}
+#endif /* HAVE_BUTTON_LIGHT */
diff --git a/apps/plugins/lib/helper.h b/apps/plugins/lib/helper.h
index 744ad4d..4d1328b 100644
--- a/apps/plugins/lib/helper.h
+++ b/apps/plugins/lib/helper.h
@@ -30,5 +30,8 @@ void backlight_use_settings(struct plugin_api* rb);
void remote_backlight_force_on(struct plugin_api* rb);
void remote_backlight_use_settings(struct plugin_api* rb);
#endif
-
+#ifdef HAVE_BUTTON_LIGHT
+void buttonlight_force_on(struct plugin_api* rb);
+void buttonlight_use_settings(struct plugin_api* rb);
+#endif
#endif