加上调整亮度的代码

This commit is contained in:
anod 2022-10-17 12:30:37 +08:00
parent ad032e22f5
commit 75dfeaf128

View File

@ -131,7 +131,7 @@ static atp_error_t config_item( atp_callerdata_t data, atp_counter_t index, atp_
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 ) if( g_oafConfig.backlight == LIGHT_MIN || g_oafConfig.backlight == LIGHT_MAX )
cfg->extra_text_color = ATP_COLOR_RED; cfg->extra_text_color = ATP_COLOR_RED;
} }
else if( index == 1 ) else if( index == 1 )
@ -157,7 +157,7 @@ static atp_pageopt_t config_adjust( atp_callerdata_t data, atp_counter_t index,
{ {
if( index == 0 ) if( index == 0 )
{ {
u8 light = g_oafConfig.brightness; u8 light = g_oafConfig.backlight;
if( l ) if( l )
{ {
light -= 10; light -= 10;
@ -170,14 +170,19 @@ static atp_pageopt_t config_adjust( atp_callerdata_t data, atp_counter_t index,
} }
if( light > LIGHT_MAX ) light = LIGHT_MAX; if( light > LIGHT_MAX ) light = LIGHT_MAX;
else if( light < LIGHT_MIN ) light = LIGHT_MIN; else if( light < LIGHT_MIN ) light = LIGHT_MIN;
g_oafConfig.brightness = light; g_oafConfig.backlight = light;
} }
return ATP_PAGE_UPDATE; return ATP_PAGE_UPDATE;
} }
void oaf_config_page() void oaf_config_page()
{ {
u8 light = g_oafConfig.backlight;
atp_select( "参数配置", 4, config_item, config_adjust, NULL, 0, 0, NULL ); atp_select( "参数配置", 4, config_item, config_adjust, NULL, 0, 0, NULL );
if( light != g_oafConfig.backlight )
GFX_setBrightness(g_oafConfig.backlight, g_oafConfig.backlight);
} }
static u32 fixRomPadding(u32 romFileSize) static u32 fixRomPadding(u32 romFileSize)