完整的金手指树选择

This commit is contained in:
anod 2023-01-19 15:18:10 +08:00
parent df0f2d8947
commit 90f9624b2a

View File

@ -265,6 +265,44 @@ static atp_error_t select_region( atp_callerdata_t data, atp_counter_t index, at
return ATP_SUCCESS; return ATP_SUCCESS;
} }
static atp_error_t select_holes( atp_callerdata_t d, atp_counter_t index, atp_itemcfg_t *cfg )
{
acl_text_t text;
acl_error_t res = acl_entry_get_label(index, &text);
if( res == ACHTLIB_SUCCESS )
cfg->text = text;
else cfg->text = "无效数据";
cfg->value = 1+index;
return ATP_SUCCESS;
}
static atp_error_t select_onoff( atp_callerdata_t data, atp_counter_t index, atp_itemcfg_t *cfg )
{
acl_entryid_t eid = (acl_entryid_t)data;
cfg->text = index == 0 ? "不开启" : "开启";
cfg->value = index << 16 | eid;
return ATP_SUCCESS;
}
static atp_error_t select_keys( atp_callerdata_t data, atp_counter_t index, atp_itemcfg_t *cfg )
{
acl_text_t text;
if( index == 0 )
{
cfg->text = "不开启";
}
else
{
acl_error_t res = acl_entry_get_label(index-1, &text);
if( res == ACHTLIB_SUCCESS )
cfg->text = text;
else cfg->text = "无效数据";
}
acl_entryid_t eid = (acl_entryid_t)data;
cfg->value = index<<16 | eid;
return ATP_SUCCESS;
}
extern atp_error_t oaf_config_page(); extern atp_error_t oaf_config_page();
#define DIRBUFFSIZE 512 #define DIRBUFFSIZE 512
@ -333,7 +371,52 @@ static atp_pageopt_t serve_on_key( atp_callerdata_t data, atp_counter_t index, a
// 显示配置页面 // 显示配置页面
atp_error_t res; atp_error_t res;
atp_itemval_t item; atp_itemval_t item;
res = atp_select("选择一个金手指配置", len, select_region, NULL, NULL, 0, 0, &item ); acl_elemlen_t cnt;
#define DISP_DONE 0
#define DISP_REGION 1
#define DISP_HOLES 2
#define DISP_KEYS 3
uint8_t status = DISP_REGION;
while( status != DISP_DONE )
{
acl_entryid_t eid;
if( status == DISP_REGION )
{
res = atp_select("选择一个金手指配置", len, select_region, NULL, NULL, 0, 0, &item );
if( res == ATP_SUCCESS )
{
acl_chtid_t sid = (acl_chtid_t)item;
acl_select_cheat_set( sid );
status = DISP_HOLES;
}
else status = DISP_DONE;
}
else if( status == DISP_HOLES )
{
acl_select_entry(0, &cnt);
res = atp_select("选择一个金手指项目", cnt, select_holes, NULL, NULL, 0, 0, &item);
if( res == ATP_SUCCESS )
{
eid = (acl_entryid_t)item;
acl_select_entry(eid, &cnt);
res = DISP_KEYS;
}
else status = DISP_REGION;
}
else // DISP_KEYS
{
res = atp_select("选择此项目对应的设置", cnt==0 ? 2:cnt, cnt==0 ? select_onoff : select_keys, NULL, eid, 0, 0, &item);
if( res == ATP_SUCCESS )
{
char tmp[20];
ee_sprintf(tmp, "sel %08x", item);
DEBUG(tmp);
}
status = DISP_HOLES;
}
}
acl_close_lib(); acl_close_lib();
return WAIT_ON_ACT( res ); return WAIT_ON_ACT( res );