1
0
Fork 0
forked from len0rd/rockbox

Fix some plugins not using the helper functions for the new backlight timeout handling.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15849 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2007-11-29 23:55:58 +00:00
parent feb75d43c8
commit bf2a33485f
8 changed files with 71 additions and 37 deletions

View file

@ -525,6 +525,13 @@ static const struct plugin_api rockbox_api = {
file_exists, file_exists,
dir_exists, dir_exists,
#ifdef HAVE_REMOTE_LCD
remote_backlight_set_timeout,
#if CONFIG_CHARGING
remote_backlight_set_timeout_plugged,
#endif
#endif /* HAVE_REMOTE_LCD */
}; };
int plugin_load(const char* plugin, void* parameter) int plugin_load(const char* plugin, void* parameter)

View file

@ -113,7 +113,7 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */ #define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */ /* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 90 #define PLUGIN_API_VERSION 91
/* update this to latest version if a change to the api struct breaks /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
@ -648,7 +648,13 @@ struct plugin_api {
bool (*file_exists)(const char *file); bool (*file_exists)(const char *file);
bool (*dir_exists)(const char *path); bool (*dir_exists)(const char *path);
#ifdef HAVE_REMOTE_LCD
void (*remote_backlight_set_timeout)(int index);
#if CONFIG_CHARGING
void (*remote_backlight_set_timeout_plugged)(int index);
#endif
#endif /* HAVE_REMOTE_LCD */
}; };
/* plugin header */ /* plugin header */

View file

