plugins HAVE_BACKLIGHT helper remove ifdefs in favor of dummy functions

lessen the ifdef hell

Change-Id: I52f830284e4599f3fc3a75c27dda27058b8de1a3
This commit is contained in:
William Wilgus 2022-11-23 23:00:29 -05:00
parent 3745c813f9
commit 97a82ee3ec
38 changed files with 140 additions and 178 deletions

View file

@ -148,9 +148,7 @@ static inline int rand_range(int min, int max)
/* prepares for exit */ /* prepares for exit */
static void cleanup(void) static void cleanup(void)
{ {
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
} }
/* returns 2 or 4 */ /* returns 2 or 4 */
@ -700,9 +698,8 @@ static void init_game(bool newgame)
max_numeral_width = rb->font_get_width(rb->font_get(WHAT_FONT), '0'); max_numeral_width = rb->font_get_width(rb->font_get(WHAT_FONT), '0');
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
draw(); draw();
} }

View file

@ -2533,10 +2533,10 @@ enum plugin_status plugin_start(const void* parameter)
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
#endif #endif
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
/* now go ahead and have fun! */ /* now go ahead and have fun! */
rb->srand( *rb->current_tick ); rb->srand( *rb->current_tick );
brickmania_loadgame(); brickmania_loadgame();
@ -2565,9 +2565,9 @@ enum plugin_status plugin_start(const void* parameter)
configfile_save(CONFIG_FILE_NAME,config,1,0); configfile_save(CONFIG_FILE_NAME,config,1,0);
/* Restore user's original backlight setting */ /* Restore user's original backlight setting */
rb->lcd_setfont(FONT_UI); rb->lcd_setfont(FONT_UI);
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
return PLUGIN_OK; return PLUGIN_OK;
} }

View file

@ -1083,10 +1083,10 @@ enum plugin_status plugin_start(const void* parameter)
rb->lcd_set_foreground(LCD_WHITE); rb->lcd_set_foreground(LCD_WHITE);
#endif #endif
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
rb->srand( *rb->current_tick ); rb->srand( *rb->current_tick );
@ -1098,10 +1098,10 @@ enum plugin_status plugin_start(const void* parameter)
configfile_save(CFG_FILE, config, 1, 0); configfile_save(CFG_FILE, config, 1, 0);
rb->lcd_setfont(FONT_UI); rb->lcd_setfont(FONT_UI);
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
return ret; return ret;
} }

View file

@ -303,10 +303,10 @@ enum plugin_status plugin_start(const void* parameter)
{ {
(void)parameter; (void)parameter;
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
#if LCD_DEPTH>=16 #if LCD_DEPTH>=16
rb->lcd_set_foreground (LCD_WHITE); rb->lcd_set_foreground (LCD_WHITE);
@ -318,10 +318,10 @@ enum plugin_status plugin_start(const void* parameter)
if(!rb->action_userabort(3*HZ)) if(!rb->action_userabort(3*HZ))
roll_credits(); roll_credits();
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
return PLUGIN_OK; return PLUGIN_OK;
} }

View file

