plugins: More HAVE_BACKLIGHT cleanup

Change-Id: I70cf700f5bc3d4375c025efa62ef40fd2bd70293
This commit is contained in:
Solomon Peachy 2020-07-24 19:20:15 -04:00
parent 2127906384
commit 9be5bc4cf0
30 changed files with 149 additions and 44 deletions

View file

@ -148,7 +148,9 @@ 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 */
@ -698,7 +700,9 @@ 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

@ -2526,9 +2526,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();
@ -2557,8 +2558,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

@ -21,8 +21,6 @@
#include "plugin.h" #include "plugin.h"
#include "lib/playback_control.h" #include "lib/playback_control.h"
/* variable button definitions */ /* variable button definitions */
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
(CONFIG_KEYPAD == IRIVER_H300_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!"); rb->lcd_puts(0, FIRST_LINE+1, (unsigned char *)"ROUND UP!");
else else
rb->lcd_puts(0, FIRST_LINE+1, (unsigned char *)"TIME OUT!"); rb->lcd_puts(0, FIRST_LINE+1, (unsigned char *)"TIME OUT!");
#ifdef HAVE_BACKLIGHT
rb->backlight_on(); rb->backlight_on();
#endif
ticks = max_ticks; ticks = max_ticks;
} else { } else {
now=*rb->current_tick; now=*rb->current_tick;
if (!chesspause) { if (!chesspause) {
ticks+=now-last_tick; ticks+=now-last_tick;
if ((max_ticks-ticks)/HZ == 10) { if ((max_ticks-ticks)/HZ == 10) {
/* Backlight on if 10 seconds remain */ #ifdef HAVE_BACKLIGHT
/* Backlight on if 10 seconds remain */
rb->backlight_on(); rb->backlight_on();
#endif
} }
} }
last_tick=now; last_tick=now;

View file

@ -262,10 +262,12 @@ 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 #ifdef HAVE_REMOTE_LCD
remote_backlight_use_settings(); remote_backlight_use_settings();
#endif #endif
#endif
} }
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
@ -436,9 +438,11 @@ 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 #ifdef HAVE_REMOTE_LCD
remote_backlight_ignore_timeout(); remote_backlight_ignore_timeout();
#endif
#endif #endif
ret = plugin_main(); ret = plugin_main();

View file

@ -722,7 +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
@ -736,8 +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

@ -277,8 +277,10 @@ 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
} }
@ -366,15 +368,17 @@ 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
ret = main(); ret = main();
#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

View file

@ -358,7 +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);
@ -522,9 +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

@ -1025,8 +1025,10 @@ 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);
@ -1053,8 +1055,10 @@ 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

@ -1899,8 +1899,9 @@ enum plugin_status plugin_start(UNUSED const void* parameter)
{ {
rb->lcd_setfont(FONT_SYSFIXED); rb->lcd_setfont(FONT_SYSFIXED);
/* Turn off backlight timeout */ /* Turn off backlight timeout */
#ifdef HAVE_BACKLIGHT
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
/* now go ahead and have fun! */ /* now go ahead and have fun! */
game_loop(); game_loop();
@ -1916,8 +1917,9 @@ enum plugin_status plugin_start(UNUSED const void* parameter)
/* Restore user's original backlight setting */ /* Restore user's original backlight setting */
rb->lcd_setfont(FONT_UI); rb->lcd_setfont(FONT_UI);
/* 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 PLUGIN_OK; return PLUGIN_OK;
} }

View file

@ -2687,8 +2687,10 @@ static int lrc_main(void)
vp_lyrics[i].height -= h; vp_lyrics[i].height -= h;
} }
#ifdef HAVE_BACKLIGHT
if (prefs.backlight_on) if (prefs.backlight_on)
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
/* in case settings that may affect break position /* in case settings that may affect break position
* are changed (statusbar_on and wrap). */ * are changed (statusbar_on and wrap). */
@ -2780,8 +2782,10 @@ static int lrc_main(void)
FOR_NB_SCREENS(i) FOR_NB_SCREENS(i)
rb->viewportmanager_theme_undo(i, false); rb->viewportmanager_theme_undo(i, false);
#ifdef HAVE_BACKLIGHT
if (prefs.backlight_on) if (prefs.backlight_on)
backlight_use_settings(); backlight_use_settings();
#endif
return ret; return ret;
} }

View file

@ -498,8 +498,10 @@ 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);
@ -589,6 +591,8 @@ 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,7 +256,9 @@ 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
@ -270,9 +272,10 @@ 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

@ -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) 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
@ -1213,8 +1215,10 @@ 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

@ -1929,9 +1929,10 @@ 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)))
@ -1964,8 +1965,10 @@ 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

@ -768,9 +768,11 @@ enum plugin_status plugin_start(const void* parameter)
the settings have changed when we quit */ the settings have changed when we quit */
old_settings = settings; old_settings = settings;
#ifdef HAVE_BACKLIGHT
/*Turn off backlight for ai*/ /*Turn off backlight for ai*/
if(settings.ai) if(settings.ai)
backlight_ignore_timeout(); backlight_ignore_timeout();
#endif
/* Initialise the hardware */ /* Initialise the hardware */
init_PacmanMachine(settings_to_dip(settings)); init_PacmanMachine(settings_to_dip(settings));
@ -803,8 +805,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

@ -138,8 +138,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
@ -317,9 +319,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

@ -747,8 +747,10 @@ 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();
@ -787,8 +789,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

