1289 lines
49 KiB
C
1289 lines
49 KiB
C
#include "app_screen_setting.h"
|
||
|
||
TABVIEW_DATA tabdata; //设置页面参数初始化
|
||
int32_t color_table[7] =
|
||
{
|
||
COLOR_BLUE_VALUE,
|
||
COLOR_DARK_BLUE_VALUE,
|
||
COLOR_YELLOW_VALUE,
|
||
COLOR_GREEN_VALUE,
|
||
COLOR_RED_VALUE,
|
||
COLOR_PURPLE_VALUE,
|
||
COLOR_BLACK_VALUE
|
||
};
|
||
|
||
//设置菜单数据初始化
|
||
void tab_data_init(void)
|
||
{
|
||
tabdata.item_cursor = 0; //选项卡的游标(焦点)
|
||
tabdata.item_cursor_prv = 99; //前一刻的选项卡游标
|
||
tabdata.item_page = 1; //当前页
|
||
tabdata.item_page_prv = 1; //前一页
|
||
tabdata.content_cursor = 99; //某一选项卡内部的游标
|
||
tabdata.content_cursor_prv = 99; //前一刻的~
|
||
tabdata.content_focus = 0; //默认无焦点
|
||
|
||
//设置界面的初始默认值
|
||
//EEPROM部分
|
||
eeprom_item_data_init();
|
||
|
||
//ITEMS_0 选项卡0(注释项位于EERPOM读取)
|
||
tabdata.item0_page0_vunit = VOLTAGE_V; //电压单位
|
||
tabdata.item0_page1_TCtype = TC_K; //默认为K类型的热电偶
|
||
|
||
//ITEMS_1(注释项位于EERPOM读取)
|
||
// tabdata.item1_page0_sample_interval = 1500; //ms
|
||
// tabdata.item1_page0_plot_num = 5; //曲线上同时显示的点数
|
||
// tabdata.item1_page0_color_input = COLOR_YELLOW; //输入曲线颜色
|
||
// tabdata.item1_page0_color_output = COLOR_BLUE; //输出曲线颜色
|
||
|
||
//ITEMS_2(注释项位于EERPOM读取)
|
||
tabdata.item2_page0_saveflag = 0;
|
||
memset(tabdata.log_time, 0, sizeof(tabdata.log_time));
|
||
memset(tabdata.input_log_value, 0, sizeof(tabdata.input_log_value));
|
||
memset(tabdata.output_log_value, 0, sizeof(tabdata.output_log_value));
|
||
tabdata.item2_page0_resetflag = 0;
|
||
|
||
//ITEMS_3(注释项位于EERPOM读取)
|
||
tabdata.item3_page0_lightflag = 0; //照明状态标志,0熄灭,1开启
|
||
LIGHT_OFF;
|
||
// tabdata.item3_page0_language = MENU_SIMPLYFY_CHINESE; //语言类型
|
||
|
||
}
|
||
|
||
//选项卡EEPROM部分数据初始化
|
||
void eeprom_item_data_init(void)
|
||
{
|
||
if(tabdata.item2_page0_resetflag != 1)
|
||
{
|
||
//判断eeprom内是否存在数据
|
||
if(eeprom_device_check() == 1)
|
||
{
|
||
eeprom_dataread();
|
||
}
|
||
else
|
||
{
|
||
//针对不存在数据的情况,在eeprom_device_check()中已经进行了处理
|
||
return;
|
||
}
|
||
}
|
||
|
||
//读取过程中出现过错误,或者触发复位
|
||
if( (eeprom_rd_error_flag == 1)||(tabdata.item2_page0_resetflag == 1) )
|
||
{
|
||
tabdata.item0_page0_vup[0] = VOL[0].up; //电压V上限
|
||
tabdata.item0_page0_vlow[0] = VOL[0].low; //电压V下限
|
||
tabdata.item0_page0_vup[1] = VOL[1].up; //电压mV上限
|
||
tabdata.item0_page0_vlow[1] = VOL[1].low; //电压mV下限
|
||
tabdata.item0_page0_cup = CUR.up; //电流上限
|
||
tabdata.item0_page0_clow = CUR.low; //电流下限
|
||
tabdata.item0_page0_rup = RES.up; //电阻上限
|
||
tabdata.item0_page1_rlow = RES.low; //电阻下限
|
||
tabdata.item0_page1_fup = FRE.up; //频率上限
|
||
tabdata.item0_page1_flow = FRE.low; //频率下限
|
||
tabdata.item0_page1_TCup[0] = TC[0].up; //TCK上限
|
||
tabdata.item0_page1_TClow[0] = TC[0].low; //TCK下限
|
||
tabdata.item0_page1_TCup[1] = TC[1].up; //TCS上限
|
||
tabdata.item0_page1_TClow[1] = TC[1].low; //TCS下限
|
||
tabdata.item0_page1_TCup[2] = TC[2].up; //TCN上限
|
||
tabdata.item0_page1_TClow[2] = TC[2].low; //TCN下限
|
||
tabdata.item0_page1_TCup[3] = TC[3].up; //TCB上限
|
||
tabdata.item0_page1_TClow[3] = TC[3].low; //TCB下限
|
||
tabdata.item0_page1_TCup[4] = TC[4].up; //TCE上限
|
||
tabdata.item0_page1_TClow[4] = TC[4].low; //TCE下限
|
||
tabdata.item0_page1_TCup[5] = TC[5].up; //TCJ上限
|
||
tabdata.item0_page1_TClow[5] = TC[5].low; //TCJ下限
|
||
tabdata.item0_page1_TCup[6] = TC[6].up; //TCR上限
|
||
tabdata.item0_page1_TClow[6] = TC[6].low; //TCR下限
|
||
tabdata.item0_page1_TCup[7] = TC[7].up; //TCT上限
|
||
tabdata.item0_page1_TClow[7] = TC[7].low; //TCT下限
|
||
tabdata.item0_page2_RTDup = RTD.up; //RTD上限
|
||
tabdata.item0_page2_RTDlow = RTD.low; //RTD下限
|
||
tabdata.item1_page0_sample_interval = 1500; //采样间隔
|
||
tabdata.item1_page0_plot_num = 5; //描点数量
|
||
tabdata.item1_page0_color_input = COLOR_YELLOW; //输入曲线颜色
|
||
tabdata.item1_page0_color_output = COLOR_BLUE; //输出曲线颜色
|
||
tabdata.item3_page0_language = MENU_SIMPLYFY_CHINESE; //语言选择
|
||
|
||
//针对复位的情况追加进行保存
|
||
if(tabdata.item2_page0_resetflag == 1)
|
||
{
|
||
//eeprom_datasave();
|
||
eeprom_datasave_changed();
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
//KEY_SETTING
|
||
void key_functions_setting(void)
|
||
{
|
||
if( (tabdata.item2_page0_saveflag == 1) || (tabdata.item2_page0_resetflag == 1) )
|
||
{
|
||
//复位和保存过程中禁用按键
|
||
return;
|
||
}
|
||
|
||
switch (key)
|
||
{
|
||
case KEY_BACK:
|
||
{
|
||
//从设置界面返回主界面
|
||
if(tabdata.content_cursor == 99)
|
||
{
|
||
if( m5data.tick_prv == -1 )
|
||
{
|
||
//加载主界面
|
||
lv_scr_load(guider_ui.screen_main);
|
||
scr_main_recover();
|
||
lv_obj_clear_flag(guider_ui.screen_main, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
//隐藏设置界面对象
|
||
lv_obj_add_flag(guider_ui.screen_setting, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
//设置菜单按键使能置零,等待一段时间后切换至主界面的按键功能
|
||
m5data.key_setting_enable = 0;
|
||
|
||
m5data.tick_prv = xTaskGetTickCount(); //记录起始时刻
|
||
}else
|
||
{
|
||
m5data.tick_cur = xTaskGetTickCount(); //记录当前时刻
|
||
|
||
if(m5data.tick_cur < m5data.tick_prv) //防止溢出(当前tick小于前一刻的tick)
|
||
{
|
||
m5data.tick_prv = -1; //溢出后复位并返回
|
||
m5data.tick_cur = -1;
|
||
return;
|
||
}
|
||
|
||
if( (m5data.tick_cur - m5data.tick_prv) >= screen_switch_wait) //tick间隔达到目标后,执行功能
|
||
{
|
||
//等待结束,切换至主界面的按键功能
|
||
m5data.scr_now = SCREEN_MAIN;
|
||
m5data.key_main_enable = 1;
|
||
|
||
key = 0;
|
||
|
||
m5data.tick_prv = -1;
|
||
m5data.tick_cur = -1;
|
||
}
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
key = 0;
|
||
|
||
//当不存在焦点时,从内容选择返回选项卡选择
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
//熄灭当前选中的内容
|
||
setting_contents_check(99, tabdata.content_cursor);
|
||
|
||
//取消内容选中与焦点
|
||
tabdata.content_cursor = 99;
|
||
tabdata.content_cursor_prv = 99;
|
||
tabdata.item_page = 1;
|
||
tabdata.item_page_prv = 1;
|
||
tabdata.content_focus = 0;
|
||
}
|
||
else
|
||
{
|
||
//当存在焦点时,取消焦点,返回内容选择
|
||
tabdata.content_focus = 0;
|
||
setting_contents_check(tabdata.content_cursor, 99);
|
||
|
||
//更新当前游标所在内容的文本(焦点前后不一致)
|
||
uint8_t inner_cursor = 0;
|
||
inner_cursor = tabdata.content_cursor + (tabdata.item_page - 1) * 6;
|
||
switch (tabdata.item_cursor)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
set_item0_text(inner_cursor);
|
||
|
||
if(inner_cursor == VOL_UNIT_SET)
|
||
{
|
||
set_item0_text(VOL_UP_SET);
|
||
set_item0_text(VOL_LOW_SET);
|
||
}
|
||
|
||
if(inner_cursor == TC_TYPE_SET)
|
||
{
|
||
set_item0_text(TC_UP_SET);
|
||
set_item0_text(TC_LOW_SET);
|
||
}
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
set_item1_text(inner_cursor);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
if( (inner_cursor == INPUT_LOG)||(inner_cursor == OUTPUT_LOG) )
|
||
{
|
||
setting_items_page(ITEMS_2, 1);
|
||
return;
|
||
}
|
||
|
||
set_item2_text(inner_cursor);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
set_item3_text(inner_cursor);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
case KEY_UP:
|
||
{
|
||
key = 0;
|
||
|
||
//内部游标为99时,说明未选中任何一个选项卡,此时的up和down用于切换选项卡
|
||
if(tabdata.content_cursor == 99)
|
||
{
|
||
tabdata.item_cursor_prv = tabdata.item_cursor;
|
||
tabdata.item_cursor = (tabdata.item_cursor <= 0)?(3):(tabdata.item_cursor - 1);
|
||
|
||
setting_items_check(tabdata.item_cursor, tabdata.item_cursor_prv);
|
||
}
|
||
else
|
||
{
|
||
//某个选项卡被选中后,某个内容被焦点前,在此处选择内容值
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
switch (tabdata.item_cursor)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
tabdata.content_cursor_prv = tabdata.content_cursor;
|
||
tabdata.content_cursor = ( (tabdata.content_cursor - 1) < 0)?(5):(tabdata.content_cursor - 1);
|
||
|
||
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
tabdata.content_cursor_prv = tabdata.content_cursor;
|
||
tabdata.content_cursor = ( (tabdata.content_cursor - 1) < 0)?(3):(tabdata.content_cursor - 1);
|
||
|
||
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
tabdata.content_cursor_prv = tabdata.content_cursor;
|
||
tabdata.content_cursor = ( (tabdata.content_cursor - 1) < 0)?(3):(tabdata.content_cursor - 1);
|
||
|
||
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
tabdata.content_cursor_prv = tabdata.content_cursor;
|
||
tabdata.content_cursor = ( (tabdata.content_cursor - 1) < 0)?(1):(tabdata.content_cursor - 1);
|
||
|
||
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
//某个内容被焦点后,使用 KEY_LEFT 和 KEY_RIGHT 修改内容,禁用 KEY_UP 和 KEY_DOWN
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
case KEY_DOWN:
|
||
{
|
||
key = 0;
|
||
|
||
//内部游标为99时,说明未选中任何一个选项卡,此时的up和down用于切换选项卡
|
||
if(tabdata.content_cursor == 99)
|
||
{
|
||
tabdata.item_cursor_prv = tabdata.item_cursor;
|
||
tabdata.item_cursor = (tabdata.item_cursor >= 3)?(0):(tabdata.item_cursor + 1);
|
||
|
||
setting_items_check(tabdata.item_cursor, tabdata.item_cursor_prv);
|
||
}
|
||
else
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
//某个内容被焦点前,在此处选择内容值
|
||
switch (tabdata.item_cursor)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
tabdata.content_cursor_prv = tabdata.content_cursor;
|
||
tabdata.content_cursor = ( (tabdata.content_cursor + 1) > 5)?(0):(tabdata.content_cursor + 1);
|
||
|
||
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
tabdata.content_cursor_prv = tabdata.content_cursor;
|
||
tabdata.content_cursor = ( (tabdata.content_cursor + 1) > 3)?(0):(tabdata.content_cursor + 1);
|
||
|
||
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
tabdata.content_cursor_prv = tabdata.content_cursor;
|
||
tabdata.content_cursor = ( (tabdata.content_cursor + 1) > 3)?(0):(tabdata.content_cursor + 1);
|
||
|
||
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
tabdata.content_cursor_prv = tabdata.content_cursor;
|
||
tabdata.content_cursor = ( (tabdata.content_cursor + 1) > 1)?(0):(tabdata.content_cursor + 1);
|
||
|
||
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//某个内容被焦点后,使用 KEY_LEFT 和 KEY_RIGHT 修改内容,禁用 KEY_UP 和 KEY_DOWN
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
case KEY_OK:
|
||
{
|
||
key = 0;
|
||
|
||
if(tabdata.content_cursor == 99)
|
||
{
|
||
//选中某个选项卡后,点亮该选项卡内的第一个内容
|
||
tabdata.content_cursor = 0;
|
||
tabdata.content_cursor_prv = 99;
|
||
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
|
||
}
|
||
else
|
||
{
|
||
//选中选项卡内的某个内容后,焦点当前选中内容
|
||
tabdata.content_focus = 1;
|
||
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
|
||
|
||
//焦点后更新所选内容的文本
|
||
uint8_t inner_cursor = 0;
|
||
inner_cursor = tabdata.content_cursor + (tabdata.item_page - 1) * 6;
|
||
switch (tabdata.item_cursor)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
set_item0_text(inner_cursor);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
set_item1_text(inner_cursor);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
set_item2_text(inner_cursor);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
set_item3_text(inner_cursor);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
case KEY_LEFT:
|
||
{
|
||
key = 0;
|
||
|
||
if( tabdata.content_cursor == 99 )
|
||
{
|
||
//选项卡未选中时,直接返回
|
||
return;
|
||
}
|
||
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
//不存在焦点时,执行翻页操作
|
||
switch (tabdata.item_cursor)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
tabdata.item_page_prv = tabdata.item_page;
|
||
tabdata.item_page = ( (tabdata.item_page - 1) <= 0)?(3):(tabdata.item_page - 1);
|
||
|
||
setting_items_page(ITEMS_0, tabdata.item_page);
|
||
|
||
//翻页后内容游标变为第一个
|
||
tabdata.content_cursor_prv = tabdata.content_cursor;
|
||
tabdata.content_cursor = 0;
|
||
setting_contents_check(99, tabdata.content_cursor_prv);
|
||
setting_contents_check(tabdata.content_cursor, 99);
|
||
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//存在焦点后,修改内容
|
||
uint8_t inner_cursor = 0;
|
||
inner_cursor = tabdata.content_cursor + (tabdata.item_page - 1) * 6;
|
||
setting_contents_modify(tabdata.item_cursor, inner_cursor, -1);
|
||
}
|
||
}
|
||
break;
|
||
|
||
case KEY_RIGHT:
|
||
{
|
||
key = 0;
|
||
|
||
if( tabdata.content_cursor == 99 )
|
||
{
|
||
//选项卡未选中时,直接返回
|
||
return;
|
||
}
|
||
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
//翻页
|
||
switch (tabdata.item_cursor)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
tabdata.item_page_prv = tabdata.item_page;
|
||
tabdata.item_page = ( (tabdata.item_page + 1) >= 4)?(1):(tabdata.item_page + 1);
|
||
|
||
setting_items_page(ITEMS_0, tabdata.item_page);
|
||
|
||
//翻页后内容游标变为第一个
|
||
tabdata.content_cursor_prv = tabdata.content_cursor;
|
||
tabdata.content_cursor = 0;
|
||
setting_contents_check(99, tabdata.content_cursor_prv);
|
||
setting_contents_check(tabdata.content_cursor, 99);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//修改内容
|
||
uint8_t inner_cursor = 0;
|
||
inner_cursor = tabdata.content_cursor + (tabdata.item_page - 1) * 6;
|
||
setting_contents_modify(tabdata.item_cursor, inner_cursor, 1);
|
||
}
|
||
}
|
||
break;
|
||
|
||
default:
|
||
{
|
||
key = 0;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
void setting_items_check(uint8_t cursor, uint8_t cursor_prv)
|
||
{
|
||
tabdata.item_page = 1;
|
||
|
||
//操作选项卡
|
||
switch (cursor) //点亮选项卡,刷新当前选项卡内容至第1页
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_s0, lv_color_hex(COLOR_ITEMS_CHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
||
setting_items_page(ITEMS_0, 1);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_s1, lv_color_hex(COLOR_ITEMS_CHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
||
setting_items_page(ITEMS_1, 1);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_s2, lv_color_hex(COLOR_ITEMS_CHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
||
setting_items_page(ITEMS_2, 1);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_s3, lv_color_hex(COLOR_ITEMS_CHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
|
||
setting_items_page(ITEMS_3, 1);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
switch (cursor_prv) //熄灭前一时刻选项卡,并隐藏选项卡内容(已在 setting_items_page 中实现)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_s0, lv_color_hex(COLOR_ITEMS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_s1, lv_color_hex(COLOR_ITEMS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_s2, lv_color_hex(COLOR_ITEMS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_s3, lv_color_hex(COLOR_ITEMS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
}
|
||
|
||
//当前选项卡内容翻页:隐藏当前页,显示目标页page
|
||
void setting_items_page(uint8_t ite, uint8_t page)
|
||
{
|
||
//特殊处理,避免其他选项卡也被染上颜色
|
||
if(ite != ITEMS_1)
|
||
{
|
||
set_obj_color(guider_ui.screen_setting_label_21, 7);
|
||
set_obj_color(guider_ui.screen_setting_label_31, 7);
|
||
}
|
||
|
||
switch (ite)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
//启用所需组件
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_20, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_20, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_21, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_21, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_30, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_30, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_31, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_31, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_40, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_40, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_41, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_41, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_50, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_50, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_51, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_51, LV_OBJ_FLAG_HIDDEN); };
|
||
|
||
//显示目标页
|
||
switch (page)
|
||
{
|
||
case 1:
|
||
{
|
||
switch (tabdata.item3_page0_language)
|
||
{
|
||
case MENU_SIMPLYFY_CHINESE:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "电压单位");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "电压上限");
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "电压下限");
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "电流上限");
|
||
lv_label_set_text(guider_ui.screen_setting_label_40, "电流下限");
|
||
lv_label_set_text(guider_ui.screen_setting_label_50, "电阻上限");
|
||
}
|
||
break;
|
||
|
||
case MENU_ENGLISH:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "Voltage unit");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "Voltage max");
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "Voltage min");
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "Current max");
|
||
lv_label_set_text(guider_ui.screen_setting_label_40, "Current min");
|
||
lv_label_set_text(guider_ui.screen_setting_label_50, "Res max");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
set_item0_text(VOL_UNIT_SET);
|
||
set_item0_text(VOL_UP_SET);
|
||
set_item0_text(VOL_LOW_SET);
|
||
set_item0_text(CURRENT_UP_SET);
|
||
set_item0_text(CURRENT_LOW_SET);
|
||
set_item0_text(RES_UP_SET);
|
||
}
|
||
break;
|
||
|
||
case 2:
|
||
{
|
||
switch (tabdata.item3_page0_language)
|
||
{
|
||
case MENU_SIMPLYFY_CHINESE:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "电阻下限");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "频率上限");
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "频率下限");
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "热电偶类型");
|
||
lv_label_set_text(guider_ui.screen_setting_label_40, "热电偶上限");
|
||
lv_label_set_text(guider_ui.screen_setting_label_50, "热电偶下限");
|
||
}
|
||
break;
|
||
|
||
case MENU_ENGLISH:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "Res min");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "Freq max");
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "Freq min");
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "TC type");
|
||
lv_label_set_text(guider_ui.screen_setting_label_40, "TC min");
|
||
lv_label_set_text(guider_ui.screen_setting_label_50, "TC max");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
set_item0_text(TC_LOW_SET);
|
||
set_item0_text(TC_UP_SET);
|
||
set_item0_text(TC_TYPE_SET);
|
||
set_item0_text(FRE_LOW_SET);
|
||
set_item0_text(FRE_UP_SET);
|
||
set_item0_text(RES_LOW_SET);
|
||
}
|
||
break;
|
||
|
||
case 3:
|
||
{
|
||
switch (tabdata.item3_page0_language)
|
||
{
|
||
case MENU_SIMPLYFY_CHINESE:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "热电阻上限");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "热电阻下限");
|
||
}
|
||
break;
|
||
|
||
case MENU_ENGLISH:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "RTD min");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "RTD max");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
set_item0_text(RTD_UP_SET);
|
||
set_item0_text(RTD_LOW_SET);
|
||
|
||
//隐藏多余组件
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_20, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_21, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_30, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_31, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_40, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_41, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_50, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_51, LV_OBJ_FLAG_HIDDEN);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
//更新页码
|
||
set_item0_text(PAGE_PV);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
//启用所需组件
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_20, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_20, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_21, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_21, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_30, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_30, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_31, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_31, LV_OBJ_FLAG_HIDDEN); };
|
||
|
||
//显示目标页
|
||
switch (page)
|
||
{
|
||
case 1:
|
||
{
|
||
switch (tabdata.item3_page0_language)
|
||
{
|
||
case MENU_SIMPLYFY_CHINESE:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "采样间隔");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "描点数量");
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "颜色-输入");
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "颜色-输出");
|
||
}
|
||
break;
|
||
|
||
case MENU_ENGLISH:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "Plot gap");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "Plot count");
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "Color-input");
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "Color-output");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
set_item1_text(SAMPLE_INTERVAL);
|
||
set_item1_text(PLOT_NUM);
|
||
set_item1_text(INPUT_COLOR);
|
||
set_item1_text(OUTPUT_COLOR);
|
||
|
||
//隐藏多余组件
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_40, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_41, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_50, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_51, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
//更新页码
|
||
set_item1_text(PAGE_PV);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
//启用所需组件
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_20, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_20, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_21, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_21, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_30, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_30, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_31, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_31, LV_OBJ_FLAG_HIDDEN); };
|
||
|
||
//显示目标页
|
||
switch (page)
|
||
{
|
||
case 1:
|
||
{
|
||
switch (tabdata.item3_page0_language)
|
||
{
|
||
case MENU_SIMPLYFY_CHINESE:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "参数保存");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "输入记录");
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "输出记录");
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "参数复位");
|
||
}
|
||
break;
|
||
|
||
case MENU_ENGLISH:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "Para save");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "Input log");
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "Output log");
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "Para reset");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
set_item2_text(DATA_SAVE);
|
||
set_item2_text(INPUT_LOG);
|
||
set_item2_text(OUTPUT_LOG);
|
||
set_item2_text(DATA_RESET);
|
||
|
||
//隐藏多余组件
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_40, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_41, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_50, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_51, LV_OBJ_FLAG_HIDDEN);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
//更新页码
|
||
set_item2_text(PAGE_PV);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
//启用所需组件
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN); };
|
||
if( lv_obj_has_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN) ) { lv_obj_clear_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN); };
|
||
|
||
//显示目标页
|
||
switch (page)
|
||
{
|
||
case 1:
|
||
{
|
||
switch (tabdata.item3_page0_language)
|
||
{
|
||
case MENU_SIMPLYFY_CHINESE:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "照明");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "语言");
|
||
}
|
||
break;
|
||
|
||
case MENU_ENGLISH:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "Lighting");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "Language");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
set_item3_text(LIGHT_STATUS);
|
||
set_item3_text(LANGUAGE_SELECT);
|
||
|
||
//隐藏多余组件
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_20, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_21, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_30, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_31, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_40, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_41, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_50, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_51, LV_OBJ_FLAG_HIDDEN);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
//更新页码
|
||
set_item3_text(PAGE_PV);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
//设置界面选项卡内部内容选中:点亮cursor;熄灭cursor_prv;焦点focus
|
||
void setting_contents_check(uint8_t cursor, uint8_t cursor_prv)
|
||
{
|
||
//根据焦点与否切换点亮时的颜色
|
||
uint32_t color = 0;
|
||
if(tabdata.content_focus)
|
||
{
|
||
color = COLOR_CONTENTS_FOCUSED;
|
||
}
|
||
else
|
||
{
|
||
color = COLOR_CONTENTS_CHECKED;
|
||
}
|
||
|
||
//点亮cursor
|
||
set_contents_color(cursor, color);
|
||
|
||
//熄灭cursor_prv
|
||
color = COLOR_CONTENTS_UNCHECKED;
|
||
set_contents_color(cursor_prv, color);
|
||
|
||
}
|
||
|
||
//设置界面选项卡内部内容选中之后,修改内容,修改第ite个选项卡的第con个内容
|
||
uint8_t log_page = 1;
|
||
void setting_contents_modify(uint8_t ite, uint8_t con, int8_t step)
|
||
{
|
||
//选中某一选项卡后,对选项卡内部的内容进行选择
|
||
switch (ite)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
set_item0_value(con, step);
|
||
set_item0_text(con);
|
||
|
||
if(tabdata.item2_page0_saveflag == 2) tabdata.item2_page0_saveflag = 0;
|
||
if(tabdata.item2_page0_resetflag == 2) tabdata.item2_page0_resetflag = 0;
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
set_item1_value(con, step);
|
||
set_item1_text(con);
|
||
|
||
if(tabdata.item2_page0_saveflag == 2) tabdata.item2_page0_saveflag = 0;
|
||
if(tabdata.item2_page0_resetflag == 2) tabdata.item2_page0_resetflag = 0;
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
if( con == INPUT_LOG )
|
||
{
|
||
log_page += step;
|
||
if(log_page > 10) log_page = 1;
|
||
if(log_page < 1) log_page = 10;
|
||
|
||
show_IO_log(IO_INPUT, log_page);
|
||
|
||
return;
|
||
}
|
||
|
||
if (con == OUTPUT_LOG)
|
||
{
|
||
log_page += step;
|
||
if(log_page > 10) log_page = 1;
|
||
if(log_page < 1) log_page = 10;
|
||
|
||
show_IO_log(IO_OUTPUT, log_page);
|
||
|
||
return;
|
||
}
|
||
|
||
set_item2_value(con, step);
|
||
set_item2_text(con);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
set_item3_value(con, step);
|
||
set_item3_text(con);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
}
|
||
|
||
//设置内容的底色
|
||
void set_contents_color(uint8_t cursor, uint32_t color)
|
||
{
|
||
switch (cursor)
|
||
{
|
||
case 0:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_01, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
}
|
||
break;
|
||
|
||
case 1:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_11, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
}
|
||
break;
|
||
|
||
case 2:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_21, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
}
|
||
break;
|
||
|
||
case 3:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_31, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
}
|
||
break;
|
||
|
||
case 4:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_41, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
}
|
||
break;
|
||
|
||
case 5:
|
||
{
|
||
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_51, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void scr_setting_recover(void)
|
||
{
|
||
//在这里恢复选项卡0第1页的显示内容
|
||
tabdata.item_cursor = 0;
|
||
tabdata.item_cursor_prv = 99;
|
||
setting_items_check(tabdata.item_cursor, tabdata.item_cursor_prv);
|
||
|
||
setting_laguage_switch(tabdata.item3_page0_language);
|
||
|
||
tabdata.item_page = 1;
|
||
setting_items_page(ITEMS_0 ,tabdata.item_page);
|
||
|
||
}
|
||
|
||
uint8_t reset_step = 0, save_step = 0;
|
||
void scr_setting_run(void) //详细设置界面
|
||
{
|
||
//处理保存事件
|
||
deal_data_save();
|
||
|
||
//处理复位事件
|
||
deal_data_reset();
|
||
}
|
||
|
||
//执行保存功能
|
||
void deal_data_save(void)
|
||
{
|
||
if(tabdata.item2_page0_saveflag == 1)
|
||
{
|
||
if(save_step == 0)
|
||
{
|
||
save_step = 1;
|
||
|
||
//执行保存
|
||
//eeprom_datasave();
|
||
eeprom_datasave_changed();
|
||
}
|
||
else
|
||
{
|
||
save_cnt++;
|
||
if(save_cnt > 5)
|
||
{
|
||
save_cnt = 0;
|
||
|
||
if(eeprom_wrt_error_flag == 0)
|
||
{
|
||
//未出错
|
||
tabdata.item2_page0_saveflag = 2;
|
||
|
||
set_item2_text(DATA_SAVE);
|
||
}
|
||
else
|
||
{
|
||
//出现过错误
|
||
tabdata.item2_page0_saveflag = 0;
|
||
|
||
set_item2_text(DATA_SAVE);
|
||
}
|
||
|
||
save_step = 0;
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
//执行复位功能
|
||
void deal_data_reset(void)
|
||
{
|
||
if(tabdata.item2_page0_resetflag == 1)
|
||
{
|
||
if(reset_step == 0)
|
||
{
|
||
reset_step = 1;
|
||
|
||
//执行复位
|
||
eeprom_item_data_init();
|
||
tabdata.item3_page0_lightflag = 0; //照明状态标志,0熄灭,1开启
|
||
LIGHT_OFF;
|
||
tabdata.item0_page0_vunit = VOLTAGE_V; //电压单位
|
||
tabdata.item0_page1_TCtype = TC_K; //默认为K类型的热电偶
|
||
}
|
||
else
|
||
{
|
||
reset_cnt++;
|
||
if(reset_cnt > 5)
|
||
{
|
||
reset_cnt = 0;
|
||
tabdata.item2_page0_resetflag = 2;
|
||
|
||
//更新本页文本
|
||
//保存状态更改为“已保存”
|
||
tabdata.item2_page0_saveflag = 0;
|
||
set_item2_text(DATA_SAVE);
|
||
|
||
//选项卡与标题
|
||
setting_laguage_switch(tabdata.item3_page0_language);
|
||
|
||
//内容左列
|
||
switch (tabdata.item3_page0_language)
|
||
{
|
||
case MENU_SIMPLYFY_CHINESE:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "参数保存");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "输入记录");
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "输出记录");
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "参数复位");
|
||
}
|
||
break;
|
||
|
||
case MENU_ENGLISH:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "Para save");
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "Input log");
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "Output log");
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "Para reset");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
//内容右列
|
||
set_item2_text(DATA_RESET);
|
||
set_item2_text(DATA_SAVE);
|
||
set_item2_text(INPUT_LOG);
|
||
set_item2_text(OUTPUT_LOG);
|
||
|
||
reset_step = 0;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
//设置界面语言切换(主界面的语言切换在set_working_mode内)
|
||
//此处用于更改标题和选项卡的语言,内容的语言切换在 set_XXX_text & set_XXX_value内
|
||
void setting_laguage_switch(uint8_t lan)
|
||
{
|
||
switch (lan)
|
||
{
|
||
case MENU_SIMPLYFY_CHINESE:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_title, "详细设置");
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_s0, "量程设置");
|
||
lv_label_set_text(guider_ui.screen_setting_label_s1, "曲线设置");
|
||
lv_label_set_text(guider_ui.screen_setting_label_s2, "数据存储");
|
||
lv_label_set_text(guider_ui.screen_setting_label_s3, "系统设置");
|
||
}
|
||
break;
|
||
|
||
case MENU_ENGLISH:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_title, "Detailed Settings");
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_s0, "Range");
|
||
lv_label_set_text(guider_ui.screen_setting_label_s1, "Chart");
|
||
lv_label_set_text(guider_ui.screen_setting_label_s2, "Storage");
|
||
lv_label_set_text(guider_ui.screen_setting_label_s3, "System");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
|