mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-07 06:14:12 +08:00
增加处理亮度的代码
This commit is contained in:
parent
97d2df12bb
commit
ad032e22f5
@ -73,6 +73,7 @@ typedef atp_error_t (*atp_itemprovider_t)(
|
|||||||
|
|
||||||
typedef atp_pageopt_t (*atp_keyhandler_t)(
|
typedef atp_pageopt_t (*atp_keyhandler_t)(
|
||||||
INPUT(atp_callerdata_t) some_data_provided_by_caller,
|
INPUT(atp_callerdata_t) some_data_provided_by_caller,
|
||||||
|
INPUT(atp_counter_t) index_of_selected_item,
|
||||||
INPUT(atp_boolean_t) is_x_key_down,
|
INPUT(atp_boolean_t) is_x_key_down,
|
||||||
INPUT(atp_boolean_t) is_y_key_down,
|
INPUT(atp_boolean_t) is_y_key_down,
|
||||||
INPUT(atp_boolean_t) is_l_key_down,
|
INPUT(atp_boolean_t) is_l_key_down,
|
||||||
|
@ -294,7 +294,7 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t
|
|||||||
{
|
{
|
||||||
if( handler == NULL ) continue;
|
if( handler == NULL ) continue;
|
||||||
|
|
||||||
atp_pageopt_t opt = handler( data, key&KEY_X, key&KEY_Y, key&KEY_L, key&KEY_R, key&KEY_START, key&KEY_SELECT );
|
atp_pageopt_t opt = handler( data, item_sel, key&KEY_X, key&KEY_Y, key&KEY_L, key&KEY_R, key&KEY_START, key&KEY_SELECT );
|
||||||
switch( opt )
|
switch( opt )
|
||||||
{
|
{
|
||||||
case ATP_PAGE_REFRESH:
|
case ATP_PAGE_REFRESH:
|
||||||
|
@ -195,7 +195,7 @@ static void help_page( atp_text_t *wording, atp_counter_t length )
|
|||||||
|
|
||||||
extern void oaf_config_page();
|
extern void oaf_config_page();
|
||||||
|
|
||||||
static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_boolean_t x, atp_boolean_t y, atp_boolean_t l, atp_boolean_t r, atp_boolean_t start, atp_boolean_t select )
|
static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_counter_t, atp_boolean_t x, atp_boolean_t y, atp_boolean_t l, atp_boolean_t r, atp_boolean_t start, atp_boolean_t select )
|
||||||
{
|
{
|
||||||
if( start )
|
if( start )
|
||||||
{
|
{
|
||||||
|
@ -119,15 +119,20 @@ static KHandle g_frameReadyEvent = 0;
|
|||||||
// --------------------------
|
// --------------------------
|
||||||
// code for oaf config page
|
// code for oaf config page
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
#define LIGHT_MIN (MCU_getSystemModel() > 3 ? 16 : 20)
|
||||||
|
#define LIGHT_MAX (MCU_getSystemModel() > 3 ? 142 : 117)
|
||||||
static atp_error_t config_item( atp_callerdata_t data, atp_counter_t index, atp_itemcfg_t *cfg )
|
static atp_error_t config_item( atp_callerdata_t data, atp_counter_t index, atp_itemcfg_t *cfg )
|
||||||
{
|
{
|
||||||
const char *scaler_val[] = {"上屏无缩放", "上屏GPU放大", "上屏DMA放大", "下屏无缩放"};
|
const char *scaler_val[] = {"上屏无缩放", "上屏GPU放大", "上屏DMA放大", "下屏无缩放"};
|
||||||
static char buf[16];
|
static char buf[16];
|
||||||
|
cfg->extra_text_color = ATP_COLOR_GREEN;
|
||||||
if( index == 0 )
|
if( index == 0 )
|
||||||
{
|
{
|
||||||
ee_snprintf(buf, sizeof(buf), "%d", g_oafConfig.backlight);
|
ee_snprintf(buf, sizeof(buf), "%d", g_oafConfig.backlight);
|
||||||
cfg->text = "屏幕亮度";
|
cfg->text = "屏幕亮度";
|
||||||
cfg->extra_text = buf;
|
cfg->extra_text = buf;
|
||||||
|
if( g_oafConfig.backlight == LIGHT_MIN || g_oafConfig == LIGHT_MAX )
|
||||||
|
cfg->extra_text_color = ATP_COLOR_RED;
|
||||||
}
|
}
|
||||||
else if( index == 1 )
|
else if( index == 1 )
|
||||||
{
|
{
|
||||||
@ -145,13 +150,34 @@ static atp_error_t config_item( atp_callerdata_t data, atp_counter_t index, atp_
|
|||||||
cfg->extra_text = g_oafConfig.saveOverride ? "禁用" : "启用";
|
cfg->extra_text = g_oafConfig.saveOverride ? "禁用" : "启用";
|
||||||
}
|
}
|
||||||
cfg->value = index;
|
cfg->value = index;
|
||||||
cfg->extra_text_color = ATP_COLOR_GREEN;
|
|
||||||
return ATP_SUCCESS;
|
return ATP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static atp_pageopt_t config_adjust( atp_callerdata_t data, atp_counter_t index, atp_boolean_t x, atp_boolean_t y, atp_boolean_t l, atp_boolean_t r, atp_boolean_t start, atp_boolean_t select )
|
||||||
|
{
|
||||||
|
if( index == 0 )
|
||||||
|
{
|
||||||
|
u8 light = g_oafConfig.brightness;
|
||||||
|
if( l )
|
||||||
|
{
|
||||||
|
light -= 10;
|
||||||
|
if( light % 10 ) light = light + (10-light%10);
|
||||||
|
}
|
||||||
|
else if( r )
|
||||||
|
{
|
||||||
|
light += 10;
|
||||||
|
if( light % 10 ) light = light - light % 10;
|
||||||
|
}
|
||||||
|
if( light > LIGHT_MAX ) light = LIGHT_MAX;
|
||||||
|
else if( light < LIGHT_MIN ) light = LIGHT_MIN;
|
||||||
|
g_oafConfig.brightness = light;
|
||||||
|
}
|
||||||
|
return ATP_PAGE_UPDATE;
|
||||||
|
}
|
||||||
|
|
||||||
void oaf_config_page()
|
void oaf_config_page()
|
||||||
{
|
{
|
||||||
atp_select( "参数配置", 4, config_item, NULL, NULL, 0, 0, NULL );
|
atp_select( "参数配置", 4, config_item, config_adjust, NULL, 0, 0, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 fixRomPadding(u32 romFileSize)
|
static u32 fixRomPadding(u32 romFileSize)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user