1056 lines
38 KiB
C
1056 lines
38 KiB
C
#include "app_screen_setting.h"
|
||
|
||
TABVIEW_DATA tabdata; //设置页面参数初始化
|
||
|
||
//设置菜单数据初始化
|
||
void tab_data_init(void)
|
||
{
|
||
tabdata.item_cursor = 0; //选项卡的游标(焦点)
|
||
tabdata.item_cursor_prv = 0; //前一刻的选项卡游标
|
||
tabdata.item_page = 1; //当前页
|
||
tabdata.item_page_prv = 1; //前一页
|
||
tabdata.content_cursor = 99; //某一选项卡内部的游标
|
||
tabdata.content_cursor_prv = 99; //前一刻的~
|
||
tabdata.content_focus = 0; //默认无焦点
|
||
|
||
//设置界面的初始默认值
|
||
//ITEMS_0 选项卡0
|
||
item0_data_init();
|
||
|
||
//ITEMS_1
|
||
tabdata.item1_page0_sample_interval = 1500; //ms
|
||
tabdata.item1_page0_plot_num = 5; //曲线上同时显示的点数
|
||
|
||
//ITEMS_2
|
||
tabdata.item2_page0_saveflag = 0; //[0, 1, 2 ] -> [未保存,保存中,已保存]
|
||
tabdata.input_log_temp = 0; //无纸化记录,中转,存入eeprom
|
||
tabdata.output_log_temp = 0; //无纸化记录,中转,存入eeprom
|
||
tabdata.item2_page0_resetflag = 0; //[0, 1, 2 ] -> [未复位,复位中,已复位]
|
||
|
||
//ITEMS_3
|
||
tabdata.item3_page0_lightflag = 0; //照明状态标志,0熄灭,1开启
|
||
tabdata.item3_page0_language = MENU_SIMPLYFY_CHINESE; //语言类型
|
||
}
|
||
|
||
//选项卡 0 数据初始化
|
||
void item0_data_init(void)
|
||
{
|
||
tabdata.item0_page0_vunit = VOLTAGE_V; //电压单位
|
||
tabdata.item0_page1_TCtype = TC_K; //默认为K类型的热电偶
|
||
|
||
|
||
if(tabdata.item2_page0_resetflag != 1)
|
||
{
|
||
//判断eeprom内是否存在数据
|
||
if(eeprom_device_check() == 1)
|
||
{
|
||
eeprom_dataread();
|
||
}
|
||
else
|
||
{
|
||
//针对不存在数据的情况,在eeprom_device_check()中已经进行了处理
|
||
return;
|
||
}
|
||
}
|
||
//eeprom_rd_error_flag = 1;
|
||
|
||
//读取过程中出现过错误,或者触发复位
|
||
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下限
|
||
|
||
//针对复位的情况追加进行保存
|
||
if(tabdata.item2_page0_resetflag == 1)
|
||
{
|
||
eeprom_datasave();
|
||
|
||
//保存状态更改为“已保存”
|
||
tabdata.item2_page0_saveflag = 0;
|
||
set_item1_text(DATA_SAVE);
|
||
}
|
||
}
|
||
}
|
||
|
||
//KEY_SETTING
|
||
void key_functions_setting(void)
|
||
{
|
||
if( (tabdata.item2_page0_saveflag == 1) || (tabdata.item2_page0_resetflag == 1) )
|
||
{
|
||
//复位和保存过程中禁用按键
|
||
return;
|
||
}
|
||
|
||
switch (key)
|
||
{
|
||
case KEY_BACK:
|
||
{
|
||
key = 0;
|
||
|
||
//从设置界面返回主界面
|
||
if(tabdata.content_cursor == 99)
|
||
{
|
||
//下次进入设置页面时,从选项卡0开始
|
||
tabdata.item_cursor = 0;
|
||
|
||
//加载主界面
|
||
setup_scr_screen_main(&guider_ui);
|
||
|
||
//设置项同步
|
||
lv_chart_set_point_count(guider_ui.screen_main_chart_1, tabdata.item1_page0_plot_num);
|
||
for(uint8_t i = 0; i < tabdata.item1_page0_plot_num; i++)
|
||
{
|
||
lv_chart_set_next_value(guider_ui.screen_main_chart_1, guider_ui.screen_main_chart_1_0, 0);
|
||
lv_chart_set_next_value(guider_ui.screen_main_chart_1, guider_ui.screen_main_chart_1_1, 0);
|
||
}
|
||
|
||
delay_cnt(500);
|
||
lv_scr_load(guider_ui.screen_main);
|
||
|
||
//切换至菜单后,清除主界面对象,释放内存
|
||
lv_obj_del(guider_ui.screen_setting);
|
||
|
||
//当前界面为主界面
|
||
m5data.scr_now = SCREEN_MAIN;
|
||
|
||
//恢复之前显示的数据
|
||
scr_main_recover();
|
||
}
|
||
else
|
||
{
|
||
//当不存在焦点时,从内容选择返回选项卡选择
|
||
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:
|
||
{
|
||
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)?(1):(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) > 1)?(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)
|
||
{
|
||
switch (ite)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
//隐藏前一页
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN);
|
||
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);
|
||
|
||
//显示目标页
|
||
switch (page)
|
||
{
|
||
case 1:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "电压单位");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(VOL_UNIT_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "电压上限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(VOL_UP_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "电压下限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_20, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(VOL_LOW_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_21, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "电流上限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_30, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(CURRENT_UP_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_31, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_40, "电流下限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_40, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(CURRENT_LOW_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_41, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_50, "电阻上限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_50, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(RES_UP_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_51, LV_OBJ_FLAG_HIDDEN);
|
||
}
|
||
break;
|
||
|
||
case 2:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "电阻下限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(RES_LOW_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "频率上限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(FRE_UP_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "频率下限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_20, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(FRE_LOW_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_21, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "TC类型");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_30, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(TC_TYPE_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_31, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_40, "TC上限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_40, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(TC_UP_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_41, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_50, "TC下限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_50, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(TC_LOW_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_51, LV_OBJ_FLAG_HIDDEN);
|
||
}
|
||
break;
|
||
|
||
case 3:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "RTD上限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(RTD_UP_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "RTD下限");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item0_text(RTD_LOW_SET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
//更新页码
|
||
set_item0_text(PAGE_PV);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
//隐藏前一页
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN);
|
||
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);
|
||
|
||
//显示目标页
|
||
switch (page)
|
||
{
|
||
case 1:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "采样间隔");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item1_text(SAMPLE_INTERVAL);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "描点数量");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item1_text(PLOT_NUM);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
//更新页码
|
||
set_item1_text(PAGE_PV);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
//隐藏前一页
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN);
|
||
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);
|
||
|
||
//显示目标页
|
||
switch (page)
|
||
{
|
||
case 1:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "参数保存");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item2_text(DATA_SAVE);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "输入记录");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item2_text(INPUT_LOG);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_20, "输出记录");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_20, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item2_text(OUTPUT_LOG);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_21, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_30, "参数复位");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_30, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item2_text(DATA_RESET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_31, LV_OBJ_FLAG_HIDDEN);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
//隐藏前一页
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN);
|
||
lv_obj_add_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN);
|
||
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);
|
||
|
||
//显示目标页
|
||
switch (page)
|
||
{
|
||
case 1:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_00, "照明");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_00, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item3_text(LIGHT_STATUS);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_01, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_10, "语言");
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_10, LV_OBJ_FLAG_HIDDEN);
|
||
|
||
set_item3_text(LANGUAGE_SELECT);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_11, LV_OBJ_FLAG_HIDDEN);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
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个内容
|
||
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);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
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)
|
||
{
|
||
tabdata.item_page = 1;
|
||
//在这里恢复选项卡0第1页的显示内容
|
||
//ITEMS_0
|
||
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);
|
||
set_item0_text(PAGE_PV);
|
||
}
|
||
|
||
// uint8_t eep_test_flag = 0;
|
||
// uint8_t tx = 0, rx = 0;
|
||
// uint8_t addr_test[3] = {0};
|
||
void scr_setting_run(void) //详细设置界面
|
||
{
|
||
if(tabdata.item2_page0_saveflag == 1)
|
||
{
|
||
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);
|
||
}
|
||
}
|
||
}
|
||
|
||
if(tabdata.item2_page0_resetflag == 1)
|
||
{
|
||
reset_cnt++;
|
||
if(reset_cnt > 5)
|
||
{
|
||
reset_cnt = 0;
|
||
tabdata.item2_page0_resetflag = 2;
|
||
|
||
set_item2_text(DATA_RESET);
|
||
}
|
||
}
|
||
|
||
// if(eep_test_flag == 1)
|
||
// {
|
||
// eep_test_flag = 0;
|
||
|
||
// int addr_test_long = 0;
|
||
// addr_test_long += addr_test[0]<<16;
|
||
// addr_test_long += addr_test[1]<<8;
|
||
// addr_test_long += addr_test[2];
|
||
|
||
// rx = eeprom_readdata(addr_test_long);
|
||
// }
|
||
}
|
||
|
||
|