@ -566,15 +566,17 @@ static void display_helpfile(void)
{ 159, TEXT_UNDERLINE }, { 159, TEXT_UNDERLINE },
LAST_STYLE_ITEM LAST_STYLE_ITEM
}; };
display_text(ARRAYLEN(helpfile_text), helpfile_text, formatting, display_text(ARRAYLEN(helpfile_text), helpfile_text, formatting,
NULL, true); NULL, true);
return; return;
} }
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;
@ -759,14 +761,17 @@ static void led_resistance_calc(void)
rb->lcd_puts_scroll(resistance_val_x, lineno++, power_rating_out_str); rb->lcd_puts_scroll(resistance_val_x, lineno++, power_rating_out_str);
rb->lcd_update(); rb->lcd_update();
while ((button_press = rb->button_get(true)) & BUTTON_REL); while ((button_press = rb->button_get(true)) & BUTTON_REL);
switch(button_press) { switch(button_press) {
case PLA_SELECT: case PLA_SELECT:
break; break;
default: default:
quit = true; quit = true;
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
break; break;
} }
} }
@ -776,10 +781,12 @@ static void led_resistance_calc(void)
rb->lcd_clear_display(); rb->lcd_clear_display();
} }
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;
@ -883,27 +890,29 @@ static void resistance_to_color(void)
in_resistance_int,band_data[units_used].unit); in_resistance_int,band_data[units_used].unit);
return; return;
} }
rb->lcd_clear_display(); rb->lcd_clear_display();
lineno = INITIAL_TEXT_Y; lineno = INITIAL_TEXT_Y;
#ifndef USE_TEXT_ONLY #ifndef USE_TEXT_ONLY
draw_resistor(first_band, second_band, multiplier, fourth_band); draw_resistor(first_band, second_band, multiplier, fourth_band);
#endif #endif
draw_resistor_text(first_band, second_band, multiplier, fourth_band); draw_resistor_text(first_band, second_band, multiplier, fourth_band);
rb->snprintf(out_str, sizeof(out_str), "Input: %d %s", in_resistance_int, rb->snprintf(out_str, sizeof(out_str), "Input: %d %s", in_resistance_int,
band_data[units_used].unit); band_data[units_used].unit);
display->set_viewport(&text_vp); display->set_viewport(&text_vp);
rb->lcd_puts_scroll(r_to_c_out_str_x, lineno++, out_str); rb->lcd_puts_scroll(r_to_c_out_str_x, lineno++, out_str);
rb->lcd_update(); rb->lcd_update();
button_press = rb->button_get(true); button_press = rb->button_get(true);
switch(button_press) { switch(button_press) {
case PLA_SELECT: case PLA_SELECT:
break; break;
default: default:
quit = true; quit = true;
#ifdef HAVE_BACKLIGHT
backlight_use_settings(); backlight_use_settings();
#endif
break; break;
} }
} }
@ -912,25 +921,27 @@ static void resistance_to_color(void)
display->set_viewport(&screen_vp); display->set_viewport(&screen_vp);
rb->lcd_clear_display(); rb->lcd_clear_display();
} }
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;
/* The colors of the bands */ /* The colors of the bands */
enum color first_band = 0; enum color first_band = 0;
enum color second_band = 0; enum color second_band = 0;
enum color third_band = 0; enum color third_band = 0;
enum color fourth_band = 0; enum color fourth_band = 0;
int total_resistance_centiunits = 0; int total_resistance_centiunits = 0;
char total_resistance_str [35]; char total_resistance_str [35];
rb->splash(HZ/2, "Colour to resistance"); rb->splash(HZ/2, "Colour to resistance");
rb->lcd_clear_display(); rb->lcd_clear_display();
while(!quit) { while(!quit) {
first_band = do_first_band_menu(); first_band = do_first_band_menu();
if(first_band==RES_INVALID) break; if(first_band==RES_INVALID) break;
@ -984,9 +995,11 @@ 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;
} }
} }
display->set_viewport(&text_vp); display->set_viewport(&text_vp);
rb->lcd_scroll_stop(); rb->lcd_scroll_stop();

View file

@ -1505,14 +1505,16 @@ 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 ();
@ -1682,8 +1684,10 @@ 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;
@ -1731,7 +1735,9 @@ 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,8 +83,9 @@ 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();
@ -138,9 +139,10 @@ 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

@ -594,9 +594,10 @@ 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
@ -607,7 +608,9 @@ 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

@ -473,7 +473,9 @@ 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
@ -577,6 +579,8 @@ 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,8 +64,9 @@ 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
@ -218,8 +219,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

@ -2125,8 +2125,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);
@ -2138,8 +2140,10 @@ 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,7 +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 */
@ -300,7 +302,9 @@ 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,13 +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

@ -189,10 +189,12 @@ enum plugin_status plugin_start(const void* parameter)
return PLUGIN_OK; return PLUGIN_OK;
} }
update_screen(); update_screen();
#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
rb->remote_backlight_on(); rb->remote_backlight_on();
#endif #endif
rb->backlight_on(); rb->backlight_on();
#endif
rb->splash(HZ, "Done"); rb->splash(HZ, "Done");
update_screen(); update_screen();
while (1) { while (1) {

View file

@ -2415,9 +2415,10 @@ 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();
@ -2425,8 +2426,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

@ -1303,9 +1303,10 @@ 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()) {
@ -1315,8 +1316,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

@ -121,7 +121,9 @@ 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)
@ -425,7 +427,9 @@ 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));