@ -262,12 +262,10 @@ static void polygons_draw(struct polygon_fifo * polygons, struct screen * displa
static void cleanup(void) static void cleanup(void)
{ {
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#ifdef HAVE_REMOTE_LCD
remote_backlight_use_settings(); remote_backlight_use_settings();
#endif
#endif
} }
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
@ -438,12 +436,10 @@ enum plugin_status plugin_start(const void* parameter)
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#ifdef HAVE_REMOTE_LCD
remote_backlight_ignore_timeout(); remote_backlight_ignore_timeout();
#endif
#endif
ret = plugin_main(); ret = plugin_main();
return ret; return ret;

View file

@ -722,9 +722,9 @@ enum plugin_status plugin_start(const void* parameter)
systemvol= rb->global_settings->volume-rb->global_settings->volume%mod; systemvol= rb->global_settings->volume-rb->global_settings->volume%mod;
general_translucency = default_translucency; // phares general_translucency = default_translucency; // phares
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
#ifdef RB_PROFILE #ifdef RB_PROFILE
rb->profile_thread(); rb->profile_thread();
#endif #endif
@ -738,9 +738,9 @@ enum plugin_status plugin_start(const void* parameter)
#ifdef RB_PROFILE #ifdef RB_PROFILE
rb->profstop(); rb->profstop();
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
M_SaveDefaults (); M_SaveDefaults ();
I_Quit(); // Make SURE everything was closed out right I_Quit(); // Make SURE everything was closed out right

View file

@ -1184,9 +1184,8 @@ static void fft_cleanup(void)
#ifndef HAVE_LCD_COLOR #ifndef HAVE_LCD_COLOR
grey_release(); grey_release();
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
/* save settings if changed */ /* save settings if changed */
if (rb->memcmp(&fft, &fft_disk, sizeof(fft))) if (rb->memcmp(&fft, &fft_disk, sizeof(fft)))
@ -1237,9 +1236,8 @@ static bool fft_setup(void)
mylcd_clear_display(); mylcd_clear_display();
myosd_lcd_update(); myosd_lcd_update();
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->trigger_cpu_boost(); rb->trigger_cpu_boost();

View file

@ -279,10 +279,9 @@ static void cleanup(void *parameter)
#ifndef HAVE_LCD_COLOR #ifndef HAVE_LCD_COLOR
grey_release(); grey_release();
#endif #endif
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
} }
@ -371,10 +370,9 @@ enum plugin_status plugin_start(const void* parameter)
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
#endif #endif
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
rb->lcd_set_mode(LCD_MODE_PAL256); rb->lcd_set_mode(LCD_MODE_PAL256);

View file

@ -358,9 +358,9 @@ enum plugin_status plugin_start(const void* parameter)
/* set everything up.. no BL timeout, no backdrop, /* set everything up.. no BL timeout, no backdrop,
white-text-on-black-background. */ white-text-on-black-background. */
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
rb->lcd_set_background(LCD_BLACK); rb->lcd_set_background(LCD_BLACK);
@ -524,10 +524,10 @@ enum plugin_status plugin_start(const void* parameter)
break; break;
} }
} }
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false); rb->cpu_boost(false);
#endif #endif

View file

@ -1064,10 +1064,8 @@ enum plugin_status plugin_start(const void* parameter)
ARRAYLEN(config), IMGVIEW_SETTINGS_MINVERSION); ARRAYLEN(config), IMGVIEW_SETTINGS_MINVERSION);
rb->memcpy(&old_settings, &settings, sizeof (settings)); rb->memcpy(&old_settings, &settings, sizeof (settings));
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
@ -1094,10 +1092,8 @@ enum plugin_status plugin_start(const void* parameter)
rb->storage_spindown(rb->global_settings->disk_spindown); rb->storage_spindown(rb->global_settings->disk_spindown);
#endif #endif
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
#ifdef USEGSLIB #ifdef USEGSLIB
grey_release(); /* deinitialize */ grey_release(); /* deinitialize */

View file

@ -103,9 +103,8 @@ enum plugin_status plugin_start(const void* parameter)
int current_brightness = MAX_BRIGHTNESS_SETTING; int current_brightness = MAX_BRIGHTNESS_SETTING;
backlight_brightness_set(MAX_BRIGHTNESS_SETTING); backlight_brightness_set(MAX_BRIGHTNESS_SETTING);
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ #endif /* HAVE_BACKLIGHT_BRIGHTNESS */
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
buttonlight_brightness_set(MAX_BRIGHTNESS_SETTING); buttonlight_brightness_set(MAX_BRIGHTNESS_SETTING);
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#ifdef HAVE_LCD_INVERT #ifdef HAVE_LCD_INVERT
#ifdef HAVE_NEGATIVE_LCD #ifdef HAVE_NEGATIVE_LCD
@ -116,9 +115,8 @@ enum plugin_status plugin_start(const void* parameter)
#endif /* HAVE_LCD_INVERT */ #endif /* HAVE_LCD_INVERT */
backlight_force_on(); backlight_force_on();
#ifdef HAVE_BUTTON_LIGHT
buttonlight_force_on(); buttonlight_force_on();
#endif /* HAVE_BUTTON_LIGHT */
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->lcd_update(); rb->lcd_update();
@ -207,20 +205,17 @@ enum plugin_status plugin_start(const void* parameter)
/* restore */ /* restore */
backlight_use_settings(); backlight_use_settings();
#ifdef HAVE_BUTTON_LIGHT
buttonlight_use_settings(); buttonlight_use_settings();
#endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_LCD_INVERT #ifdef HAVE_LCD_INVERT
rb->lcd_set_invert_display(rb->global_settings->invert); rb->lcd_set_invert_display(rb->global_settings->invert);
#endif /* HAVE_LCD_INVERT */ #endif /* HAVE_LCD_INVERT */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
backlight_brightness_use_setting(); backlight_brightness_use_setting();
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
buttonlight_brightness_use_setting(); buttonlight_brightness_use_setting();
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_background(bg_color); rb->lcd_set_background(bg_color);

