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:
parent
feb75d43c8
commit
bf2a33485f
8 changed files with 71 additions and 37 deletions
|
@ -525,6 +525,13 @@ static const struct plugin_api rockbox_api = {
|
|||
|
||||
file_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)
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||
|
||||
/* 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
|
||||
backwards compatibility (and please take the opportunity to sort in any
|
||||
|
@ -649,6 +649,12 @@ struct plugin_api {
|
|||
bool (*file_exists)(const char *file);
|
||||
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 */
|
||||
|
|
|
@ -78,11 +78,11 @@ void clock_settings_reset(struct clock_settings* settings){
|
|||
void apply_backlight_setting(int backlight_setting)
|
||||
{
|
||||
if(backlight_setting == ALWAS_OFF)
|
||||
rb->backlight_set_timeout(0);
|
||||
rb->backlight_set_timeout(-1);
|
||||
else if(backlight_setting == ROCKBOX_SETTING)
|
||||
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
|
||||
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){
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#include "pluginlib_actions.h"
|
||||
#include "helper.h"
|
||||
PLUGIN_HEADER
|
||||
|
||||
#define DEFAULT_WAIT_TIME 3
|
||||
|
@ -255,9 +256,9 @@ void cleanup(void *parameter)
|
|||
{
|
||||
(void)parameter;
|
||||
|
||||
rb->screens[SCREEN_MAIN]->backlight_set_timeout(rb->global_settings->backlight_timeout);
|
||||
#if NB_SCREENS==2
|
||||
rb->screens[SCREEN_REMOTE]->backlight_set_timeout(rb->global_settings->remote_backlight_timeout);
|
||||
backlight_use_settings(rb);
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
remote_backlight_use_settings(rb);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -428,16 +429,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
|||
int ret;
|
||||
|
||||
rb = api; /* copy to global api pointer */
|
||||
(void)parameter;
|
||||
#if LCD_DEPTH > 1
|
||||
rb->lcd_set_backdrop(NULL);
|
||||
#endif
|
||||
(void)parameter;
|
||||
if (rb->global_settings->backlight_timeout > 0)
|
||||
{
|
||||
int i;
|
||||
FOR_NB_SCREENS(i)
|
||||
rb->screens[i]->backlight_set_timeout(1);/* keep the light on */
|
||||
}
|
||||
backlight_force_on(rb); /* backlight control in lib/helper.c */
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
remote_backlight_force_on(rb); /* remote backlight control in lib/helper.c */
|
||||
#endif
|
||||
ret = plugin_main();
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -19,37 +19,55 @@
|
|||
|
||||
#include "plugin.h"
|
||||
|
||||
/*
|
||||
* force the backlight on
|
||||
* now enabled regardless of HAVE_BACKLIGHT because it is not needed to
|
||||
* build and makes modded targets easier to update
|
||||
*/
|
||||
/* Force the backlight on */
|
||||
void backlight_force_on(struct plugin_api* rb)
|
||||
{
|
||||
if(!rb) return;
|
||||
/* #ifdef HAVE_BACKLIGHT */
|
||||
if(!rb)
|
||||
return;
|
||||
if (rb->global_settings->backlight_timeout > 0)
|
||||
rb->backlight_set_timeout(0);
|
||||
#if CONFIG_CHARGING
|
||||
if (rb->global_settings->backlight_timeout_plugged > 0)
|
||||
rb->backlight_set_timeout_plugged(0);
|
||||
#endif /* CONFIG_CHARGING */
|
||||
/* #endif */ /* HAVE_BACKLIGHT */
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
/* Reset backlight operation to its settings */
|
||||
void backlight_use_settings(struct plugin_api* rb)
|
||||
{
|
||||
if(!rb) return;
|
||||
/* #ifdef HAVE_BACKLIGHT */
|
||||
if (!rb)
|
||||
return;
|
||||
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
|
||||
#if CONFIG_CHARGING
|
||||
rb->backlight_set_timeout_plugged(rb->global_settings-> \
|
||||
rb->backlight_set_timeout_plugged(rb->global_settings->
|
||||
backlight_timeout_plugged);
|
||||
#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 */
|
||||
|
|
|
@ -26,5 +26,9 @@
|
|||
*/
|
||||
void backlight_force_on(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
|
||||
|
|
|
@ -1118,8 +1118,7 @@ enum plugin_status plugin_start (struct plugin_api *api, void *parameter)
|
|||
#endif
|
||||
/* Save user's HighScore */
|
||||
highscore_save(HIGH_SCORE,Highest,MAX_HIGH_SCORES);
|
||||
/* Restore user's original backlight setting */
|
||||
rb->backlight_set_timeout (rb->global_settings->backlight_timeout);
|
||||
backlight_use_settings(rb); /* backlight control in lib/helper.c */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
|
||||
#include "plugin.h"
|
||||
#include "pluginlib_actions.h"
|
||||
#include "helper.h"
|
||||
|
||||
PLUGIN_HEADER
|
||||
|
||||
|
@ -405,7 +406,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
|||
(void)parameter;
|
||||
rb = api;
|
||||
|
||||
rb->backlight_set_timeout(1);
|
||||
backlight_force_on(rb); /* backlight control in lib/helper.c */
|
||||
#if LCD_DEPTH > 1
|
||||
rb->lcd_set_backdrop(NULL);
|
||||
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->backlight_set_timeout(rb->global_settings->backlight_timeout);
|
||||
backlight_use_settings(rb); /* backlight control in lib/helper.c */
|
||||
return PLUGIN_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue