From 8c15138008b108a0ab3d90ef9f09c6d3fc59f740 Mon Sep 17 00:00:00 2001 From: Hristo Kovachev Date: Sat, 1 Apr 2006 12:20:23 +0000 Subject: Patch #4934 by Ralf Herz: Fixes 1) Backlight stays on when set to always off (at least on the iPods (signed/unsigned problem)) 2) Buttons not working when the backlight is set to always off and turned on the "first keypress enables backlight only" git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9396 a1c6a512-1295-4272-9138-f99709370657 --- firmware/backlight.c | 9 ++++++--- firmware/export/backlight.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/firmware/backlight.c b/firmware/backlight.c index 97c9175a4b..a84fc8b280 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c @@ -137,7 +137,7 @@ static inline void __backlight_off(void) #if defined(CONFIG_BACKLIGHT) && !defined(BOOTLOADER) -const char backlight_timeout_value[19] = +const signed char backlight_timeout_value[19] = { -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 90 }; @@ -522,9 +522,10 @@ void backlight_off(void) queue_post(&backlight_queue, BACKLIGHT_OFF, NULL); } +/* returns true when the backlight is on OR when it's set to always off */ bool is_backlight_on(void) { - if (backlight_timer || !backlight_get_current_timeout()) + if (backlight_timer || backlight_get_current_timeout() <= 0) return true; else return false; @@ -615,9 +616,11 @@ int remote_backlight_get_current_timeout(void) #endif } +/* returns true when the backlight is on OR when it's set to always off */ bool is_remote_backlight_on(void) { - if (remote_backlight_timer != 0 || !remote_backlight_get_current_timeout()) + if (remote_backlight_timer != 0 || + remote_backlight_get_current_timeout() <= 0) return true; else return false; diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h index 508d472381..c1a7ade38f 100644 --- a/firmware/export/backlight.h +++ b/firmware/export/backlight.h @@ -33,7 +33,7 @@ void backlight_set_fade_in(int index); void backlight_set_fade_out(int index); #endif void backlight_set_timeout_plugged(int index); -extern const char backlight_timeout_value[]; +extern const signed char backlight_timeout_value[]; #else #define backlight_init() #endif -- cgit v1.2.3