Bring mpegplayer backlight fix to the other plugins, this also fixes some wrongly ifdef'd backlight calls.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14352 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Peter D'Hoye 2007-08-15 12:42:09 +00:00
parent f2b5c29234
commit cb53e3cef4
19 changed files with 100 additions and 87 deletions

View file

@ -19,6 +19,7 @@
#include "plugin.h"
#include "configfile.h" /* Part of libplugin */
#include "helper.h"
PLUGIN_HEADER
@ -2029,9 +2030,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
/* Permanently enable the backlight (unless the user has turned it off) */
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1);
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
/* now go ahead and have fun! */
while (game_loop()!=1);
@ -2040,7 +2040,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
/* Restore user's original backlight setting */
rb->lcd_setfont(FONT_UI);
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
return PLUGIN_OK;
}

View file

@ -21,6 +21,7 @@
#include "plugin.h"
#include "xlcd.h"
#include "configfile.h"
#include "helper.h"
PLUGIN_HEADER
@ -947,9 +948,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->lcd_set_foreground(LCD_WHITE);
#endif
/* Permanently enable the backlight (unless the user has turned it off) */
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1);
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
rb->srand( *rb->current_tick );
@ -962,9 +962,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
configfile_save(CFG_FILE, config, 1, 0);
/* Restore user's original backlight setting */
rb->lcd_setfont(FONT_UI);
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
return ret;
}

View file

@ -17,6 +17,7 @@
*
****************************************************************************/
#include "plugin.h"
#include "helper.h"
PLUGIN_HEADER
@ -36,7 +37,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb = api;
/* Turn off backlight timeout */
rb->backlight_set_timeout(1);
backlight_force_on(); /* backlight control in lib/helper.c */
rb->show_logo();
#ifdef HAVE_LCD_CHARCELLS
@ -55,8 +56,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
roll_credits();
end_of_proc:
/* Restore the values we've changed */
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
return PLUGIN_OK;
}

View file

@ -20,6 +20,7 @@
****************************************************************************/
#include "plugin.h"
#include "helper.h"
#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
#ifndef HAVE_LCD_COLOR
@ -330,7 +331,8 @@ void cleanup(void *parameter)
#ifndef HAVE_LCD_COLOR
gray_release();
#endif
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
}
/*
@ -420,8 +422,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1);/* keep the light on */
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
ret = main();

View file

@ -18,6 +18,7 @@
****************************************************************************/
#include "plugin.h"
#include "oldmenuapi.h"
#include "helper.h"
PLUGIN_HEADER
@ -379,7 +380,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
/* set everything up.. no BL timeout, no backdrop,
white-text-on-black-background. */
rb->backlight_set_timeout(1);
backlight_force_on(); /* backlight control in lib/helper.c */
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
rb->lcd_set_background(LCD_BLACK);
@ -535,7 +536,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
break;
}
}
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true);

View file

@ -20,6 +20,7 @@
****************************************************************************/
#include "plugin.h"
#include "helper.h"
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
#include "gray.h"
@ -85,8 +86,8 @@ void cleanup(void *parameter)
(void)parameter;
gray_release(); /* switch off overlay and deinitialize */
/* restore normal backlight setting */
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
}
/* this is only a demo of what the framework can do */
@ -170,8 +171,8 @@ int main(void)
110,110,110,110,110,110,110
};
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1); /* keep the light on */
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
rb->lcd_setfont(FONT_SYSFIXED); /* select default font */

View file

@ -25,6 +25,7 @@
#include "plugin.h"
#include "highscore.h"
#include "helper.h"
PLUGIN_HEADER
@ -1764,9 +1765,8 @@ enum plugin_status plugin_start(struct plugin_api* api, UNUSED void* parameter)
rb = api;
rb->lcd_setfont(FONT_SYSFIXED);
/* Permanently enable the backlight (unless the user has turned it off) */
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1);
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
/* now go ahead and have fun! */
game_loop();
@ -1783,7 +1783,8 @@ enum plugin_status plugin_start(struct plugin_api* api, UNUSED void* parameter)
/* Restore user's original backlight setting */
rb->lcd_setfont(FONT_UI);
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
return PLUGIN_OK;
}

