修正了L/R出错的问题

添加了其他几个参数的处理
This commit is contained in:
anod 2022-10-17 14:37:21 +08:00
parent 08c1878867
commit 2447941e6c
2 changed files with 22 additions and 16 deletions

View File

@ -231,6 +231,7 @@ static void draw_options( int start_row, int start_idx, int option_cnt, int sele
}
}
#define HIT( hit ) ( (hit & key) != 0 )
#define SELECTED_ROW(top, len, sel) (((top) < (len)) ? ((len)-(top)+(sel)) : ((sel)+(len)-(top)))
#define REFRESH_PAGE { \
set_paging( idx_top, title_len+cnt ); \
@ -302,7 +303,7 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t
{
if( handler == NULL ) continue;
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 );
atp_pageopt_t opt = handler( data, item_sel, HIT(KEY_X), HIT(KEY_Y), HIT(KEY_L), HIT(KEY_R), HIT(KEY_START), HIT(KEY_SELECT) );
switch( opt )
{
case ATP_PAGE_REFRESH:

View File

@ -155,6 +155,9 @@ static atp_error_t config_item( atp_callerdata_t data, atp_counter_t index, atp_
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( l || r )
{
if( index == 0 )
{
u8 light = g_oafConfig.backlight;
@ -168,12 +171,14 @@ static atp_pageopt_t config_adjust( atp_callerdata_t data, atp_counter_t index,
light += 10;
if( light % 10 ) light -= light % 10;
}
else light -= 1;
if( light > LIGHT_MAX ) light = LIGHT_MAX;
else if( light < LIGHT_MIN ) light = LIGHT_MIN;
g_oafConfig.backlight = light;
}
g_oafConfig.saveOverride = !g_oafConfig.saveOverride;
else if( index == 1 ) g_oafConfig.directBoot = !g_oafConfig.directBoot;
else if( index == 2 ) g_oafConfig.scaler = ( 4 + ( g_oafConfig.scaler+(l?1:-1) ) ) % 4;
else if( index == 3 ) g_oafConfig.saveOverride = !g_oafConfig.saveOverride;
}
return ATP_PAGE_UPDATE;
}