View file

@ -58,7 +58,12 @@ void backlight_use_settings(void)
backlight_timeout_plugged); backlight_timeout_plugged);
#endif /* CONFIG_CHARGING */ #endif /* CONFIG_CHARGING */
} }
#endif /* HAVE_BACKLIGHT */ #else /* HAVE_BACKLIGHT */
/* DUMMY FUNCTIONS */
void backlight_force_on(void){}
void backlight_ignore_timeout(void){}
void backlight_use_settings(void){}
#endif /* !HAVE_BACKLIGHT */
#ifdef HAVE_SW_POWEROFF #ifdef HAVE_SW_POWEROFF
static bool original_sw_poweroff_state = true; static bool original_sw_poweroff_state = true;
@ -73,7 +78,11 @@ void sw_poweroff_restore(void)
{ {
rb->button_set_sw_poweroff_state(original_sw_poweroff_state); rb->button_set_sw_poweroff_state(original_sw_poweroff_state);
} }
#endif #else /* HAVE_SW_POWEROFF */
/* DUMMY FUNCTIONS */
void sw_poweroff_disable(void){}
void sw_poweroff_restore(void){}
#endif /* !HAVE_SW_POWEROFF */
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
/* Force the backlight on */ /* Force the backlight on */
@ -106,7 +115,12 @@ void remote_backlight_use_settings(void)
remote_backlight_timeout_plugged); remote_backlight_timeout_plugged);
#endif /* CONFIG_CHARGING */ #endif /* CONFIG_CHARGING */
} }
#endif /* HAVE_REMOTE_LCD */ #else /* HAVE_REMOTE_LCD */
/* DUMMY FUNCTIONS */
void remote_backlight_force_on(void){}
void remote_backlight_ignore_timeout(void){}
void remote_backlight_use_settings(void){}
#endif /* !HAVE_REMOTE_LCD */
#ifdef HAVE_BUTTON_LIGHT #ifdef HAVE_BUTTON_LIGHT
/* Force the buttonlight on */ /* Force the buttonlight on */
@ -133,7 +147,13 @@ void buttonlight_use_settings(void)
{ {
rb->buttonlight_set_timeout(rb->global_settings->buttonlight_timeout); rb->buttonlight_set_timeout(rb->global_settings->buttonlight_timeout);
} }
#endif /* HAVE_BUTTON_LIGHT */ #else /* HAVE_BUTTON_LIGHT */
/* DUMMY FUNCTIONS */
void buttonlight_force_on(void){}
void buttonlight_force_off(void){}
void buttonlight_ignore_timeout(void){}
void buttonlight_use_settings(void){}
#endif /* !HAVE_BUTTON_LIGHT */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS #ifdef HAVE_BACKLIGHT_BRIGHTNESS
void backlight_brightness_set(int brightness) void backlight_brightness_set(int brightness)
@ -145,7 +165,15 @@ void backlight_brightness_use_setting(void)
{ {
rb->backlight_set_brightness(rb->global_settings->brightness); rb->backlight_set_brightness(rb->global_settings->brightness);
} }
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ #else /* HAVE_BACKLIGHT_BRIGHTNESS */
/* DUMMY FUNCTIONS */
void backlight_brightness_set(int brightness)
{
(void)brightness;
}
void backlight_brightness_use_setting(void){}
#endif /* !HAVE_BACKLIGHT_BRIGHTNESS */
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
void buttonlight_brightness_set(int brightness) void buttonlight_brightness_set(int brightness)
@ -157,4 +185,12 @@ void buttonlight_brightness_use_setting(void)
{ {
rb->buttonlight_set_brightness(rb->global_settings->buttonlight_brightness); rb->buttonlight_set_brightness(rb->global_settings->buttonlight_brightness);
} }
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ #else /* HAVE_BUTTONLIGHT_BRIGHTNESS */
/* DUMMY FUNCTIONS */
void buttonlight_brightness_set(int brightness)
{
(void)brightness;
}
void buttonlight_brightness_use_setting(void){}
#endif /* !HAVE_BUTTONLIGHT_BRIGHTNESS */

