diff options
-rw-r--r-- | apps/main_menu.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/apps/main_menu.c b/apps/main_menu.c index 4b150f0b08..80bbe26e4a 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include "sprintf.h" | 30 | #include "sprintf.h" |
31 | #include <string.h> | 31 | #include <string.h> |
32 | #include "playlist.h" | 32 | #include "playlist.h" |
33 | #include "settings.h" | ||
34 | #include "backlight.h" | ||
33 | 35 | ||
34 | #ifdef HAVE_LCD_BITMAP | 36 | #ifdef HAVE_LCD_BITMAP |
35 | #include "games_menu.h" | 37 | #include "games_menu.h" |
@@ -165,6 +167,54 @@ void scroll_speed(void) | |||
165 | } | 167 | } |
166 | } | 168 | } |
167 | 169 | ||
170 | void backlight_timer(void) | ||
171 | { | ||
172 | bool done = false; | ||
173 | int timer = global_settings.backlight; | ||
174 | char str[16]; | ||
175 | |||
176 | lcd_clear_display(); | ||
177 | lcd_puts_scroll(0,0,"Backlight"); | ||
178 | |||
179 | while (!done) { | ||
180 | snprintf(str,sizeof str,"Timeout: %d s ", timer); | ||
181 | lcd_puts(0,1,str); | ||
182 | lcd_update(); | ||
183 | switch( button_get(true) ) { | ||
184 | #ifdef HAVE_RECORDER_KEYPAD | ||
185 | case BUTTON_UP: | ||
186 | #else | ||
187 | case BUTTON_RIGHT: | ||
188 | #endif | ||
189 | timer++; | ||
190 | if(timer > 60) | ||
191 | timer = 60; | ||
192 | break; | ||
193 | |||
194 | #ifdef HAVE_RECORDER_KEYPAD | ||
195 | case BUTTON_DOWN: | ||
196 | #else | ||
197 | case BUTTON_LEFT: | ||
198 | #endif | ||
199 | timer--; | ||
200 | if ( timer < 0 ) | ||
201 | timer = 0; | ||
202 | break; | ||
203 | |||
204 | #ifdef HAVE_RECORDER_KEYPAD | ||
205 | case BUTTON_LEFT: | ||
206 | #else | ||
207 | case BUTTON_STOP: | ||
208 | case BUTTON_MENU: | ||
209 | #endif | ||
210 | done = true; | ||
211 | global_settings.backlight = timer; | ||
212 | backlight_on(); | ||
213 | break; | ||
214 | } | ||
215 | } | ||
216 | } | ||
217 | |||
168 | void shuffle(void) | 218 | void shuffle(void) |
169 | { | 219 | { |
170 | bool done = false; | 220 | bool done = false; |
@@ -196,13 +246,14 @@ void main_menu(void) | |||
196 | { | 246 | { |
197 | int m; | 247 | int m; |
198 | enum { | 248 | enum { |
199 | Games, Screensavers, Version, Sound, Scroll, Shuffle | 249 | Games, Screensavers, Version, Sound, Scroll, Shuffle, Backlight |
200 | }; | 250 | }; |
201 | 251 | ||
202 | /* main menu */ | 252 | /* main menu */ |
203 | struct menu_items items[] = { | 253 | struct menu_items items[] = { |
204 | { Shuffle, "Shuffle", shuffle }, | 254 | { Shuffle, "Shuffle", shuffle }, |
205 | { Sound, "Sound", sound_menu }, | 255 | { Sound, "Sound", sound_menu }, |
256 | { Backlight, "Backlight", backlight_timer }, | ||
206 | { Scroll, "Scroll speed", scroll_speed }, | 257 | { Scroll, "Scroll speed", scroll_speed }, |
207 | #ifdef HAVE_LCD_BITMAP | 258 | #ifdef HAVE_LCD_BITMAP |
208 | { Games, "Games", games_menu }, | 259 | { Games, "Games", games_menu }, |