summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-11-23 23:00:29 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2022-11-23 23:00:29 -0500
commit97a82ee3eca1be69bd2d08e8fd9db09c0807ae5d (patch)
treeb032a1397fd33240d8fdc7d6e17059723d0ffe55
parent3745c813f924b12232c4f37610aecd23fe5654b8 (diff)
downloadrockbox-97a82ee3eca1be69bd2d08e8fd9db09c0807ae5d.tar.gz
rockbox-97a82ee3eca1be69bd2d08e8fd9db09c0807ae5d.zip
plugins HAVE_BACKLIGHT helper remove ifdefs in favor of dummy functions
lessen the ifdef hell Change-Id: I52f830284e4599f3fc3a75c27dda27058b8de1a3
-rw-r--r--apps/plugins/2048.c5
-rw-r--r--apps/plugins/brickmania.c8
-rw-r--r--apps/plugins/chopper.c8
-rw-r--r--apps/plugins/credits.c8
-rw-r--r--apps/plugins/demystify.c12
-rw-r--r--apps/plugins/doom/rockdoom.c8
-rw-r--r--apps/plugins/fft/fft.c6
-rw-r--r--apps/plugins/fire.c6
-rw-r--r--apps/plugins/fireworks.c8
-rw-r--r--apps/plugins/imageviewer/imageviewer.c4
-rw-r--r--apps/plugins/lamp.c15
-rw-r--r--apps/plugins/lib/helper.c48
-rw-r--r--apps/plugins/lib/helper.h10
-rw-r--r--apps/plugins/maze.c5
-rw-r--r--apps/plugins/mazezam.c5
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c5
-rw-r--r--apps/plugins/oscilloscope.c6
-rwxr-xr-xapps/plugins/pacbox/pacbox.c4
-rw-r--r--apps/plugins/pictureflow/pictureflow.c3
-rw-r--r--apps/plugins/plasma.c8
-rw-r--r--apps/plugins/pong.c7
-rw-r--r--apps/plugins/puzzles/rockbox.c4
-rw-r--r--apps/plugins/resistor.c18
-rw-r--r--apps/plugins/rockblox.c11
-rw-r--r--apps/plugins/rockboy/menu.c6
-rw-r--r--apps/plugins/rockboy/rockboy.c5
-rw-r--r--apps/plugins/rocklife.c6
-rw-r--r--apps/plugins/sdl/main.c7
-rw-r--r--apps/plugins/spacerocks.c7
-rw-r--r--apps/plugins/speedread.c7
-rw-r--r--apps/plugins/starfield.c8
-rw-r--r--apps/plugins/test_disk.c6
-rw-r--r--apps/plugins/test_fps.c8
-rw-r--r--apps/plugins/test_gfx.c8
-rw-r--r--apps/plugins/test_grey.c8
-rw-r--r--apps/plugins/wormlet.c7
-rw-r--r--apps/plugins/xobox.c7
-rw-r--r--apps/plugins/xworld/sys.c6
38 files changed, 140 insertions, 178 deletions
diff --git a/apps/plugins/2048.c b/apps/plugins/2048.c
index 2633753071..456f973aef 100644
--- a/apps/plugins/2048.c
+++ b/apps/plugins/2048.c
@@ -148,9 +148,7 @@ static inline int rand_range(int min, int max)
148/* prepares for exit */ 148/* prepares for exit */
149static void cleanup(void) 149static void cleanup(void)
150{ 150{
151#ifdef HAVE_BACKLIGHT
152 backlight_use_settings(); 151 backlight_use_settings();
153#endif
154} 152}
155 153
156/* returns 2 or 4 */ 154/* returns 2 or 4 */
@@ -700,9 +698,8 @@ static void init_game(bool newgame)
700 max_numeral_width = rb->font_get_width(rb->font_get(WHAT_FONT), '0'); 698 max_numeral_width = rb->font_get_width(rb->font_get(WHAT_FONT), '0');
701#endif 699#endif
702 700
703#ifdef HAVE_BACKLIGHT
704 backlight_ignore_timeout(); 701 backlight_ignore_timeout();
705#endif 702
706 draw(); 703 draw();
707} 704}
708 705
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c
index 3e7ea27441..de65ce69e1 100644
--- a/apps/plugins/brickmania.c
+++ b/apps/plugins/brickmania.c
@@ -2533,10 +2533,10 @@ enum plugin_status plugin_start(const void* parameter)
2533#if LCD_DEPTH > 1 2533#if LCD_DEPTH > 1
2534 rb->lcd_set_backdrop(NULL); 2534 rb->lcd_set_backdrop(NULL);
2535#endif 2535#endif
2536#ifdef HAVE_BACKLIGHT 2536
2537 /* Turn off backlight timeout */ 2537 /* Turn off backlight timeout */
2538 backlight_ignore_timeout(); 2538 backlight_ignore_timeout();
2539#endif 2539
2540 /* now go ahead and have fun! */ 2540 /* now go ahead and have fun! */
2541 rb->srand( *rb->current_tick ); 2541 rb->srand( *rb->current_tick );
2542 brickmania_loadgame(); 2542 brickmania_loadgame();
@@ -2565,9 +2565,9 @@ enum plugin_status plugin_start(const void* parameter)
2565 configfile_save(CONFIG_FILE_NAME,config,1,0); 2565 configfile_save(CONFIG_FILE_NAME,config,1,0);
2566 /* Restore user's original backlight setting */ 2566 /* Restore user's original backlight setting */
2567 rb->lcd_setfont(FONT_UI); 2567 rb->lcd_setfont(FONT_UI);
2568#ifdef HAVE_BACKLIGHT 2568
2569 /* Turn on backlight timeout (revert to settings) */ 2569 /* Turn on backlight timeout (revert to settings) */
2570 backlight_use_settings(); 2570 backlight_use_settings();
2571#endif 2571
2572 return PLUGIN_OK; 2572 return PLUGIN_OK;
2573} 2573}
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c
index 392b840317..5c87e74e50 100644
--- a/apps/plugins/chopper.c
+++ b/apps/plugins/chopper.c
@@ -1083,10 +1083,10 @@ enum plugin_status plugin_start(const void* parameter)
1083 rb->lcd_set_foreground(LCD_WHITE); 1083 rb->lcd_set_foreground(LCD_WHITE);
1084#endif 1084#endif
1085 1085
1086#ifdef HAVE_BACKLIGHT 1086
1087 /* Turn off backlight timeout */ 1087 /* Turn off backlight timeout */
1088 backlight_ignore_timeout(); 1088 backlight_ignore_timeout();
1089#endif 1089
1090 1090
1091 rb->srand( *rb->current_tick ); 1091 rb->srand( *rb->current_tick );
1092 1092
@@ -1098,10 +1098,10 @@ enum plugin_status plugin_start(const void* parameter)
1098 configfile_save(CFG_FILE, config, 1, 0); 1098 configfile_save(CFG_FILE, config, 1, 0);
1099 1099
1100 rb->lcd_setfont(FONT_UI); 1100 rb->lcd_setfont(FONT_UI);
1101#ifdef HAVE_BACKLIGHT 1101
1102 /* Turn on backlight timeout (revert to settings) */ 1102 /* Turn on backlight timeout (revert to settings) */
1103 backlight_use_settings(); 1103 backlight_use_settings();
1104#endif 1104
1105 1105
1106 return ret; 1106 return ret;
1107} 1107}
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c
index 9e43aab2a7..efdcf42df1 100644
--- a/apps/plugins/credits.c
+++ b/apps/plugins/credits.c
@@ -303,10 +303,10 @@ enum plugin_status plugin_start(const void* parameter)
303{ 303{
304 (void)parameter; 304 (void)parameter;
305 305
306#ifdef HAVE_BACKLIGHT 306
307 /* Turn off backlight timeout */ 307 /* Turn off backlight timeout */
308 backlight_ignore_timeout(); 308 backlight_ignore_timeout();
309#endif 309
310 310
311#if LCD_DEPTH>=16 311#if LCD_DEPTH>=16
312 rb->lcd_set_foreground (LCD_WHITE); 312 rb->lcd_set_foreground (LCD_WHITE);
@@ -318,10 +318,10 @@ enum plugin_status plugin_start(const void* parameter)
318 if(!rb->action_userabort(3*HZ)) 318 if(!rb->action_userabort(3*HZ))
319 roll_credits(); 319 roll_credits();
320 320
321#ifdef HAVE_BACKLIGHT 321
322 /* Turn on backlight timeout (revert to settings) */ 322 /* Turn on backlight timeout (revert to settings) */
323 backlight_use_settings(); 323 backlight_use_settings();
324#endif 324
325 325
326 return PLUGIN_OK; 326 return PLUGIN_OK;
327} 327}
diff --git a/apps/plugins/demystify.c b/apps/plugins/demystify.c
index 74537e94f8..1a1505ff96 100644
--- a/apps/plugins/demystify.c
+++ b/apps/plugins/demystify.c
@@ -262,12 +262,10 @@ static void polygons_draw(struct polygon_fifo * polygons, struct screen * displa
262 262
263static void cleanup(void) 263static void cleanup(void)
264{ 264{
265#ifdef HAVE_BACKLIGHT 265
266 backlight_use_settings(); 266 backlight_use_settings();
267#ifdef HAVE_REMOTE_LCD
268 remote_backlight_use_settings(); 267 remote_backlight_use_settings();
269#endif 268
270#endif
271} 269}
272 270
273#ifdef HAVE_LCD_COLOR 271#ifdef HAVE_LCD_COLOR
@@ -438,12 +436,10 @@ enum plugin_status plugin_start(const void* parameter)
438#if LCD_DEPTH > 1 436#if LCD_DEPTH > 1
439 rb->lcd_set_backdrop(NULL); 437 rb->lcd_set_backdrop(NULL);
440#endif 438#endif
441#ifdef HAVE_BACKLIGHT 439
442 backlight_ignore_timeout(); 440 backlight_ignore_timeout();
443#ifdef HAVE_REMOTE_LCD
444 remote_backlight_ignore_timeout(); 441 remote_backlight_ignore_timeout();
445#endif 442
446#endif
447 ret = plugin_main(); 443 ret = plugin_main();
448 444
449 return ret; 445 return ret;
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index 6594859c08..b68107f8aa 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -722,9 +722,9 @@ enum plugin_status plugin_start(const void* parameter)
722 systemvol= rb->global_settings->volume-rb->global_settings->volume%mod; 722 systemvol= rb->global_settings->volume-rb->global_settings->volume%mod;
723 general_translucency = default_translucency; // phares 723 general_translucency = default_translucency; // phares
724 724
725#ifdef HAVE_BACKLIGHT 725
726 backlight_ignore_timeout(); 726 backlight_ignore_timeout();
727#endif 727
728#ifdef RB_PROFILE 728#ifdef RB_PROFILE
729 rb->profile_thread(); 729 rb->profile_thread();
730#endif 730#endif
@@ -738,9 +738,9 @@ enum plugin_status plugin_start(const void* parameter)
738#ifdef RB_PROFILE 738#ifdef RB_PROFILE
739 rb->profstop(); 739 rb->profstop();
740#endif 740#endif
741#ifdef HAVE_BACKLIGHT 741
742 backlight_use_settings(); 742 backlight_use_settings();
743#endif 743
744 M_SaveDefaults (); 744 M_SaveDefaults ();
745 745
746 I_Quit(); // Make SURE everything was closed out right 746 I_Quit(); // Make SURE everything was closed out right
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c
index 35498227bf..f612a0ea35 100644
--- a/apps/plugins/fft/fft.c
+++ b/apps/plugins/fft/fft.c
@@ -1184,9 +1184,8 @@ static void fft_cleanup(void)
1184#ifndef HAVE_LCD_COLOR 1184#ifndef HAVE_LCD_COLOR
1185 grey_release(); 1185 grey_release();
1186#endif 1186#endif
1187#ifdef HAVE_BACKLIGHT 1187
1188 backlight_use_settings(); 1188 backlight_use_settings();
1189#endif
1190 1189
1191 /* save settings if changed */ 1190 /* save settings if changed */
1192 if (rb->memcmp(&fft, &fft_disk, sizeof(fft))) 1191 if (rb->memcmp(&fft, &fft_disk, sizeof(fft)))
@@ -1237,9 +1236,8 @@ static bool fft_setup(void)
1237 mylcd_clear_display(); 1236 mylcd_clear_display();
1238 myosd_lcd_update(); 1237 myosd_lcd_update();
1239#endif 1238#endif
1240#ifdef HAVE_BACKLIGHT 1239
1241 backlight_ignore_timeout(); 1240 backlight_ignore_timeout();
1242#endif
1243 1241
1244#ifdef HAVE_ADJUSTABLE_CPU_FREQ 1242#ifdef HAVE_ADJUSTABLE_CPU_FREQ
1245 rb->trigger_cpu_boost(); 1243 rb->trigger_cpu_boost();
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c
index f3e6fb35e4..43d10bf920 100644
--- a/apps/plugins/fire.c
+++ b/apps/plugins/fire.c
@@ -279,10 +279,9 @@ static void cleanup(void *parameter)
279#ifndef HAVE_LCD_COLOR 279#ifndef HAVE_LCD_COLOR
280 grey_release(); 280 grey_release();
281#endif 281#endif
282#ifdef HAVE_BACKLIGHT 282
283 /* Turn on backlight timeout (revert to settings) */ 283 /* Turn on backlight timeout (revert to settings) */
284 backlight_use_settings(); 284 backlight_use_settings();
285#endif
286} 285}
287 286
288 287
@@ -371,10 +370,9 @@ enum plugin_status plugin_start(const void* parameter)
371#if LCD_DEPTH > 1 370#if LCD_DEPTH > 1
372 rb->lcd_set_backdrop(NULL); 371 rb->lcd_set_backdrop(NULL);
373#endif 372#endif
374#ifdef HAVE_BACKLIGHT 373
375 /* Turn off backlight timeout */ 374 /* Turn off backlight timeout */
376 backlight_ignore_timeout(); 375 backlight_ignore_timeout();
377#endif
378 376
379#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) 377#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
380 rb->lcd_set_mode(LCD_MODE_PAL256); 378 rb->lcd_set_mode(LCD_MODE_PAL256);
diff --git a/apps/plugins/fireworks.c b/apps/plugins/fireworks.c
index b7dad0d8ba..febd093e3f 100644
--- a/apps/plugins/fireworks.c
+++ b/apps/plugins/fireworks.c
@@ -358,9 +358,9 @@ enum plugin_status plugin_start(const void* parameter)
358 358
359 /* set everything up.. no BL timeout, no backdrop, 359 /* set everything up.. no BL timeout, no backdrop,
360 white-text-on-black-background. */ 360 white-text-on-black-background. */
361#ifdef HAVE_BACKLIGHT 361
362 backlight_ignore_timeout(); 362 backlight_ignore_timeout();
363#endif 363
364#if LCD_DEPTH > 1 364#if LCD_DEPTH > 1
365 rb->lcd_set_backdrop(NULL); 365 rb->lcd_set_backdrop(NULL);
366 rb->lcd_set_background(LCD_BLACK); 366 rb->lcd_set_background(LCD_BLACK);
@@ -524,10 +524,10 @@ enum plugin_status plugin_start(const void* parameter)
524 break; 524 break;
525 } 525 }
526 } 526 }
527#ifdef HAVE_BACKLIGHT 527
528 /* Turn on backlight timeout (revert to settings) */ 528 /* Turn on backlight timeout (revert to settings) */
529 backlight_use_settings(); 529 backlight_use_settings();
530#endif 530
531#ifdef HAVE_ADJUSTABLE_CPU_FREQ 531#ifdef HAVE_ADJUSTABLE_CPU_FREQ
532 rb->cpu_boost(false); 532 rb->cpu_boost(false);
533#endif 533#endif
diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c
index e30a98ef68..a8ef3efc97 100644
--- a/apps/plugins/imageviewer/imageviewer.c
+++ b/apps/plugins/imageviewer/imageviewer.c
@@ -1064,10 +1064,8 @@ enum plugin_status plugin_start(const void* parameter)
1064 ARRAYLEN(config), IMGVIEW_SETTINGS_MINVERSION); 1064 ARRAYLEN(config), IMGVIEW_SETTINGS_MINVERSION);
1065 rb->memcpy(&old_settings, &settings, sizeof (settings)); 1065 rb->memcpy(&old_settings, &settings, sizeof (settings));
1066 1066
1067#ifdef HAVE_BACKLIGHT
1068 /* Turn off backlight timeout */ 1067 /* Turn off backlight timeout */
1069 backlight_ignore_timeout(); 1068 backlight_ignore_timeout();
1070#endif
1071 1069
1072#if LCD_DEPTH > 1 1070#if LCD_DEPTH > 1
1073 rb->lcd_set_backdrop(NULL); 1071 rb->lcd_set_backdrop(NULL);
@@ -1094,10 +1092,8 @@ enum plugin_status plugin_start(const void* parameter)
1094 rb->storage_spindown(rb->global_settings->disk_spindown); 1092 rb->storage_spindown(rb->global_settings->disk_spindown);
1095#endif 1093#endif
1096 1094
1097#ifdef HAVE_BACKLIGHT
1098 /* Turn on backlight timeout (revert to settings) */ 1095 /* Turn on backlight timeout (revert to settings) */
1099 backlight_use_settings(); 1096 backlight_use_settings();
1100#endif
1101 1097
1102#ifdef USEGSLIB 1098#ifdef USEGSLIB
1103 grey_release(); /* deinitialize */ 1099 grey_release(); /* deinitialize */
diff --git a/apps/plugins/lamp.c b/apps/plugins/lamp.c
index 6c9ae6626d..42a2353b2a 100644
--- a/apps/plugins/lamp.c
+++ b/apps/plugins/lamp.c
@@ -103,9 +103,8 @@ enum plugin_status plugin_start(const void* parameter)
103 int current_brightness = MAX_BRIGHTNESS_SETTING; 103 int current_brightness = MAX_BRIGHTNESS_SETTING;
104 backlight_brightness_set(MAX_BRIGHTNESS_SETTING); 104 backlight_brightness_set(MAX_BRIGHTNESS_SETTING);
105#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ 105#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
106#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS 106
107 buttonlight_brightness_set(MAX_BRIGHTNESS_SETTING); 107 buttonlight_brightness_set(MAX_BRIGHTNESS_SETTING);
108#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
109 108
110#ifdef HAVE_LCD_INVERT 109#ifdef HAVE_LCD_INVERT
111#ifdef HAVE_NEGATIVE_LCD 110#ifdef HAVE_NEGATIVE_LCD
@@ -116,9 +115,8 @@ enum plugin_status plugin_start(const void* parameter)
116#endif /* HAVE_LCD_INVERT */ 115#endif /* HAVE_LCD_INVERT */
117 116
118 backlight_force_on(); 117 backlight_force_on();
119#ifdef HAVE_BUTTON_LIGHT
120 buttonlight_force_on(); 118 buttonlight_force_on();
121#endif /* HAVE_BUTTON_LIGHT */ 119
122 120
123 rb->lcd_clear_display(); 121 rb->lcd_clear_display();
124 rb->lcd_update(); 122 rb->lcd_update();
@@ -207,20 +205,17 @@ enum plugin_status plugin_start(const void* parameter)
207 205
208 /* restore */ 206 /* restore */
209 backlight_use_settings(); 207 backlight_use_settings();
210#ifdef HAVE_BUTTON_LIGHT 208
211 buttonlight_use_settings(); 209 buttonlight_use_settings();
212#endif /* HAVE_BUTTON_LIGHT */
213 210
214#ifdef HAVE_LCD_INVERT 211#ifdef HAVE_LCD_INVERT
215 rb->lcd_set_invert_display(rb->global_settings->invert); 212 rb->lcd_set_invert_display(rb->global_settings->invert);
216#endif /* HAVE_LCD_INVERT */ 213#endif /* HAVE_LCD_INVERT */
217 214
218#ifdef HAVE_BACKLIGHT_BRIGHTNESS 215
219 backlight_brightness_use_setting(); 216 backlight_brightness_use_setting();
220#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ 217
221#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
222 buttonlight_brightness_use_setting(); 218 buttonlight_brightness_use_setting();
223#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
224 219
225#if LCD_DEPTH > 1 220#if LCD_DEPTH > 1
226 rb->lcd_set_background(bg_color); 221 rb->lcd_set_background(bg_color);
diff --git a/apps/plugins/lib/helper.c b/apps/plugins/lib/helper.c
index 018c1616c8..92d9ec905e 100644
--- a/apps/plugins/lib/helper.c
+++ b/apps/plugins/lib/helper.c
@@ -58,7 +58,12 @@ void backlight_use_settings(void)
58 backlight_timeout_plugged); 58 backlight_timeout_plugged);
59#endif /* CONFIG_CHARGING */ 59#endif /* CONFIG_CHARGING */
60} 60}
61#endif /* HAVE_BACKLIGHT */ 61#else /* HAVE_BACKLIGHT */
62/* DUMMY FUNCTIONS */
63void backlight_force_on(void){}
64void backlight_ignore_timeout(void){}
65void backlight_use_settings(void){}
66#endif /* !HAVE_BACKLIGHT */
62 67
63#ifdef HAVE_SW_POWEROFF 68#ifdef HAVE_SW_POWEROFF
64static bool original_sw_poweroff_state = true; 69static bool original_sw_poweroff_state = true;
@@ -73,7 +78,11 @@ void sw_poweroff_restore(void)
73{ 78{
74 rb->button_set_sw_poweroff_state(original_sw_poweroff_state); 79 rb->button_set_sw_poweroff_state(original_sw_poweroff_state);
75} 80}
76#endif 81#else /* HAVE_SW_POWEROFF */
82/* DUMMY FUNCTIONS */
83void sw_poweroff_disable(void){}
84void sw_poweroff_restore(void){}
85#endif /* !HAVE_SW_POWEROFF */
77 86
78#ifdef HAVE_REMOTE_LCD 87#ifdef HAVE_REMOTE_LCD
79/* Force the backlight on */ 88/* Force the backlight on */
@@ -106,7 +115,12 @@ void remote_backlight_use_settings(void)
106 remote_backlight_timeout_plugged); 115 remote_backlight_timeout_plugged);
107#endif /* CONFIG_CHARGING */ 116#endif /* CONFIG_CHARGING */
108} 117}
109#endif /* HAVE_REMOTE_LCD */ 118#else /* HAVE_REMOTE_LCD */
119/* DUMMY FUNCTIONS */
120void remote_backlight_force_on(void){}
121void remote_backlight_ignore_timeout(void){}
122void remote_backlight_use_settings(void){}
123#endif /* !HAVE_REMOTE_LCD */
110 124
111#ifdef HAVE_BUTTON_LIGHT 125#ifdef HAVE_BUTTON_LIGHT
112/* Force the buttonlight on */ 126/* Force the buttonlight on */
@@ -133,7 +147,13 @@ void buttonlight_use_settings(void)
133{ 147{
134 rb->buttonlight_set_timeout(rb->global_settings->buttonlight_timeout); 148 rb->buttonlight_set_timeout(rb->global_settings->buttonlight_timeout);
135} 149}
136#endif /* HAVE_BUTTON_LIGHT */ 150#else /* HAVE_BUTTON_LIGHT */
151/* DUMMY FUNCTIONS */
152void buttonlight_force_on(void){}
153void buttonlight_force_off(void){}
154void buttonlight_ignore_timeout(void){}
155void buttonlight_use_settings(void){}
156#endif /* !HAVE_BUTTON_LIGHT */
137 157
138#ifdef HAVE_BACKLIGHT_BRIGHTNESS 158#ifdef HAVE_BACKLIGHT_BRIGHTNESS
139void backlight_brightness_set(int brightness) 159void backlight_brightness_set(int brightness)
@@ -145,7 +165,15 @@ void backlight_brightness_use_setting(void)
145{ 165{
146 rb->backlight_set_brightness(rb->global_settings->brightness); 166 rb->backlight_set_brightness(rb->global_settings->brightness);
147} 167}
148#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ 168#else /* HAVE_BACKLIGHT_BRIGHTNESS */
169/* DUMMY FUNCTIONS */
170void backlight_brightness_set(int brightness)
171{
172 (void)brightness;
173}
174void backlight_brightness_use_setting(void){}
175
176#endif /* !HAVE_BACKLIGHT_BRIGHTNESS */
149 177
150#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS 178#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
151void buttonlight_brightness_set(int brightness) 179void buttonlight_brightness_set(int brightness)
@@ -157,4 +185,12 @@ void buttonlight_brightness_use_setting(void)
157{ 185{
158 rb->buttonlight_set_brightness(rb->global_settings->buttonlight_brightness); 186 rb->buttonlight_set_brightness(rb->global_settings->buttonlight_brightness);
159} 187}
160#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ 188#else /* HAVE_BUTTONLIGHT_BRIGHTNESS */
189/* DUMMY FUNCTIONS */
190void buttonlight_brightness_set(int brightness)
191{
192 (void)brightness;
193}
194
195void buttonlight_brightness_use_setting(void){}
196#endif /* !HAVE_BUTTONLIGHT_BRIGHTNESS */
diff --git a/apps/plugins/lib/helper.h b/apps/plugins/lib/helper.h
index 00ad8ac087..e59325d5d9 100644
--- a/apps/plugins/lib/helper.h
+++ b/apps/plugins/lib/helper.h
@@ -32,39 +32,29 @@ void backlight_force_on(void);
32void backlight_ignore_timeout(void); 32void backlight_ignore_timeout(void);
33void backlight_use_settings(void); 33void backlight_use_settings(void);
34 34
35#ifdef HAVE_SW_POWEROFF
36/** 35/**
37 * Disable and restore software poweroff (i.e. holding PLAY on iPods). 36 * Disable and restore software poweroff (i.e. holding PLAY on iPods).
38 * Only call _restore() if _disable() was called earlier! 37 * Only call _restore() if _disable() was called earlier!
39 */ 38 */
40void sw_poweroff_disable(void); 39void sw_poweroff_disable(void);
41void sw_poweroff_restore(void); 40void sw_poweroff_restore(void);
42#endif
43 41
44#ifdef HAVE_REMOTE_LCD
45void remote_backlight_force_on(void); 42void remote_backlight_force_on(void);
46void remote_backlight_ignore_timeout(void); 43void remote_backlight_ignore_timeout(void);
47void remote_backlight_use_settings(void); 44void remote_backlight_use_settings(void);
48#endif
49 45
50#ifdef HAVE_BUTTON_LIGHT
51void buttonlight_force_on(void); 46void buttonlight_force_on(void);
52void buttonlight_force_off(void); 47void buttonlight_force_off(void);
53void buttonlight_ignore_timeout(void); 48void buttonlight_ignore_timeout(void);
54void buttonlight_use_settings(void); 49void buttonlight_use_settings(void);
55#endif
56 50
57/** 51/**
58 * Backlight brightness adjustment settings 52 * Backlight brightness adjustment settings
59 */ 53 */
60#ifdef HAVE_BACKLIGHT_BRIGHTNESS
61void backlight_brightness_set(int brightness); 54void backlight_brightness_set(int brightness);
62void backlight_brightness_use_setting(void); 55void backlight_brightness_use_setting(void);
63#endif
64 56
65#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
66void buttonlight_brightness_set(int brightness); 57void buttonlight_brightness_set(int brightness);
67void buttonlight_brightness_use_setting(void); 58void buttonlight_brightness_use_setting(void);
68#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
69 59
70#endif /* _LIB_HELPER_H_ */ 60#endif /* _LIB_HELPER_H_ */
diff --git a/apps/plugins/maze.c b/apps/plugins/maze.c
index 20d5c82495..8c951ebdcc 100644
--- a/apps/plugins/maze.c
+++ b/apps/plugins/maze.c
@@ -498,10 +498,8 @@ enum plugin_status plugin_start(const void* parameter)
498 struct maze maze; 498 struct maze maze;
499 (void)parameter; 499 (void)parameter;
500 500
501#ifdef HAVE_BACKLIGHT
502 /* Turn off backlight timeout */ 501 /* Turn off backlight timeout */
503 backlight_ignore_timeout(); 502 backlight_ignore_timeout();
504#endif
505 503
506 /* Seed the RNG */ 504 /* Seed the RNG */
507 rb->srand(*rb->current_tick); 505 rb->srand(*rb->current_tick);
@@ -591,8 +589,7 @@ enum plugin_status plugin_start(const void* parameter)
591#endif 589#endif
592 } 590 }
593 /* Turn on backlight timeout (revert to settings) */ 591 /* Turn on backlight timeout (revert to settings) */
594#ifdef HAVE_BACKLIGHT
595 backlight_use_settings(); 592 backlight_use_settings();
596#endif 593
597 return ((quit == 1) ? PLUGIN_OK : PLUGIN_USB_CONNECTED); 594 return ((quit == 1) ? PLUGIN_OK : PLUGIN_USB_CONNECTED);
598} 595}
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c
index cd7b6e22a8..423b09288d 100644
--- a/apps/plugins/mazezam.c
+++ b/apps/plugins/mazezam.c
@@ -256,9 +256,7 @@ static void store_lcd_settings(void)
256******************************************************************************/ 256******************************************************************************/
257static void restore_lcd_settings(void) { 257static void restore_lcd_settings(void) {
258 /* Turn on backlight timeout (revert to settings) */ 258 /* Turn on backlight timeout (revert to settings) */
259#ifdef HAVE_BACKLIGHT
260 backlight_use_settings(); 259 backlight_use_settings();
261#endif
262 260
263 /* Restore the old settings */ 261 /* Restore the old settings */
264#if LCD_DEPTH > 1 262#if LCD_DEPTH > 1
@@ -272,10 +270,9 @@ static void restore_lcd_settings(void) {
272* Adjust the LCD settings to suit MazezaM levels 270* Adjust the LCD settings to suit MazezaM levels
273******************************************************************************/ 271******************************************************************************/
274static void plugin_lcd_settings(void) { 272static void plugin_lcd_settings(void) {
275#ifdef HAVE_BACKLIGHT
276 /* Turn off backlight timeout */ 273 /* Turn off backlight timeout */
277 backlight_ignore_timeout(); 274 backlight_ignore_timeout();
278#endif 275
279 /* Set the new settings */ 276 /* Set the new settings */
280#ifdef HAVE_LCD_COLOR 277#ifdef HAVE_LCD_COLOR
281 rb->lcd_set_background(MAZEZAM_BG_COLOR); 278 rb->lcd_set_background(MAZEZAM_BG_COLOR);
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index e66b4df146..654a348959 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -1215,10 +1215,9 @@ static void osd_lcd_enable_hook(unsigned short id, void* param)
1215static void osdbacklight_hw_on_video_mode(bool video_on) 1215static void osdbacklight_hw_on_video_mode(bool video_on)
1216{ 1216{
1217 if (video_on) { 1217 if (video_on) {
1218#ifdef HAVE_BACKLIGHT
1219 /* Turn off backlight timeout */ 1218 /* Turn off backlight timeout */
1220 backlight_ignore_timeout(); 1219 backlight_ignore_timeout();
1221#endif 1220
1222#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 1221#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
1223 rb->remove_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook); 1222 rb->remove_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook);
1224#endif 1223#endif
@@ -1226,10 +1225,8 @@ static void osdbacklight_hw_on_video_mode(bool video_on)
1226#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 1225#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
1227 rb->add_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook); 1226 rb->add_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook);
1228#endif 1227#endif
1229#ifdef HAVE_BACKLIGHT
1230 /* Revert to user's backlight settings */ 1228 /* Revert to user's backlight settings */
1231 backlight_use_settings(); 1229 backlight_use_settings();
1232#endif
1233 } 1230 }
1234} 1231}
1235 1232
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c
index ae84e14f7f..ef9e6b8a98 100644
--- a/apps/plugins/oscilloscope.c
+++ b/apps/plugins/oscilloscope.c
@@ -1939,10 +1939,9 @@ static void osc_cleanup(void)
1939 rb->lcd_set_foreground(LCD_DEFAULT_FG); 1939 rb->lcd_set_foreground(LCD_DEFAULT_FG);
1940 rb->lcd_set_background(LCD_DEFAULT_BG); 1940 rb->lcd_set_background(LCD_DEFAULT_BG);
1941#endif 1941#endif
1942#ifdef HAVE_BACKLIGHT 1942
1943 /* Turn on backlight timeout (revert to settings) */ 1943 /* Turn on backlight timeout (revert to settings) */
1944 backlight_use_settings(); 1944 backlight_use_settings();
1945#endif
1946 1945
1947 /* save settings if changed */ 1946 /* save settings if changed */
1948 if (rb->memcmp(&osc, &osc_disk, sizeof(osc))) 1947 if (rb->memcmp(&osc, &osc_disk, sizeof(osc)))
@@ -1975,10 +1974,9 @@ static void osc_setup(void)
1975 mixer_sampr = rb->mixer_get_frequency(); 1974 mixer_sampr = rb->mixer_get_frequency();
1976#endif 1975#endif
1977 1976
1978#ifdef HAVE_BACKLIGHT
1979 /* Turn off backlight timeout */ 1977 /* Turn off backlight timeout */
1980 backlight_ignore_timeout(); 1978 backlight_ignore_timeout();
1981#endif 1979
1982 graphmode_setup(); 1980 graphmode_setup();
1983} 1981}
1984 1982
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c
index 71c9751cad..9434aed743 100755
--- a/apps/plugins/pacbox/pacbox.c
+++ b/apps/plugins/pacbox/pacbox.c
@@ -809,8 +809,8 @@ enum plugin_status plugin_start(const void* parameter)
809#ifdef HAVE_ADJUSTABLE_CPU_FREQ 809#ifdef HAVE_ADJUSTABLE_CPU_FREQ
810 rb->cpu_boost(false); 810 rb->cpu_boost(false);
811#endif 811#endif
812#ifdef HAVE_BACKLIGHT 812
813 backlight_use_settings(); 813 backlight_use_settings();
814#endif 814
815 return PLUGIN_OK; 815 return PLUGIN_OK;
816} 816}
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index cdc9641f5c..7670ef01df 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -3493,10 +3493,9 @@ static void cleanup(void)
3493 rb->cpu_boost(false); 3493 rb->cpu_boost(false);
3494#endif 3494#endif
3495 end_pf_thread(); 3495 end_pf_thread();
3496#ifdef HAVE_BACKLIGHT 3496
3497 /* Turn on backlight timeout (revert to settings) */ 3497 /* Turn on backlight timeout (revert to settings) */
3498 backlight_use_settings(); 3498 backlight_use_settings();
3499#endif
3500 3499
3501#ifdef USEGSLIB 3500#ifdef USEGSLIB
3502 grey_release(); 3501 grey_release();
diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c
index f944d3d775..8da53874e1 100644
--- a/apps/plugins/plasma.c
+++ b/apps/plugins/plasma.c
@@ -140,10 +140,10 @@ static void cleanup(void)
140#ifndef HAVE_LCD_COLOR 140#ifndef HAVE_LCD_COLOR
141 grey_release(); 141 grey_release();
142#endif 142#endif
143#ifdef HAVE_BACKLIGHT 143
144 /* Turn on backlight timeout (revert to settings) */ 144 /* Turn on backlight timeout (revert to settings) */
145 backlight_use_settings(); 145 backlight_use_settings();
146#endif 146
147#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) 147#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
148 rb->lcd_set_mode(LCD_MODE_RGB565); 148 rb->lcd_set_mode(LCD_MODE_RGB565);
149#endif 149#endif
@@ -321,10 +321,10 @@ enum plugin_status plugin_start(const void* parameter)
321#if LCD_DEPTH > 1 321#if LCD_DEPTH > 1
322 rb->lcd_set_backdrop(NULL); 322 rb->lcd_set_backdrop(NULL);
323#endif 323#endif
324#ifdef HAVE_BACKLIGHT 324
325 /* Turn off backlight timeout */ 325 /* Turn off backlight timeout */
326 backlight_ignore_timeout(); 326 backlight_ignore_timeout();
327#endif 327
328#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) 328#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
329 rb->lcd_set_mode(LCD_MODE_PAL256); 329 rb->lcd_set_mode(LCD_MODE_PAL256);
330#endif 330#endif
diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c
index b49fec2459..17e6e6ed73 100644
--- a/apps/plugins/pong.c
+++ b/apps/plugins/pong.c
@@ -750,10 +750,9 @@ enum plugin_status plugin_start(const void* parameter)
750 this to avoid the compiler warning about it */ 750 this to avoid the compiler warning about it */
751 (void)parameter; 751 (void)parameter;
752 752
753#ifdef HAVE_BACKLIGHT
754 /* Turn off backlight timeout */ 753 /* Turn off backlight timeout */
755 backlight_ignore_timeout(); 754 backlight_ignore_timeout();
756#endif 755
757 /* Clear screen */ 756 /* Clear screen */
758 rb->lcd_clear_display(); 757 rb->lcd_clear_display();
759 758
@@ -792,9 +791,9 @@ enum plugin_status plugin_start(const void* parameter)
792 rb->lcd_clear_display(); 791 rb->lcd_clear_display();
793 } 792 }
794 } 793 }
795#ifdef HAVE_BACKLIGHT 794
796 /* Turn on backlight timeout (revert to settings) */ 795 /* Turn on backlight timeout (revert to settings) */
797 backlight_use_settings(); 796 backlight_use_settings();
798#endif 797
799 return (game == 0) ? PLUGIN_OK : PLUGIN_USB_CONNECTED; 798 return (game == 0) ? PLUGIN_OK : PLUGIN_USB_CONNECTED;
800} 799}
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c
index 563820ba23..e175429075 100644
--- a/apps/plugins/puzzles/rockbox.c
+++ b/apps/plugins/puzzles/rockbox.c
@@ -3390,9 +3390,7 @@ static void shutdown_tlsf(void)
3390 3390
3391static void exit_handler(void) 3391static void exit_handler(void)
3392{ 3392{
3393#ifdef HAVE_SW_POWEROFF
3394 sw_poweroff_restore(); 3393 sw_poweroff_restore();
3395#endif
3396 3394
3397 unload_fonts(); 3395 unload_fonts();
3398 shutdown_tlsf(); 3396 shutdown_tlsf();
@@ -3652,9 +3650,7 @@ static void puzzles_main(void)
3652{ 3650{
3653 rb_atexit(exit_handler); 3651 rb_atexit(exit_handler);
3654 3652
3655#ifdef HAVE_SW_POWEROFF
3656 sw_poweroff_disable(); 3653 sw_poweroff_disable();
3657#endif
3658 3654
3659 init_default_settings(); 3655 init_default_settings();
3660 init_fonttab(); 3656 init_fonttab();
diff --git a/apps/plugins/resistor.c b/apps/plugins/resistor.c
index d32ac3fad9..4461dc0dea 100644
--- a/apps/plugins/resistor.c
+++ b/apps/plugins/resistor.c
@@ -574,9 +574,8 @@ static void display_helpfile(void)
574 574
575static void led_resistance_calc(void) 575static void led_resistance_calc(void)
576{ 576{
577#ifdef HAVE_BACKLIGHT
578 backlight_ignore_timeout(); 577 backlight_ignore_timeout();
579#endif 578
580 int voltage_menu_selection, button_press, j, k, l, foreward_current = 0; 579 int voltage_menu_selection, button_press, j, k, l, foreward_current = 0;
581 int fwd_current_selection = 0; 580 int fwd_current_selection = 0;
582 bool quit = false; 581 bool quit = false;
@@ -769,9 +768,8 @@ static void led_resistance_calc(void)
769 default: 768 default:
770 quit = true; 769 quit = true;
771 770
772#ifdef HAVE_BACKLIGHT
773 backlight_use_settings(); 771 backlight_use_settings();
774#endif 772
775 break; 773 break;
776 } 774 }
777 } 775 }
@@ -784,9 +782,8 @@ static void led_resistance_calc(void)
784 782
785static void resistance_to_color(void) 783static void resistance_to_color(void)
786{ 784{
787#ifdef HAVE_BACKLIGHT
788 backlight_ignore_timeout(); 785 backlight_ignore_timeout();
789#endif 786
790 int menu_selection; 787 int menu_selection;
791 int menu_selection_tol; 788 int menu_selection_tol;
792 int button_press; 789 int button_press;
@@ -910,9 +907,9 @@ static void resistance_to_color(void)
910 break; 907 break;
911 default: 908 default:
912 quit = true; 909 quit = true;
913#ifdef HAVE_BACKLIGHT 910
914 backlight_use_settings(); 911 backlight_use_settings();
915#endif 912
916 break; 913 break;
917 } 914 }
918 } 915 }
@@ -924,9 +921,8 @@ static void resistance_to_color(void)
924 921
925static void color_to_resistance(void) 922static void color_to_resistance(void)
926{ 923{
927#ifdef HAVE_BACKLIGHT
928 backlight_ignore_timeout(); 924 backlight_ignore_timeout();
929#endif 925
930 bool quit = false; 926 bool quit = false;
931 int button_input = 0; 927 int button_input = 0;
932 928
@@ -995,9 +991,7 @@ static void color_to_resistance(void)
995 case PLA_SELECT: 991 case PLA_SELECT:
996 default: 992 default:
997 quit = true; 993 quit = true;
998#ifdef HAVE_BACKLIGHT
999 backlight_use_settings(); 994 backlight_use_settings();
1000#endif
1001 break; 995 break;
1002 } 996 }
1003 } 997 }
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index 927710b37b..cc719e5067 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -1498,16 +1498,13 @@ static int rockblox_loop (void)
1498#ifdef HAS_BUTTON_HOLD 1498#ifdef HAS_BUTTON_HOLD
1499 if (rb->button_hold ()) { 1499 if (rb->button_hold ()) {
1500 /* Turn on backlight timeout (revert to settings) */ 1500 /* Turn on backlight timeout (revert to settings) */
1501#ifdef HAVE_BACKLIGHT
1502 backlight_use_settings(); 1501 backlight_use_settings();
1503#endif
1504 rb->splash(0, "Paused"); 1502 rb->splash(0, "Paused");
1505 while (rb->button_hold ()) 1503 while (rb->button_hold ())
1506 rb->sleep(HZ/10); 1504 rb->sleep(HZ/10);
1507#ifdef HAVE_BACKLIGHT
1508 /* Turn off backlight timeout */ 1505 /* Turn off backlight timeout */
1509 backlight_ignore_timeout(); 1506 backlight_ignore_timeout();
1510#endif 1507
1511 /* get rid of the splash text */ 1508 /* get rid of the splash text */
1512 rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); 1509 rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT);
1513 show_details (); 1510 show_details ();
@@ -1677,10 +1674,9 @@ enum plugin_status plugin_start (const void *parameter)
1677 1674
1678 rb->lcd_setfont (FONT_SYSFIXED); 1675 rb->lcd_setfont (FONT_SYSFIXED);
1679 1676
1680#ifdef HAVE_BACKLIGHT
1681 /* Turn off backlight timeout */ 1677 /* Turn off backlight timeout */
1682 backlight_ignore_timeout(); 1678 backlight_ignore_timeout();
1683#endif 1679
1684 load_game(); 1680 load_game();
1685 resume_file = resume; 1681 resume_file = resume;
1686 1682
@@ -1728,9 +1724,8 @@ enum plugin_status plugin_start (const void *parameter)
1728 1724
1729 /* Save user's HighScore */ 1725 /* Save user's HighScore */
1730 highscore_save(SCORE_FILE, highscores, NUM_SCORES); 1726 highscore_save(SCORE_FILE, highscores, NUM_SCORES);
1731#ifdef HAVE_BACKLIGNT 1727
1732 backlight_use_settings(); 1728 backlight_use_settings();
1733#endif
1734 1729
1735 return PLUGIN_OK; 1730 return PLUGIN_OK;
1736} 1731}
diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c
index 6fafdc11a6..caa8d499cb 100644
--- a/apps/plugins/rockboy/menu.c
+++ b/apps/plugins/rockboy/menu.c
@@ -83,9 +83,8 @@ int do_user_menu(void) {
83 rb->lcd_set_mode(LCD_MODE_RGB565); 83 rb->lcd_set_mode(LCD_MODE_RGB565);
84#endif 84#endif
85 85
86#ifdef HAVE_BACKLIGHT
87 backlight_use_settings(); 86 backlight_use_settings();
88#endif 87
89 /* Clean out the button Queue */ 88 /* Clean out the button Queue */
90 while (rb->button_get(false) != BUTTON_NONE) 89 while (rb->button_get(false) != BUTTON_NONE)
91 rb->yield(); 90 rb->yield();
@@ -139,10 +138,9 @@ int do_user_menu(void) {
139 rb->lcd_set_mode(LCD_MODE_PAL256); 138 rb->lcd_set_mode(LCD_MODE_PAL256);
140#endif 139#endif
141 140
142#ifdef HAVE_BACKLIGHT
143 /* ignore backlight time out */ 141 /* ignore backlight time out */
144 backlight_ignore_timeout(); 142 backlight_ignore_timeout();
145#endif 143
146 return ret; 144 return ret;
147} 145}
148 146
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index 2c5c6e4dbf..2d0c349507 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -602,10 +602,9 @@ enum plugin_status plugin_start(const void* parameter)
602 rb->lcd_set_mode(LCD_MODE_PAL256); 602 rb->lcd_set_mode(LCD_MODE_PAL256);
603#endif 603#endif
604 604
605#ifdef HAVE_BACKLIGHT
606 /* ignore backlight time out */ 605 /* ignore backlight time out */
607 backlight_ignore_timeout(); 606 backlight_ignore_timeout();
608#endif 607
609 gnuboy_main(parameter); 608 gnuboy_main(parameter);
610 609
611#ifdef HAVE_WHEEL_POSITION 610#ifdef HAVE_WHEEL_POSITION
@@ -616,9 +615,7 @@ enum plugin_status plugin_start(const void* parameter)
616 rb->lcd_set_mode(LCD_MODE_RGB565); 615 rb->lcd_set_mode(LCD_MODE_RGB565);
617#endif 616#endif
618 617
619#ifdef HAVE_BACKLIGHT
620 backlight_use_settings(); 618 backlight_use_settings();
621#endif
622 619
623 if(!rb->audio_status()) 620 if(!rb->audio_status())
624 rockboy_pcm_close(); 621 rockboy_pcm_close();
diff --git a/apps/plugins/rocklife.c b/apps/plugins/rocklife.c
index 99297abd0f..bed947cc71 100644
--- a/apps/plugins/rocklife.c
+++ b/apps/plugins/rocklife.c
@@ -474,9 +474,8 @@ enum plugin_status plugin_start(const void* parameter)
474 char *ptemp; 474 char *ptemp;
475 (void)(parameter); 475 (void)(parameter);
476 476
477#ifdef HAVE_BACKLIGHT
478 backlight_ignore_timeout(); 477 backlight_ignore_timeout();
479#endif 478
480#if LCD_DEPTH > 1 479#if LCD_DEPTH > 1
481 rb->lcd_set_backdrop(NULL); 480 rb->lcd_set_backdrop(NULL);
482#ifdef HAVE_LCD_COLOR 481#ifdef HAVE_LCD_COLOR
@@ -580,8 +579,7 @@ enum plugin_status plugin_start(const void* parameter)
580 rb->yield(); 579 rb->yield();
581 } 580 }
582 581
583#ifdef HAVE_BACKLIGHT
584 backlight_use_settings(); 582 backlight_use_settings();
585#endif 583
586 return usb? PLUGIN_USB_CONNECTED: PLUGIN_OK; 584 return usb? PLUGIN_USB_CONNECTED: PLUGIN_OK;
587} 585}
diff --git a/apps/plugins/sdl/main.c b/apps/plugins/sdl/main.c
index 6efb072faf..7220c7cfd9 100644
--- a/apps/plugins/sdl/main.c
+++ b/apps/plugins/sdl/main.c
@@ -64,9 +64,8 @@ void cleanup(void)
64 if(audiobuf) 64 if(audiobuf)
65 memset(audiobuf, 0, 4); /* clear */ 65 memset(audiobuf, 0, 4); /* clear */
66 66
67#ifdef HAVE_BACKLIGHT
68 backlight_use_settings(); 67 backlight_use_settings();
69#endif 68
70#ifdef HAVE_ADJUSTABLE_CPU_FREQ 69#ifdef HAVE_ADJUSTABLE_CPU_FREQ
71 rb->cpu_boost(false); 70 rb->cpu_boost(false);
72#endif 71#endif
@@ -219,9 +218,9 @@ enum plugin_status plugin_start(const void *param)
219#ifdef HAVE_ADJUSTABLE_CPU_FREQ 218#ifdef HAVE_ADJUSTABLE_CPU_FREQ
220 rb->cpu_boost(true); 219 rb->cpu_boost(true);
221#endif 220#endif
222#ifdef HAVE_BACKLIGHT 221
223 backlight_ignore_timeout(); 222 backlight_ignore_timeout();
224#endif 223
225 /* set the real exit handler */ 224 /* set the real exit handler */
226#undef rb_atexit 225#undef rb_atexit
227 rb_atexit(cleanup); 226 rb_atexit(cleanup);
diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c
index 1099672c4c..85beccb1c2 100644
--- a/apps/plugins/spacerocks.c
+++ b/apps/plugins/spacerocks.c
@@ -2128,10 +2128,10 @@ enum plugin_status plugin_start(const void* parameter)
2128#endif 2128#endif
2129 /* universal font */ 2129 /* universal font */
2130 rb->lcd_setfont(FONT_SYSFIXED); 2130 rb->lcd_setfont(FONT_SYSFIXED);
2131#ifdef HAVE_BACKLIGHT 2131
2132 /* Turn off backlight timeout */ 2132 /* Turn off backlight timeout */
2133 backlight_ignore_timeout(); 2133 backlight_ignore_timeout();
2134#endif 2134
2135 highscore_load(SCORE_FILE, highscores, NUM_SCORES); 2135 highscore_load(SCORE_FILE, highscores, NUM_SCORES);
2136 rb->srand(*rb->current_tick); 2136 rb->srand(*rb->current_tick);
2137 2137
@@ -2143,10 +2143,9 @@ enum plugin_status plugin_start(const void* parameter)
2143 2143
2144 rb->lcd_setfont(FONT_UI); 2144 rb->lcd_setfont(FONT_UI);
2145 highscore_save(SCORE_FILE, highscores, NUM_SCORES); 2145 highscore_save(SCORE_FILE, highscores, NUM_SCORES);
2146#ifdef HAVE_BACKLIGHT 2146
2147 /* Turn on backlight timeout (revert to settings) */ 2147 /* Turn on backlight timeout (revert to settings) */
2148 backlight_use_settings(); 2148 backlight_use_settings();
2149#endif
2150 2149
2151 return ret; 2150 return ret;
2152} 2151}
diff --git a/apps/plugins/speedread.c b/apps/plugins/speedread.c
index 42634fb536..55d8fd58e5 100644
--- a/apps/plugins/speedread.c
+++ b/apps/plugins/speedread.c
@@ -141,9 +141,9 @@ static void cleanup(void)
141{ 141{
142 if(custom_font != FONT_UI) 142 if(custom_font != FONT_UI)
143 rb->font_unload(custom_font); 143 rb->font_unload(custom_font);
144#ifdef HAVE_BACKLIGHT 144
145 backlight_use_settings(); 145 backlight_use_settings();
146#endif 146
147} 147}
148 148
149/* returns height of drawn area */ 149/* returns height of drawn area */
@@ -302,9 +302,8 @@ static void begin_anim(void)
302 302
303static void init_drawing(void) 303static void init_drawing(void)
304{ 304{
305#ifdef HAVE_BACKLIGHT
306 backlight_ignore_timeout(); 305 backlight_ignore_timeout();
307#endif 306
308 atexit(cleanup); 307 atexit(cleanup);
309 308
310 rb->lcd_set_background(OUTSIDE_COLOR); 309 rb->lcd_set_background(OUTSIDE_COLOR);
diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c
index 7fc400d0ee..39ed8a8171 100644
--- a/apps/plugins/starfield.c
+++ b/apps/plugins/starfield.c
@@ -324,14 +324,14 @@ enum plugin_status plugin_start(const void* parameter)
324 int ret; 324 int ret;
325 325
326 (void)parameter; 326 (void)parameter;
327#ifdef HAVE_BACKLIGHT 327
328 /* Turn off backlight timeout */ 328 /* Turn off backlight timeout */
329 backlight_ignore_timeout(); 329 backlight_ignore_timeout();
330#endif 330
331 ret = plugin_main(); 331 ret = plugin_main();
332#ifdef HAVE_BACKLIGHT 332
333 /* Turn on backlight timeout (revert to settings) */ 333 /* Turn on backlight timeout (revert to settings) */
334 backlight_use_settings(); 334 backlight_use_settings();
335#endif 335
336 return ret; 336 return ret;
337} 337}
diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c
index 1429668556..fee6c4d0b0 100644
--- a/apps/plugins/test_disk.c
+++ b/apps/plugins/test_disk.c
@@ -467,10 +467,9 @@ enum plugin_status plugin_start(const void* parameter)
467 467
468 rb->srand(*rb->current_tick); 468 rb->srand(*rb->current_tick);
469 469
470#ifdef HAVE_BACKLIGHT
471 /* Turn off backlight timeout */ 470 /* Turn off backlight timeout */
472 backlight_ignore_timeout(); 471 backlight_ignore_timeout();
473#endif 472
474 473
475 while(!quit) 474 while(!quit)
476 { 475 {
@@ -489,9 +488,8 @@ enum plugin_status plugin_start(const void* parameter)
489 } 488 }
490 489
491 /* Turn on backlight timeout (revert to settings) */ 490 /* Turn on backlight timeout (revert to settings) */
492#ifdef HAVE_BACKLIGHT
493 backlight_use_settings(); 491 backlight_use_settings();
494#endif 492
495 rb->rmdir(testbasedir); 493 rb->rmdir(testbasedir);
496 494
497 return PLUGIN_OK; 495 return PLUGIN_OK;
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c
index ddf938ac25..2f4e9bb13e 100644
--- a/apps/plugins/test_fps.c
+++ b/apps/plugins/test_fps.c
@@ -401,9 +401,9 @@ enum plugin_status plugin_start(const void* parameter)
401#if (CONFIG_PLATFORM & PLATFORM_NATIVE) 401#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
402 cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */ 402 cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */
403#endif 403#endif
404#ifdef HAVE_BACKLIGHT 404
405 backlight_ignore_timeout(); 405 backlight_ignore_timeout();
406#endif 406
407 time_main_update(); 407 time_main_update();
408 rb->sleep(HZ); 408 rb->sleep(HZ);
409#if defined(HAVE_LCD_COLOR) && (MEMORYSIZE > 2) 409#if defined(HAVE_LCD_COLOR) && (MEMORYSIZE > 2)
@@ -424,9 +424,9 @@ enum plugin_status plugin_start(const void* parameter)
424 (cpu_freq + 500000) / 1000000); 424 (cpu_freq + 500000) / 1000000);
425 log_text(str); 425 log_text(str);
426#endif 426#endif
427#ifdef HAVE_BACKLIGHT 427
428 backlight_use_settings(); 428 backlight_use_settings();
429#endif 429
430 /* wait until user closes plugin */ 430 /* wait until user closes plugin */
431 plugin_quit(); 431 plugin_quit();
432 432
diff --git a/apps/plugins/test_gfx.c b/apps/plugins/test_gfx.c
index 7734179159..60e2836463 100644
--- a/apps/plugins/test_gfx.c
+++ b/apps/plugins/test_gfx.c
@@ -495,9 +495,9 @@ enum plugin_status plugin_start(const void* parameter)
495 rb->lcd_set_backdrop(NULL); 495 rb->lcd_set_backdrop(NULL);
496 rb->lcd_clear_display(); 496 rb->lcd_clear_display();
497#endif 497#endif
498#ifdef HAVE_BACKLIGHT 498
499 backlight_ignore_timeout(); 499 backlight_ignore_timeout();
500#endif 500
501 rb->splashf(0, "LCD driver performance test, please wait %d sec", 501 rb->splashf(0, "LCD driver performance test, please wait %d sec",
502 7*4*DURATION/HZ); 502 7*4*DURATION/HZ);
503 init_rand_table(); 503 init_rand_table();
@@ -522,9 +522,9 @@ enum plugin_status plugin_start(const void* parameter)
522 (cpu_freq + 500000) / 1000000); 522 (cpu_freq + 500000) / 1000000);
523#endif 523#endif
524 rb->close(log_fd); 524 rb->close(log_fd);
525#ifdef HAVE_BACKLIGHT 525
526 backlight_use_settings(); 526 backlight_use_settings();
527#endif 527
528#ifdef TEST_GREYLIB 528#ifdef TEST_GREYLIB
529 grey_release(); 529 grey_release();
530#endif 530#endif
diff --git a/apps/plugins/test_grey.c b/apps/plugins/test_grey.c
index 121cbad051..07fda1b9c6 100644
--- a/apps/plugins/test_grey.c
+++ b/apps/plugins/test_grey.c
@@ -123,9 +123,9 @@ enum plugin_status plugin_start(const void* parameter)
123 } 123 }
124 for (i = 0; i <= STEPS; i++) 124 for (i = 0; i <= STEPS; i++)
125 input_levels[i] = lcd_levels[i] = (255 * i + (STEPS/2)) / STEPS; 125 input_levels[i] = lcd_levels[i] = (255 * i + (STEPS/2)) / STEPS;
126#ifdef HAVE_BACKLIGHT 126
127 backlight_ignore_timeout(); 127 backlight_ignore_timeout();
128#endif 128
129 grey_set_background(0); /* set background to black */ 129 grey_set_background(0); /* set background to black */
130 grey_clear_display(); 130 grey_clear_display();
131 grey_show(true); 131 grey_show(true);
@@ -221,8 +221,8 @@ enum plugin_status plugin_start(const void* parameter)
221 } 221 }
222 222
223 grey_release(); 223 grey_release();
224#ifdef HAVE_BACKLIGHT 224
225 backlight_use_settings(); 225 backlight_use_settings();
226#endif 226
227 return PLUGIN_OK; 227 return PLUGIN_OK;
228} 228}
diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c
index 162cea6208..c09ef48bdc 100644
--- a/apps/plugins/wormlet.c
+++ b/apps/plugins/wormlet.c
@@ -2428,10 +2428,9 @@ static bool launch_wormlet(void)
2428 2428
2429 rb->lcd_clear_display(); 2429 rb->lcd_clear_display();
2430 2430
2431#ifdef HAVE_BACKLIGHT
2432 /* Turn off backlight timeout */ 2431 /* Turn off backlight timeout */
2433 backlight_ignore_timeout(); 2432 backlight_ignore_timeout();
2434#endif 2433
2435 /* start the game */ 2434 /* start the game */
2436 while (game_result == 1) 2435 while (game_result == 1)
2437 game_result = run(); 2436 game_result = run();
@@ -2439,10 +2438,10 @@ static bool launch_wormlet(void)
2439 switch (game_result) 2438 switch (game_result)
2440 { 2439 {
2441 case 2: 2440 case 2:
2442#ifdef HAVE_BACKLIGHT 2441
2443 /* Turn on backlight timeout (revert to settings) */ 2442 /* Turn on backlight timeout (revert to settings) */
2444 backlight_use_settings(); 2443 backlight_use_settings();
2445#endif 2444
2446 return false; 2445 return false;
2447 break; 2446 break;
2448 } 2447 }
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c
index b8b1964db4..c7499fed7a 100644
--- a/apps/plugins/xobox.c
+++ b/apps/plugins/xobox.c
@@ -1297,10 +1297,9 @@ enum plugin_status plugin_start (const void *parameter)
1297 rb->lcd_set_backdrop(NULL); 1297 rb->lcd_set_backdrop(NULL);
1298#endif 1298#endif
1299 1299
1300#ifdef HAVE_BACKLIGHT
1301 /* Turn off backlight timeout */ 1300 /* Turn off backlight timeout */
1302 backlight_ignore_timeout(); 1301 backlight_ignore_timeout();
1303#endif 1302
1304 highscore_load(SCORE_FILE, highscores, NUM_SCORES); 1303 highscore_load(SCORE_FILE, highscores, NUM_SCORES);
1305 1304
1306 if (!load_game()) { 1305 if (!load_game()) {
@@ -1310,10 +1309,10 @@ enum plugin_status plugin_start (const void *parameter)
1310 randomize (); 1309 randomize ();
1311 ret = xobox_loop (); 1310 ret = xobox_loop ();
1312 1311
1313#ifdef HAVE_BACKLIGHT 1312
1314 /* Turn on backlight timeout (revert to settings) */ 1313 /* Turn on backlight timeout (revert to settings) */
1315 backlight_use_settings(); 1314 backlight_use_settings();
1316#endif 1315
1317 rb->lcd_setfont (FONT_UI); 1316 rb->lcd_setfont (FONT_UI);
1318 1317
1319 highscore_save(SCORE_FILE, highscores, NUM_SCORES); 1318 highscore_save(SCORE_FILE, highscores, NUM_SCORES);
diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c
index a806de5297..ece9d87b66 100644
--- a/apps/plugins/xworld/sys.c
+++ b/apps/plugins/xworld/sys.c
@@ -122,9 +122,8 @@ void exit_handler(void)
122#ifdef HAVE_ADJUSTABLE_CPU_FREQ 122#ifdef HAVE_ADJUSTABLE_CPU_FREQ
123 rb->cpu_boost(false); 123 rb->cpu_boost(false);
124#endif 124#endif
125#ifdef HAVE_BACKLIGHT 125
126 backlight_use_settings(); 126 backlight_use_settings();
127#endif
128} 127}
129 128
130static bool sys_do_help(void) 129static bool sys_do_help(void)
@@ -428,9 +427,8 @@ void sys_menu(struct System* sys)
428void sys_init(struct System* sys, const char* title) 427void sys_init(struct System* sys, const char* title)
429{ 428{
430 (void) title; 429 (void) title;
431#ifdef HAVE_BACKLIGHT 430
432 backlight_ignore_timeout(); 431 backlight_ignore_timeout();
433#endif
434 rb_atexit(exit_handler); 432 rb_atexit(exit_handler);
435 save_sys = sys; 433 save_sys = sys;
436 rb->memset(&sys->input, 0, sizeof(sys->input)); 434 rb->memset(&sys->input, 0, sizeof(sys->input));