View file

@ -32,39 +32,29 @@ void backlight_force_on(void);
void backlight_ignore_timeout(void); void backlight_ignore_timeout(void);
void backlight_use_settings(void); void backlight_use_settings(void);
#ifdef HAVE_SW_POWEROFF
/** /**
* Disable and restore software poweroff (i.e. holding PLAY on iPods). * Disable and restore software poweroff (i.e. holding PLAY on iPods).
* Only call _restore() if _disable() was called earlier! * Only call _restore() if _disable() was called earlier!
*/ */
void sw_poweroff_disable(void); void sw_poweroff_disable(void);
void sw_poweroff_restore(void); void sw_poweroff_restore(void);
#endif
#ifdef HAVE_REMOTE_LCD
void remote_backlight_force_on(void); void remote_backlight_force_on(void);
void remote_backlight_ignore_timeout(void); void remote_backlight_ignore_timeout(void);
void remote_backlight_use_settings(void); void remote_backlight_use_settings(void);
#endif
#ifdef HAVE_BUTTON_LIGHT
void buttonlight_force_on(void); void buttonlight_force_on(void);
void buttonlight_force_off(void); void buttonlight_force_off(void);
void buttonlight_ignore_timeout(void); void buttonlight_ignore_timeout(void);
void buttonlight_use_settings(void); void buttonlight_use_settings(void);
#endif
/** /**
* Backlight brightness adjustment settings * Backlight brightness adjustment settings
*/ */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
void backlight_brightness_set(int brightness); void backlight_brightness_set(int brightness);
void backlight_brightness_use_setting(void); void backlight_brightness_use_setting(void);
#endif
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
void buttonlight_brightness_set(int brightness); void buttonlight_brightness_set(int brightness);
void buttonlight_brightness_use_setting(void); void buttonlight_brightness_use_setting(void);
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#endif /* _LIB_HELPER_H_ */ #endif /* _LIB_HELPER_H_ */

View file

@ -498,10 +498,8 @@ enum plugin_status plugin_start(const void* parameter)
struct maze maze; struct maze maze;
(void)parameter; (void)parameter;
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
/* Seed the RNG */ /* Seed the RNG */
rb->srand(*rb->current_tick); rb->srand(*rb->current_tick);
@ -591,8 +589,7 @@ enum plugin_status plugin_start(const void* parameter)
#endif #endif
} }
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
return ((quit == 1) ? PLUGIN_OK : PLUGIN_USB_CONNECTED); return ((quit == 1) ? PLUGIN_OK : PLUGIN_USB_CONNECTED);
} }

View file