@ -78,11 +78,11 @@ void clock_settings_reset(struct clock_settings* settings){
void apply_backlight_setting(int backlight_setting) void apply_backlight_setting(int backlight_setting)
{ {
if(backlight_setting == ALWAS_OFF) if(backlight_setting == ALWAS_OFF)
rb->backlight_set_timeout(0); rb->backlight_set_timeout(-1);
else if(backlight_setting == ROCKBOX_SETTING) else if(backlight_setting == ROCKBOX_SETTING)
rb->backlight_set_timeout(rb->global_settings->backlight_timeout); rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
else if(backlight_setting == ALWAYS_ON) else if(backlight_setting == ALWAYS_ON)
rb->backlight_set_timeout(1); rb->backlight_set_timeout(0);
} }
void clock_settings_skin_next(struct clock_settings* settings){ void clock_settings_skin_next(struct clock_settings* settings){

View file

@ -23,6 +23,7 @@
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#include "pluginlib_actions.h" #include "pluginlib_actions.h"
#include "helper.h"
PLUGIN_HEADER PLUGIN_HEADER
#define DEFAULT_WAIT_TIME 3 #define DEFAULT_WAIT_TIME 3
@ -255,9 +256,9 @@ void cleanup(void *parameter)
{ {
(void)parameter; (void)parameter;
rb->screens[SCREEN_MAIN]->backlight_set_timeout(rb->global_settings->backlight_timeout); backlight_use_settings(rb);
#if NB_SCREENS==2 #ifdef HAVE_REMOTE_LCD
rb->screens[SCREEN_REMOTE]->backlight_set_timeout(rb->global_settings->remote_backlight_timeout); remote_backlight_use_settings(rb);
#endif #endif
} }
@ -428,16 +429,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
int ret; int ret;
rb = api; /* copy to global api pointer */ rb = api; /* copy to global api pointer */
(void)parameter;
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
#endif #endif
(void)parameter; backlight_force_on(rb); /* backlight control in lib/helper.c */
if (rb->global_settings->backlight_timeout > 0) #ifdef HAVE_REMOTE_LCD
{ remote_backlight_force_on(rb); /* remote backlight control in lib/helper.c */
int i; #endif
FOR_NB_SCREENS(i)
rb->screens[i]->backlight_set_timeout(1);/* keep the light on */
}
ret = plugin_main(); ret = plugin_main();
return ret; return ret;

View file

@ -19,37 +19,55 @@
#include "plugin.h" #include "plugin.h"
/* /* Force the backlight on */
* force the backlight on
* now enabled regardless of HAVE_BACKLIGHT because it is not needed to
* build and makes modded targets easier to update
*/
void backlight_force_on(struct plugin_api* rb) void backlight_force_on(struct plugin_api* rb)
{ {
if(!rb) return; if(!rb)
/* #ifdef HAVE_BACKLIGHT */ return;
if (rb->global_settings->backlight_timeout > 0) if (rb->global_settings->backlight_timeout > 0)
rb->backlight_set_timeout(0); rb->backlight_set_timeout(0);
#if CONFIG_CHARGING #if CONFIG_CHARGING
if (rb->global_settings->backlight_timeout_plugged > 0) if (rb->global_settings->backlight_timeout_plugged > 0)
rb->backlight_set_timeout_plugged(0); rb->backlight_set_timeout_plugged(0);
#endif /* CONFIG_CHARGING */ #endif /* CONFIG_CHARGING */
/* #endif */ /* HAVE_BACKLIGHT */ }
}
/* /* Reset backlight operation to its settings */
* reset backlight operation to its settings
* now enabled regardless of HAVE_BACKLIGHT because it is not needed to
* build and makes modded targets easier to update
*/
void backlight_use_settings(struct plugin_api* rb) void backlight_use_settings(struct plugin_api* rb)
{ {
if(!rb) return; if (!rb)
/* #ifdef HAVE_BACKLIGHT */ return;
rb->backlight_set_timeout(rb->global_settings->backlight_timeout); rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
#if CONFIG_CHARGING #if CONFIG_CHARGING
rb->backlight_set_timeout_plugged(rb->global_settings-> \ rb->backlight_set_timeout_plugged(rb->global_settings->
backlight_timeout_plugged); backlight_timeout_plugged);
#endif /* CONFIG_CHARGING */ #endif /* CONFIG_CHARGING */
/* #endif */ /* HAVE_BACKLIGHT */
} }
#ifdef HAVE_REMOTE_LCD
/* Force the backlight on */
void remote_backlight_force_on(struct plugin_api* rb)
{
if (!rb)
return;
if (rb->global_settings->remote_backlight_timeout > 0)
rb->remote_backlight_set_timeout(0);
#if CONFIG_CHARGING
if (rb->global_settings->remote_backlight_timeout_plugged > 0)
rb->remote_backlight_set_timeout_plugged(0);
#endif /* CONFIG_CHARGING */
}
/* Reset backlight operation to its settings */
void remote_backlight_use_settings(struct plugin_api* rb)
{
if (!rb)
return;
rb->remote_backlight_set_timeout(rb->global_settings->
remote_backlight_timeout);
#if CONFIG_CHARGING
rb->remote_backlight_set_timeout_plugged(rb->global_settings->
remote_backlight_timeout_plugged);
#endif /* CONFIG_CHARGING */
}
#endif /* HAVE_REMOTE_LCD */

View file

@ -26,5 +26,9 @@
*/ */
void backlight_force_on(struct plugin_api* rb); void backlight_force_on(struct plugin_api* rb);
void backlight_use_settings(struct plugin_api* rb); void backlight_use_settings(struct plugin_api* rb);
#ifdef HAVE_REMOTE_LCD
void remote_backlight_force_on(struct plugin_api* rb);
void remote_backlight_use_settings(struct plugin_api* rb);
#endif
#endif #endif

View file

@ -1118,8 +1118,7 @@ enum plugin_status plugin_start (struct plugin_api *api, void *parameter)
#endif #endif
/* Save user's HighScore */ /* Save user's HighScore */
highscore_save(HIGH_SCORE,Highest,MAX_HIGH_SCORES); highscore_save(HIGH_SCORE,Highest,MAX_HIGH_SCORES);
/* Restore user's original backlight setting */ backlight_use_settings(rb); /* backlight control in lib/helper.c */
rb->backlight_set_timeout (rb->global_settings->backlight_timeout);
return ret; return ret;
} }

View file

@ -60,6 +60,7 @@
#include "plugin.h" #include "plugin.h"
#include "pluginlib_actions.h" #include "pluginlib_actions.h"
#include "helper.h"
PLUGIN_HEADER PLUGIN_HEADER
@ -405,7 +406,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
(void)parameter; (void)parameter;
rb = api; rb = api;
rb->backlight_set_timeout(1); backlight_force_on(rb); /* backlight control in lib/helper.c */
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
rb->lcd_set_background(LCD_DEFAULT_BG); rb->lcd_set_background(LCD_DEFAULT_BG);
@ -482,7 +483,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->yield(); rb->yield();
} }
rb->backlight_set_timeout(rb->global_settings->backlight_timeout); backlight_use_settings(rb); /* backlight control in lib/helper.c */
return PLUGIN_OK; return PLUGIN_OK;
} }