View file

@ -27,6 +27,7 @@
#include "plugin.h"
#include "playback_control.h"
#include "oldmenuapi.h"
#include "helper.h"
#ifdef HAVE_LCD_BITMAP
#include "gray.h"
@ -3309,14 +3310,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
buf_images = buf; buf_images_size = buf_size;
/* make sure the backlight is always on when viewing pictures
(actually it should also set the timeout when plugged in,
but the function backlight_set_timeout_plugged is not
available in plugins) */
#ifdef HAVE_BACKLIGHT
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1);
#endif
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
do
{
@ -3339,10 +3334,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->ata_spindown(rb->global_settings->disk_spindown);
#endif
#ifdef HAVE_BACKLIGHT
/* reset backlight settings */
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
#endif
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
#ifdef USEGSLIB
gray_release(); /* deinitialize */

View file

@ -26,11 +26,13 @@ extern struct plugin_api* rb;
void backlight_force_on(void)
{
#ifdef HAVE_BACKLIGHT
if (rb->global_settings->backlight_timeout > 1)
rb->backlight_set_timeout(1);
#if CONFIG_CHARGING
if (rb->global_settings->backlight_timeout_plugged > 1)
rb->backlight_set_timeout_plugged(1);
#endif
#endif
#endif /* CONFIG_CHARGING */
#endif /* HAVE_BACKLIGHT */
}
/* reset backlight operation to its settings */
@ -41,6 +43,6 @@ void backlight_use_settings(void)
#if CONFIG_CHARGING
rb->backlight_set_timeout_plugged(rb->global_settings-> \
backlight_timeout_plugged);
#endif
#endif
#endif /* CONFIG_CHARGING */
#endif /* HAVE_BACKLIGHT */
}

View file

@ -1857,7 +1857,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->lcd_clear_display();
rb->lcd_update();
backlight_force_on();
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true);
@ -1994,7 +1995,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
backlight_use_settings();
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
return status;
}

View file

@ -20,6 +20,7 @@
****************************************************************************/
#include "plugin.h"
#include "helper.h"
#ifdef HAVE_LCD_BITMAP
#include "xlcd.h"
@ -562,9 +563,8 @@ void cleanup(void *parameter)
rb->lcd_set_foreground(LCD_DEFAULT_FG);
rb->lcd_set_background(LCD_DEFAULT_BG);
#endif
#ifdef HAVE_LCD_COLOR
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
#endif
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
}
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
@ -593,9 +593,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->lcd_clear_display();
rb->lcd_update();
#endif
#ifdef HAVE_LCD_COLOR
rb->backlight_set_timeout(1); /* keep the light on */
#endif
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
rb->lcd_getstringsize("A", NULL, &font_height);
while (!exit)

View file

@ -23,6 +23,7 @@
****************************************************************************/
#include "plugin.h"
#include "helper.h"
#ifdef HAVE_LCD_BITMAP
@ -170,7 +171,8 @@ void cleanup(void *parameter)
#ifndef HAVE_LCD_COLOR
gray_release();
#endif
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
}
/*
@ -299,8 +301,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1);/* keep the light on */
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
ret = main();

View file