@ -256,9 +256,7 @@ static void store_lcd_settings(void)
******************************************************************************/ ******************************************************************************/
static void restore_lcd_settings(void) { static void restore_lcd_settings(void) {
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
/* Restore the old settings */ /* Restore the old settings */
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
@ -272,10 +270,9 @@ static void restore_lcd_settings(void) {
* Adjust the LCD settings to suit MazezaM levels * Adjust the LCD settings to suit MazezaM levels
******************************************************************************/ ******************************************************************************/
static void plugin_lcd_settings(void) { static void plugin_lcd_settings(void) {
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
/* Set the new settings */ /* Set the new settings */
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
rb->lcd_set_background(MAZEZAM_BG_COLOR); rb->lcd_set_background(MAZEZAM_BG_COLOR);

View file

@ -1215,10 +1215,9 @@ static void osd_lcd_enable_hook(unsigned short id, void* param)
static void osdbacklight_hw_on_video_mode(bool video_on) static void osdbacklight_hw_on_video_mode(bool video_on)
{ {
if (video_on) { if (video_on) {
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
rb->remove_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook); rb->remove_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook);
#endif #endif
@ -1226,10 +1225,8 @@ static void osdbacklight_hw_on_video_mode(bool video_on)
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
rb->add_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook); rb->add_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook);
#endif #endif
#ifdef HAVE_BACKLIGHT
/* Revert to user's backlight settings */ /* Revert to user's backlight settings */
backlight_use_settings(); backlight_use_settings();
#endif
} }
} }

View file

@ -1939,10 +1939,9 @@ static void osc_cleanup(void)
rb->lcd_set_foreground(LCD_DEFAULT_FG); rb->lcd_set_foreground(LCD_DEFAULT_FG);
rb->lcd_set_background(LCD_DEFAULT_BG); rb->lcd_set_background(LCD_DEFAULT_BG);
#endif #endif
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
/* save settings if changed */ /* save settings if changed */
if (rb->memcmp(&osc, &osc_disk, sizeof(osc))) if (rb->memcmp(&osc, &osc_disk, sizeof(osc)))
@ -1975,10 +1974,9 @@ static void osc_setup(void)
mixer_sampr = rb->mixer_get_frequency(); mixer_sampr = rb->mixer_get_frequency();
#endif #endif
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
graphmode_setup(); graphmode_setup();
} }

View file

@ -809,8 +809,8 @@ enum plugin_status plugin_start(const void* parameter)
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false); rb->cpu_boost(false);
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
return PLUGIN_OK; return PLUGIN_OK;
} }

View file

@ -3493,10 +3493,9 @@ static void cleanup(void)
rb->cpu_boost(false); rb->cpu_boost(false);
#endif #endif
end_pf_thread(); end_pf_thread();
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
#ifdef USEGSLIB #ifdef USEGSLIB
grey_release(); grey_release();

View file

@ -140,10 +140,10 @@ static void cleanup(void)
#ifndef HAVE_LCD_COLOR #ifndef HAVE_LCD_COLOR
grey_release(); grey_release();
#endif #endif
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
rb->lcd_set_mode(LCD_MODE_RGB565); rb->lcd_set_mode(LCD_MODE_RGB565);
#endif #endif
@ -321,10 +321,10 @@ enum plugin_status plugin_start(const void* parameter)
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
#endif #endif
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
rb->lcd_set_mode(LCD_MODE_PAL256); rb->lcd_set_mode(LCD_MODE_PAL256);
#endif #endif

View file

@ -750,10 +750,9 @@ enum plugin_status plugin_start(const void* parameter)
this to avoid the compiler warning about it */ this to avoid the compiler warning about it */
(void)parameter; (void)parameter;
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
/* Clear screen */ /* Clear screen */
rb->lcd_clear_display(); rb->lcd_clear_display();
@ -792,9 +791,9 @@ enum plugin_status plugin_start(const void* parameter)
rb->lcd_clear_display(); rb->lcd_clear_display();
} }
} }
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
return (game == 0) ? PLUGIN_OK : PLUGIN_USB_CONNECTED; return (game == 0) ? PLUGIN_OK : PLUGIN_USB_CONNECTED;
} }

View file

