diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-07-24 19:20:15 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-07-24 19:20:15 -0400 |
commit | 9be5bc4cf0d185f4515174b9ebbb105f73f7c2e3 (patch) | |
tree | 46b4a9f4650d288bcbe67e92a9138b45c06105fa | |
parent | 2127906384d618e032692becba10aeda1b3e1974 (diff) | |
download | rockbox-9be5bc4.tar.gz rockbox-9be5bc4.zip |
plugins: More HAVE_BACKLIGHT cleanup
Change-Id: I70cf700f5bc3d4375c025efa62ef40fd2bd70293
30 files changed, 149 insertions, 44 deletions
diff --git a/apps/plugins/2048.c b/apps/plugins/2048.c index 08be294d88..1604b73c62 100644 --- a/apps/plugins/2048.c +++ b/apps/plugins/2048.c @@ -148,7 +148,9 @@ 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 */ @@ -698,7 +700,9 @@ 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(); } diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index dd46f98b8e..5764c6869d 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c @@ -2526,9 +2526,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(); @@ -2557,8 +2558,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; } diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c index fea966213d..649ab164d0 100644 --- a/apps/plugins/chessclock.c +++ b/apps/plugins/chessclock.c @@ -21,8 +21,6 @@ #include "plugin.h" #include "lib/playback_control.h" - - /* variable button definitions */ #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ (CONFIG_KEYPAD == IRIVER_H300_PAD) @@ -636,15 +634,19 @@ static int run_timer(int nr) rb->lcd_puts(0, FIRST_LINE+1, (unsigned char *)"ROUND UP!"); else rb->lcd_puts(0, FIRST_LINE+1, (unsigned char *)"TIME OUT!"); +#ifdef HAVE_BACKLIGHT rb->backlight_on(); +#endif ticks = max_ticks; } else { now=*rb->current_tick; if (!chesspause) { ticks+=now-last_tick; if ((max_ticks-ticks)/HZ == 10) { - /* Backlight on if 10 seconds remain */ +#ifdef HAVE_BACKLIGHT + /* Backlight on if 10 seconds remain */ rb->backlight_on(); +#endif } } last_tick=now; diff --git a/apps/plugins/demystify.c b/apps/plugins/demystify.c index a389018c4e..74537e94f8 100644 --- a/apps/plugins/demystify.c +++ b/apps/plugins/demystify.c @@ -262,10 +262,12 @@ 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 @@ -436,10 +438,12 @@ 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; diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c index 85e3225af8..6594859c08 100644 --- a/apps/plugins/doom/rockdoom.c +++ b/apps/plugins/doom/rockdoom.c @@ -722,7 +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 @@ -736,8 +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 diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c index 4fc30173da..8873642f3c 100644 --- a/apps/plugins/fire.c +++ b/apps/plugins/fire.c @@ -277,8 +277,10 @@ 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 } @@ -366,15 +368,17 @@ 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 ret = main(); - + #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) rb->lcd_set_mode(LCD_MODE_RGB565); #endif diff --git a/apps/plugins/fireworks.c b/apps/plugins/fireworks.c index d6ca6618cb..b7dad0d8ba 100644 --- a/apps/plugins/fireworks.c +++ b/apps/plugins/fireworks.c @@ -358,7 +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); @@ -522,9 +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 diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c index c6d33dad38..4070f4b513 100644 --- a/apps/plugins/imageviewer/imageviewer.c +++ b/apps/plugins/imageviewer/imageviewer.c @@ -1025,8 +1025,10 @@ 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); @@ -1053,8 +1055,10 @@ 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 */ diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c index e7529895ac..e275129d27 100644 --- a/apps/plugins/invadrox.c +++ b/apps/plugins/invadrox.c @@ -1899,8 +1899,9 @@ enum plugin_status plugin_start(UNUSED const void* parameter) { rb->lcd_setfont(FONT_SYSFIXED); /* Turn off backlight timeout */ +#ifdef HAVE_BACKLIGHT backlight_ignore_timeout(); - +#endif /* now go ahead and have fun! */ game_loop(); @@ -1916,8 +1917,9 @@ enum plugin_status plugin_start(UNUSED const void* parameter) /* Restore user's original backlight setting */ rb->lcd_setfont(FONT_UI); /* Turn on backlight timeout (revert to settings) */ +#ifdef HAVE_BACKLIGHT backlight_use_settings(); - +#endif return PLUGIN_OK; } diff --git a/apps/plugins/lrcplayer.c b/apps/plugins/lrcplayer.c index 2c7742fd94..2abfbef6c9 100644 --- a/apps/plugins/lrcplayer.c +++ b/apps/plugins/lrcplayer.c @@ -2687,8 +2687,10 @@ static int lrc_main(void) vp_lyrics[i].height -= h; } +#ifdef HAVE_BACKLIGHT if (prefs.backlight_on) backlight_ignore_timeout(); +#endif /* in case settings that may affect break position * are changed (statusbar_on and wrap). */ @@ -2780,8 +2782,10 @@ static int lrc_main(void) FOR_NB_SCREENS(i) rb->viewportmanager_theme_undo(i, false); +#ifdef HAVE_BACKLIGHT if (prefs.backlight_on) backlight_use_settings(); +#endif return ret; } diff --git a/apps/plugins/maze.c b/apps/plugins/maze.c index bcdb4ff553..20d5c82495 100644 --- a/apps/plugins/maze.c +++ b/apps/plugins/maze.c @@ -498,8 +498,10 @@ 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); @@ -589,6 +591,8 @@ 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); } diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index 423b09288d..cd7b6e22a8 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c @@ -256,7 +256,9 @@ 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 @@ -270,9 +272,10 @@ 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); diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index eed1fab6d7..5c06fe257d 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c @@ -1204,8 +1204,10 @@ 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 @@ -1213,8 +1215,10 @@ 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 } } diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c index 2af70204a1..4fd1883f82 100644 --- a/apps/plugins/oscilloscope.c +++ b/apps/plugins/oscilloscope.c @@ -1929,9 +1929,10 @@ 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))) @@ -1964,8 +1965,10 @@ 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(); } diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c index 33c1cf6bba..182e4a473a 100755 --- a/apps/plugins/pacbox/pacbox.c +++ b/apps/plugins/pacbox/pacbox.c @@ -768,9 +768,11 @@ enum plugin_status plugin_start(const void* parameter) the settings have changed when we quit */ old_settings = settings; +#ifdef HAVE_BACKLIGHT /*Turn off backlight for ai*/ if(settings.ai) backlight_ignore_timeout(); +#endif /* Initialise the hardware */ init_PacmanMachine(settings_to_dip(settings)); @@ -803,8 +805,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; } diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c index 541d53cdef..3a2238bb60 100644 --- a/apps/plugins/plasma.c +++ b/apps/plugins/plasma.c @@ -138,8 +138,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 @@ -317,9 +319,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 diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c index fcc4c5a3b9..a000a88fe7 100644 --- a/apps/plugins/pong.c +++ b/apps/plugins/pong.c @@ -747,8 +747,10 @@ 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(); @@ -787,8 +789,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; } diff --git a/apps/plugins/resistor.c b/apps/plugins/resistor.c index ec6a364f23..2e204010a9 100644 --- a/apps/plugins/resistor.c +++ b/apps/plugins/resistor.c @@ -566,15 +566,17 @@ static void display_helpfile(void) { 159, TEXT_UNDERLINE }, LAST_STYLE_ITEM }; - + display_text(ARRAYLEN(helpfile_text), helpfile_text, formatting, NULL, true); return; } - + 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; @@ -759,14 +761,17 @@ static void led_resistance_calc(void) rb->lcd_puts_scroll(resistance_val_x, lineno++, power_rating_out_str); rb->lcd_update(); - + while ((button_press = rb->button_get(true)) & BUTTON_REL); switch(button_press) { case PLA_SELECT: break; default: quit = true; + +#ifdef HAVE_BACKLIGHT backlight_use_settings(); +#endif break; } } @@ -776,10 +781,12 @@ static void led_resistance_calc(void) rb->lcd_clear_display(); } - -static void resistance_to_color(void) + +static void resistance_to_color(void) { +#ifdef HAVE_BACKLIGHT backlight_ignore_timeout(); +#endif int menu_selection; int menu_selection_tol; int button_press; @@ -883,27 +890,29 @@ static void resistance_to_color(void) in_resistance_int,band_data[units_used].unit); return; } - + rb->lcd_clear_display(); lineno = INITIAL_TEXT_Y; #ifndef USE_TEXT_ONLY draw_resistor(first_band, second_band, multiplier, fourth_band); -#endif +#endif draw_resistor_text(first_band, second_band, multiplier, fourth_band); - + rb->snprintf(out_str, sizeof(out_str), "Input: %d %s", in_resistance_int, band_data[units_used].unit); display->set_viewport(&text_vp); rb->lcd_puts_scroll(r_to_c_out_str_x, lineno++, out_str); rb->lcd_update(); - + button_press = rb->button_get(true); switch(button_press) { case PLA_SELECT: break; default: quit = true; +#ifdef HAVE_BACKLIGHT backlight_use_settings(); +#endif break; } } @@ -912,25 +921,27 @@ static void resistance_to_color(void) display->set_viewport(&screen_vp); rb->lcd_clear_display(); } - -static void color_to_resistance(void) + +static void color_to_resistance(void) { +#ifdef HAVE_BACKLIGHT backlight_ignore_timeout(); +#endif bool quit = false; int button_input = 0; - + /* The colors of the bands */ enum color first_band = 0; enum color second_band = 0; enum color third_band = 0; enum color fourth_band = 0; - + int total_resistance_centiunits = 0; char total_resistance_str [35]; - + rb->splash(HZ/2, "Colour to resistance"); rb->lcd_clear_display(); - + while(!quit) { first_band = do_first_band_menu(); if(first_band==RES_INVALID) break; @@ -984,9 +995,11 @@ static void color_to_resistance(void) case PLA_SELECT: default: quit = true; +#ifdef HAVE_BACKLIGHT backlight_use_settings(); +#endif break; - } + } } display->set_viewport(&text_vp); rb->lcd_scroll_stop(); diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c index 31c626e267..f1f260a55d 100644 --- a/apps/plugins/rockblox.c +++ b/apps/plugins/rockblox.c @@ -1505,14 +1505,16 @@ 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 (); @@ -1682,8 +1684,10 @@ 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; @@ -1731,7 +1735,9 @@ 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; } diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c index caa8d499cb..6fafdc11a6 100644 --- a/apps/plugins/rockboy/menu.c +++ b/apps/plugins/rockboy/menu.c @@ -83,8 +83,9 @@ 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(); @@ -138,9 +139,10 @@ 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; } diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c index 57f0c95ea6..202cdf6570 100644 --- a/apps/plugins/rockboy/rockboy.c +++ b/apps/plugins/rockboy/rockboy.c @@ -594,9 +594,10 @@ 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 @@ -607,7 +608,9 @@ 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(); diff --git a/apps/plugins/rocklife.c b/apps/plugins/rocklife.c index 1effeb2f00..0be48dcce8 100644 --- a/apps/plugins/rocklife.c +++ b/apps/plugins/rocklife.c @@ -473,7 +473,9 @@ 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 @@ -577,6 +579,8 @@ enum plugin_status plugin_start(const void* parameter) rb->yield(); } +#ifdef HAVE_BACKLIGHT backlight_use_settings(); +#endif return usb? PLUGIN_USB_CONNECTED: PLUGIN_OK; } diff --git a/apps/plugins/sdl/main.c b/apps/plugins/sdl/main.c index be5192898c..6efb072faf 100644 --- a/apps/plugins/sdl/main.c +++ b/apps/plugins/sdl/main.c @@ -64,8 +64,9 @@ 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 @@ -218,8 +219,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); diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c index 268c55ad35..b366da0d60 100644 --- a/apps/plugins/spacerocks.c +++ b/apps/plugins/spacerocks.c @@ -2125,8 +2125,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); @@ -2138,8 +2140,10 @@ 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; } diff --git a/apps/plugins/speedread.c b/apps/plugins/speedread.c index b6fce77de1..42634fb536 100644 --- a/apps/plugins/speedread.c +++ b/apps/plugins/speedread.c @@ -141,7 +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 */ @@ -300,7 +302,9 @@ 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); diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c index 24e2e4c085..7fc400d0ee 100644 --- a/apps/plugins/starfield.c +++ b/apps/plugins/starfield.c @@ -324,13 +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; } diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c index 0a29a7aa30..19ccd9f452 100644 --- a/apps/plugins/stats.c +++ b/apps/plugins/stats.c @@ -189,10 +189,12 @@ enum plugin_status plugin_start(const void* parameter) return PLUGIN_OK; } update_screen(); +#ifdef HAVE_BACKLIGHT #ifdef HAVE_REMOTE_LCD rb->remote_backlight_on(); #endif rb->backlight_on(); +#endif rb->splash(HZ, "Done"); update_screen(); while (1) { diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c index b18cdc21f8..419b258fe5 100644 --- a/apps/plugins/wormlet.c +++ b/apps/plugins/wormlet.c @@ -2415,9 +2415,10 @@ 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(); @@ -2425,8 +2426,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; } diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c index e2cccba8fc..5ed1fbb612 100644 --- a/apps/plugins/xobox.c +++ b/apps/plugins/xobox.c @@ -1303,9 +1303,10 @@ 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()) { @@ -1315,8 +1316,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); diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c index 1416a40577..db01dcc974 100644 --- a/apps/plugins/xworld/sys.c +++ b/apps/plugins/xworld/sys.c @@ -121,7 +121,9 @@ 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) @@ -425,7 +427,9 @@ 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)); |