@ -21,6 +21,7 @@
#include "plugin.h"
#include "highscore.h"
#include "playergfx.h"
#include "helper.h"
PLUGIN_HEADER
@ -853,17 +854,14 @@ static int rockblox_loop (void)
while (1) {
#ifdef HAS_BUTTON_HOLD
if (rb->button_hold ()) {
/* Restore user's original backlight setting */
rb->backlight_set_timeout (rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
rb->splash(0, "Paused");
while (rb->button_hold ())
rb->sleep(HZ/10);
/* Permanently enable the backlight (unless the user has
turned it off) */
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout (1);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
/* get rid of the splash text */
rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT);
@ -1031,9 +1029,8 @@ enum plugin_status plugin_start (struct plugin_api *api, void *parameter)
return PLUGIN_OK;
}
#endif
/* Permanently enable the backlight (unless the user has turned it off) */
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout (1);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
init_rockblox ();
ret = rockblox_loop ();

View file

@ -20,6 +20,8 @@
#include "plugin.h"
#include "math.h"
#include "stdio.h"
#include "helper.h"
PLUGIN_HEADER
/******************************* Globals ***********************************/
@ -1935,13 +1937,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->lcd_set_backdrop(NULL);
#endif
rb->lcd_setfont(FONT_SYSFIXED);
rb->backlight_set_timeout(1);
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
iohiscore();
retval = start_game();
iohiscore();
rb->lcd_setfont(FONT_UI);
/* restore normal backlight setting*/
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
return retval;
}

View file

@ -16,6 +16,7 @@
****************************************************************************/
#include "plugin.h"
#include "helper.h"
#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
@ -364,7 +365,8 @@ int plugin_main(void)
#endif
case(STARFIELD_QUIT):
case(SYS_USB_CONNECTED):
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c*/
return PLUGIN_OK;
break;
}
@ -379,8 +381,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb = api; /* copy to global api pointer */
(void)parameter;
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1);/* keep the light on */
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
ret = plugin_main();

View file

@ -19,6 +19,7 @@
#include "plugin.h"
#include "oldmenuapi.h"
#include "helper.h"
PLUGIN_HEADER
@ -437,16 +438,16 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->srand(*rb->current_tick);
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1); /* keep the light on */
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
m = menu_init(rb, items, sizeof(items) / sizeof(*items), NULL,
NULL, NULL, NULL);
menu_run(m);
menu_exit(m);
/* restore normal backlight setting */
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
rb->rmdir(testbasedir);

View file

@ -27,6 +27,7 @@
#include "plugin.h"
#include "sh7034.h"
#include "system.h"
#include "helper.h"
#ifndef SIMULATOR /* not for simulator by now */
#ifdef HAVE_LCD_BITMAP /* and definitely not for the Player, haha */
@ -559,8 +560,8 @@ void Cleanup(void *fd)
if (gPlay.bHasAudio)
rb->mp3_play_stop(); /* stop audio ISR */
/* restore normal backlight setting */
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
/* restore normal contrast */
rb->lcd_set_contrast(rb->global_settings->contrast);
@ -924,8 +925,8 @@ int main(char* filename)
if (gFileHdr.video_format == VIDEOFORMAT_RAW)
{
gPlay.bHasVideo = true;
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1); /* keep the light on */
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
}
/* prepare audio playback, if contained */

View file

@ -18,6 +18,7 @@
****************************************************************************/
#include "plugin.h"
#include "configfile.h"
#include "helper.h"
PLUGIN_HEADER
@ -2332,9 +2333,8 @@ bool launch_wormlet(void)
rb->lcd_clear_display();
/* Permanently enable the backlight (unless the user has turned it off) */
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(1);
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
/* start the game */
while (game_result == 1)
@ -2343,8 +2343,8 @@ bool launch_wormlet(void)
switch (game_result)
{
case 2:
/* Restore user's original backlight setting */
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
return false;
break;
}

View file

@ -19,6 +19,7 @@
****************************************************************************/
#include "plugin.h"
#include "helper.h"
PLUGIN_HEADER
@ -932,9 +933,8 @@ enum plugin_status plugin_start (struct plugin_api *api, void *parameter)
rb->lcd_set_backdrop(NULL);
#endif
/* Permanently enable the backlight (unless the user has turned it off) */
if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout (1);
/* Turn off backlight timeout */
backlight_force_on(); /* backlight control in lib/helper.c */
quit = false;
@ -944,7 +944,8 @@ enum plugin_status plugin_start (struct plugin_api *api, void *parameter)
ret = xobox_loop ();
}
rb->backlight_set_timeout (rb->global_settings->backlight_timeout);
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
rb->lcd_setfont (FONT_UI);
return ret;