@ -3390,9 +3390,7 @@ static void shutdown_tlsf(void)
static void exit_handler(void) static void exit_handler(void)
{ {
#ifdef HAVE_SW_POWEROFF
sw_poweroff_restore(); sw_poweroff_restore();
#endif
unload_fonts(); unload_fonts();
shutdown_tlsf(); shutdown_tlsf();
@ -3652,9 +3650,7 @@ static void puzzles_main(void)
{ {
rb_atexit(exit_handler); rb_atexit(exit_handler);
#ifdef HAVE_SW_POWEROFF
sw_poweroff_disable(); sw_poweroff_disable();
#endif
init_default_settings(); init_default_settings();
init_fonttab(); init_fonttab();

View file

@ -574,9 +574,8 @@ static void display_helpfile(void)
static void led_resistance_calc(void) static void led_resistance_calc(void)
{ {
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
int voltage_menu_selection, button_press, j, k, l, foreward_current = 0; int voltage_menu_selection, button_press, j, k, l, foreward_current = 0;
int fwd_current_selection = 0; int fwd_current_selection = 0;
bool quit = false; bool quit = false;
@ -769,9 +768,8 @@ static void led_resistance_calc(void)
default: default:
quit = true; quit = true;
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
break; break;
} }
} }
@ -784,9 +782,8 @@ static void led_resistance_calc(void)
static void resistance_to_color(void) static void resistance_to_color(void)
{ {
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
int menu_selection; int menu_selection;
int menu_selection_tol; int menu_selection_tol;
int button_press; int button_press;
@ -910,9 +907,9 @@ static void resistance_to_color(void)
break; break;
default: default:
quit = true; quit = true;
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
break; break;
} }
} }
@ -924,9 +921,8 @@ static void resistance_to_color(void)
static void color_to_resistance(void) static void color_to_resistance(void)
{ {
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
bool quit = false; bool quit = false;
int button_input = 0; int button_input = 0;
@ -995,9 +991,7 @@ static void color_to_resistance(void)
case PLA_SELECT: case PLA_SELECT:
default: default:
quit = true; quit = true;
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
break; break;
} }
} }

View file

@ -1498,16 +1498,13 @@ static int rockblox_loop (void)
#ifdef HAS_BUTTON_HOLD #ifdef HAS_BUTTON_HOLD
if (rb->button_hold ()) { if (rb->button_hold ()) {
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
rb->splash(0, "Paused"); rb->splash(0, "Paused");
while (rb->button_hold ()) while (rb->button_hold ())
rb->sleep(HZ/10); rb->sleep(HZ/10);
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
/* get rid of the splash text */ /* get rid of the splash text */
rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT);
show_details (); show_details ();
@ -1677,10 +1674,9 @@ enum plugin_status plugin_start (const void *parameter)
rb->lcd_setfont (FONT_SYSFIXED); rb->lcd_setfont (FONT_SYSFIXED);
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
load_game(); load_game();
resume_file = resume; resume_file = resume;
@ -1728,9 +1724,8 @@ enum plugin_status plugin_start (const void *parameter)
/* Save user's HighScore */ /* Save user's HighScore */
highscore_save(SCORE_FILE, highscores, NUM_SCORES); highscore_save(SCORE_FILE, highscores, NUM_SCORES);
#ifdef HAVE_BACKLIGNT
backlight_use_settings(); backlight_use_settings();
#endif
return PLUGIN_OK; return PLUGIN_OK;
} }

View file

@ -83,9 +83,8 @@ int do_user_menu(void) {
rb->lcd_set_mode(LCD_MODE_RGB565); rb->lcd_set_mode(LCD_MODE_RGB565);
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
/* Clean out the button Queue */ /* Clean out the button Queue */
while (rb->button_get(false) != BUTTON_NONE) while (rb->button_get(false) != BUTTON_NONE)
rb->yield(); rb->yield();
@ -139,10 +138,9 @@ int do_user_menu(void) {
rb->lcd_set_mode(LCD_MODE_PAL256); rb->lcd_set_mode(LCD_MODE_PAL256);
#endif #endif
#ifdef HAVE_BACKLIGHT
/* ignore backlight time out */ /* ignore backlight time out */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
return ret; return ret;
} }

View file

