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 */
static void cleanup(void)
{
#ifdef HAVE_BACKLIGHT
backlight_use_settings();
#endif
}
/* 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');
#endif
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout();
#endif
draw();
}

View file

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

View file

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

View file

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

View file

@ -262,12 +262,10 @@ static void polygons_draw(struct polygon_fifo * polygons, struct screen * displa
static void cleanup(void)
{
#ifdef HAVE_BACKLIGHT
backlight_use_settings();
#ifdef HAVE_REMOTE_LCD
remote_backlight_use_settings();
#endif
#endif
}
#ifdef HAVE_LCD_COLOR
@ -438,12 +436,10 @@ enum plugin_status plugin_start(const void* parameter)
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout();
#ifdef HAVE_REMOTE_LCD
remote_backlight_ignore_timeout();
#endif
#endif
ret = plugin_main();
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;
general_translucency = default_translucency; // phares
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout();
#endif
#ifdef RB_PROFILE
rb->profile_thread();
#endif
@ -738,9 +738,9 @@ enum plugin_status plugin_start(const void* parameter)
#ifdef RB_PROFILE
rb->profstop();
#endif
#ifdef HAVE_BACKLIGHT
backlight_use_settings();
#endif
M_SaveDefaults ();
I_Quit(); // Make SURE everything was closed out right

View file

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

View file

@ -279,10 +279,9 @@ static void cleanup(void *parameter)
#ifndef HAVE_LCD_COLOR
grey_release();
#endif
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings();
#endif
}
@ -371,10 +370,9 @@ enum plugin_status plugin_start(const void* parameter)
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */
backlight_ignore_timeout();
#endif
#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & 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,
white-text-on-black-background. */
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout();
#endif
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
rb->lcd_set_background(LCD_BLACK);
@ -524,10 +524,10 @@ enum plugin_status plugin_start(const void* parameter)
break;
}
}
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings();
#endif
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false);
#endif

View file

@ -1064,10 +1064,8 @@ enum plugin_status plugin_start(const void* parameter)
ARRAYLEN(config), IMGVIEW_SETTINGS_MINVERSION);
rb->memcpy(&old_settings, &settings, sizeof (settings));
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */
backlight_ignore_timeout();
#endif
#if LCD_DEPTH > 1
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);
#endif
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings();
#endif
#ifdef USEGSLIB
grey_release(); /* deinitialize */

View file

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

View file

@ -58,7 +58,12 @@ void backlight_use_settings(void)
backlight_timeout_plugged);
#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
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);
}
#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
/* Force the backlight on */
@ -106,7 +115,12 @@ void remote_backlight_use_settings(void)
remote_backlight_timeout_plugged);
#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
/* Force the buttonlight on */
@ -133,7 +147,13 @@ void buttonlight_use_settings(void)
{
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
void backlight_brightness_set(int brightness)
@ -145,7 +165,15 @@ void backlight_brightness_use_setting(void)
{
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
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);
}
#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_use_settings(void);
#ifdef HAVE_SW_POWEROFF
/**
* Disable and restore software poweroff (i.e. holding PLAY on iPods).
* Only call _restore() if _disable() was called earlier!
*/
void sw_poweroff_disable(void);
void sw_poweroff_restore(void);
#endif
#ifdef HAVE_REMOTE_LCD
void remote_backlight_force_on(void);
void remote_backlight_ignore_timeout(void);
void remote_backlight_use_settings(void);
#endif
#ifdef HAVE_BUTTON_LIGHT
void buttonlight_force_on(void);
void buttonlight_force_off(void);
void buttonlight_ignore_timeout(void);
void buttonlight_use_settings(void);
#endif
/**
* Backlight brightness adjustment settings
*/
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
void backlight_brightness_set(int brightness);
void backlight_brightness_use_setting(void);
#endif
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
void buttonlight_brightness_set(int brightness);
void buttonlight_brightness_use_setting(void);
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#endif /* _LIB_HELPER_H_ */

View file

@ -498,10 +498,8 @@ enum plugin_status plugin_start(const void* parameter)
struct maze maze;
(void)parameter;
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */
backlight_ignore_timeout();
#endif
/* Seed the RNG */
rb->srand(*rb->current_tick);
@ -591,8 +589,7 @@ enum plugin_status plugin_start(const void* parameter)
#endif
}
/* Turn on backlight timeout (revert to settings) */
#ifdef HAVE_BACKLIGHT
backlight_use_settings();
#endif
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) {
/* Turn on backlight timeout (revert to settings) */
#ifdef HAVE_BACKLIGHT
backlight_use_settings();
#endif
/* Restore the old settings */
#if LCD_DEPTH > 1
@ -272,10 +270,9 @@ static void restore_lcd_settings(void) {
* Adjust the LCD settings to suit MazezaM levels
******************************************************************************/
static void plugin_lcd_settings(void) {
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */
backlight_ignore_timeout();
#endif
/* Set the new settings */
#ifdef HAVE_LCD_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)
{
if (video_on) {
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */
backlight_ignore_timeout();
#endif
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
rb->remove_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook);
#endif
@ -1226,10 +1225,8 @@ static void osdbacklight_hw_on_video_mode(bool video_on)
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
rb->add_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook);
#endif
#ifdef HAVE_BACKLIGHT
/* Revert to user's backlight 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_background(LCD_DEFAULT_BG);
#endif
#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings();
#endif
/* save settings if changed */
if (rb->memcmp(&osc, &osc_disk, sizeof(osc)))
@ -1975,10 +1974,9 @@ static void osc_setup(void)
mixer_sampr = rb->mixer_get_frequency();
#endif
#ifdef HAVE_BACKLIGHT
/* Turn off backlight timeout */
backlight_ignore_timeout();
#endif
graphmode_setup();
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -122,9 +122,8 @@ void exit_handler(void)
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false);
#endif
#ifdef HAVE_BACKLIGHT
backlight_use_settings();
#endif
}
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) title;
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout();
#endif
rb_atexit(exit_handler);
save_sys = sys;
rb->memset(&sys->input, 0, sizeof(sys->input));