@ -602,10 +602,9 @@ enum plugin_status plugin_start(const void* parameter)
rb->lcd_set_mode(LCD_MODE_PAL256); rb->lcd_set_mode(LCD_MODE_PAL256);
#endif #endif
#ifdef HAVE_BACKLIGHT
/* ignore backlight time out */ /* ignore backlight time out */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
gnuboy_main(parameter); gnuboy_main(parameter);
#ifdef HAVE_WHEEL_POSITION #ifdef HAVE_WHEEL_POSITION
@ -616,9 +615,7 @@ enum plugin_status plugin_start(const void* parameter)
rb->lcd_set_mode(LCD_MODE_RGB565); rb->lcd_set_mode(LCD_MODE_RGB565);
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
if(!rb->audio_status()) if(!rb->audio_status())
rockboy_pcm_close(); rockboy_pcm_close();

View file

@ -474,9 +474,8 @@ enum plugin_status plugin_start(const void* parameter)
char *ptemp; char *ptemp;
(void)(parameter); (void)(parameter);
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
@ -580,8 +579,7 @@ enum plugin_status plugin_start(const void* parameter)
rb->yield(); rb->yield();
} }
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
return usb? PLUGIN_USB_CONNECTED: PLUGIN_OK; return usb? PLUGIN_USB_CONNECTED: PLUGIN_OK;
} }

View file

@ -64,9 +64,8 @@ void cleanup(void)
if(audiobuf) if(audiobuf)
memset(audiobuf, 0, 4); /* clear */ memset(audiobuf, 0, 4); /* clear */
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false); rb->cpu_boost(false);
#endif #endif
@ -219,9 +218,9 @@ enum plugin_status plugin_start(const void *param)
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true); rb->cpu_boost(true);
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
/* set the real exit handler */ /* set the real exit handler */
#undef rb_atexit #undef rb_atexit
rb_atexit(cleanup); rb_atexit(cleanup);

View file

@ -2128,10 +2128,10 @@ enum plugin_status plugin_start(const void* parameter)
#endif #endif
/* universal font */ /* universal font */
rb->lcd_setfont(FONT_SYSFIXED); rb->lcd_setfont(FONT_SYSFIXED);
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
highscore_load(SCORE_FILE, highscores, NUM_SCORES); highscore_load(SCORE_FILE, highscores, NUM_SCORES);
rb->srand(*rb->current_tick); rb->srand(*rb->current_tick);
@ -2143,10 +2143,9 @@ enum plugin_status plugin_start(const void* parameter)
rb->lcd_setfont(FONT_UI); rb->lcd_setfont(FONT_UI);
highscore_save(SCORE_FILE, highscores, NUM_SCORES); highscore_save(SCORE_FILE, highscores, NUM_SCORES);
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
return ret; return ret;
} }

View file

@ -141,9 +141,9 @@ static void cleanup(void)
{ {
if(custom_font != FONT_UI) if(custom_font != FONT_UI)
rb->font_unload(custom_font); rb->font_unload(custom_font);
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
} }
/* returns height of drawn area */ /* returns height of drawn area */
@ -302,9 +302,8 @@ static void begin_anim(void)
static void init_drawing(void) static void init_drawing(void)
{ {
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
atexit(cleanup); atexit(cleanup);
rb->lcd_set_background(OUTSIDE_COLOR); rb->lcd_set_background(OUTSIDE_COLOR);

View file

@ -324,14 +324,14 @@ enum plugin_status plugin_start(const void* parameter)
int ret; int ret;
(void)parameter; (void)parameter;
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
ret = plugin_main(); ret = plugin_main();
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
return ret; return ret;
} }

View file

@ -467,10 +467,9 @@ enum plugin_status plugin_start(const void* parameter)
rb->srand(*rb->current_tick); rb->srand(*rb->current_tick);
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
while(!quit) while(!quit)
{ {
@ -489,9 +488,8 @@ enum plugin_status plugin_start(const void* parameter)
} }
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
rb->rmdir(testbasedir); rb->rmdir(testbasedir);
return PLUGIN_OK; return PLUGIN_OK;

View file

@ -401,9 +401,9 @@ enum plugin_status plugin_start(const void* parameter)
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */ cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
time_main_update(); time_main_update();
rb->sleep(HZ); rb->sleep(HZ);
#if defined(HAVE_LCD_COLOR) && (MEMORYSIZE > 2) #if defined(HAVE_LCD_COLOR) && (MEMORYSIZE > 2)
@ -424,9 +424,9 @@ enum plugin_status plugin_start(const void* parameter)
(cpu_freq + 500000) / 1000000); (cpu_freq + 500000) / 1000000);
log_text(str); log_text(str);
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
/* wait until user closes plugin */ /* wait until user closes plugin */
plugin_quit(); plugin_quit();

View file

@ -495,9 +495,9 @@ enum plugin_status plugin_start(const void* parameter)
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
rb->lcd_clear_display(); rb->lcd_clear_display();
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
rb->splashf(0, "LCD driver performance test, please wait %d sec", rb->splashf(0, "LCD driver performance test, please wait %d sec",
7*4*DURATION/HZ); 7*4*DURATION/HZ);
init_rand_table(); init_rand_table();
@ -522,9 +522,9 @@ enum plugin_status plugin_start(const void* parameter)
(cpu_freq + 500000) / 1000000); (cpu_freq + 500000) / 1000000);
#endif #endif
rb->close(log_fd); rb->close(log_fd);
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
#ifdef TEST_GREYLIB #ifdef TEST_GREYLIB
grey_release(); grey_release();
#endif #endif

View file

@ -123,9 +123,9 @@ enum plugin_status plugin_start(const void* parameter)
} }
for (i = 0; i <= STEPS; i++) for (i = 0; i <= STEPS; i++)
input_levels[i] = lcd_levels[i] = (255 * i + (STEPS/2)) / STEPS; input_levels[i] = lcd_levels[i] = (255 * i + (STEPS/2)) / STEPS;
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
grey_set_background(0); /* set background to black */ grey_set_background(0); /* set background to black */
grey_clear_display(); grey_clear_display();
grey_show(true); grey_show(true);
@ -221,8 +221,8 @@ enum plugin_status plugin_start(const void* parameter)
} }
grey_release(); grey_release();
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
return PLUGIN_OK; return PLUGIN_OK;
} }

View file

@ -2428,10 +2428,9 @@ static bool launch_wormlet(void)
rb->lcd_clear_display(); rb->lcd_clear_display();
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
/* start the game */ /* start the game */
while (game_result == 1) while (game_result == 1)
game_result = run(); game_result = run();
@ -2439,10 +2438,10 @@ static bool launch_wormlet(void)
switch (game_result) switch (game_result)
{ {
case 2: case 2:
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
return false; return false;
break; break;
} }

View file

@ -1297,10 +1297,9 @@ enum plugin_status plugin_start (const void *parameter)
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
#endif #endif
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */ /* Turn off backlight timeout */
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
highscore_load(SCORE_FILE, highscores, NUM_SCORES); highscore_load(SCORE_FILE, highscores, NUM_SCORES);
if (!load_game()) { if (!load_game()) {
@ -1310,10 +1309,10 @@ enum plugin_status plugin_start (const void *parameter)
randomize (); randomize ();
ret = xobox_loop (); ret = xobox_loop ();
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); backlight_use_settings();
#endif
rb->lcd_setfont (FONT_UI); rb->lcd_setfont (FONT_UI);
highscore_save(SCORE_FILE, highscores, NUM_SCORES); highscore_save(SCORE_FILE, highscores, NUM_SCORES);

View file

@ -122,9 +122,8 @@ void exit_handler(void)
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false); rb->cpu_boost(false);
#endif #endif
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
} }
static bool sys_do_help(void) static bool sys_do_help(void)
@ -428,9 +427,8 @@ void sys_menu(struct System* sys)
void sys_init(struct System* sys, const char* title) void sys_init(struct System* sys, const char* title)
{ {
(void) title; (void) title;
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
rb_atexit(exit_handler); rb_atexit(exit_handler);
save_sys = sys; save_sys = sys;
rb->memset(&sys->input, 0, sizeof(sys->input)); rb->memset(&sys->input, 0, sizeof(sys->input));