1848 lines
60 KiB
C
1848 lines
60 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 选项卡1
|
||
//{
|
||
tabdata.item1_page0_lightflag = 0; //默认手电熄灭
|
||
tabdata.item1_page0_saveflag = 0;
|
||
tabdata.item1_page0_resetflag = 0;
|
||
//}
|
||
}
|
||
|
||
//选项卡 0 数据初始化
|
||
void item0_data_init(void)
|
||
{
|
||
tabdata.item0_page0_vunit = VOLTAGE_V; //电压单位
|
||
tabdata.item0_page1_TCtype = TC_K; //默认为K类型的热电偶
|
||
|
||
|
||
if(tabdata.item1_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.item1_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.item1_page0_resetflag == 1)
|
||
{
|
||
eeprom_datasave();
|
||
|
||
//保存状态更改为“已保存”
|
||
tabdata.item1_page0_saveflag = 0;
|
||
set_item1_text(DATA_SAVE);
|
||
}
|
||
}
|
||
}
|
||
|
||
//KEY_SETTING
|
||
void key_functions_setting(void)
|
||
{
|
||
if( (tabdata.item1_page0_saveflag == 1) || (tabdata.item1_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);
|
||
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:
|
||
{
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
}
|
||
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)?(2):(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) > 2)?(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:
|
||
{
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
}
|
||
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;
|
||
switch (tabdata.item_cursor)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
inner_cursor = tabdata.content_cursor + (tabdata.item_page - 1) * 6;
|
||
setting_contents_modify(ITEMS_0, inner_cursor, -1);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
inner_cursor = tabdata.content_cursor + (tabdata.item_page - 1) * 6;
|
||
setting_contents_modify(ITEMS_1, inner_cursor, -1);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
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;
|
||
switch (tabdata.item_cursor)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
inner_cursor = tabdata.content_cursor + (tabdata.item_page - 1) * 6;
|
||
setting_contents_modify(ITEMS_0, inner_cursor, 1);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
inner_cursor = tabdata.content_cursor + (tabdata.item_page - 1) * 6;
|
||
setting_contents_modify(ITEMS_1, inner_cursor, 1);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
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(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_item1_text(DATA_SAVE);
|
||
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_item1_text(DATA_RESET);
|
||
lv_obj_clear_flag(guider_ui.screen_setting_label_21, 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);
|
||
}
|
||
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);
|
||
}
|
||
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;
|
||
}
|
||
|
||
//操作内容
|
||
switch (tabdata.item_cursor)
|
||
{
|
||
case ITEMS_0:
|
||
{
|
||
//点亮cursor
|
||
set_contents_color(cursor, color);
|
||
|
||
//熄灭cursor_prv
|
||
color = COLOR_CONTENTS_UNCHECKED;
|
||
set_contents_color(cursor_prv, color);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
//点亮cursor
|
||
set_contents_color(cursor, color);
|
||
|
||
//熄灭cursor_prv
|
||
color = COLOR_CONTENTS_UNCHECKED;
|
||
set_contents_color(cursor_prv, color);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
//设置界面选项卡内部内容选中之后,修改内容,修改第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.item1_page0_saveflag == 2) tabdata.item1_page0_saveflag = 0;
|
||
if(tabdata.item1_page0_resetflag == 2) tabdata.item1_page0_resetflag = 0;
|
||
}
|
||
break;
|
||
|
||
case ITEMS_1:
|
||
{
|
||
set_item1_value(con, step);
|
||
set_item1_text(con);
|
||
}
|
||
break;
|
||
|
||
case ITEMS_2:
|
||
{
|
||
}
|
||
break;
|
||
|
||
case ITEMS_3:
|
||
{
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
}
|
||
|
||
//修改选项卡0的值
|
||
void set_item0_value(uint8_t con, int8_t step)
|
||
{
|
||
uint8_t enum_temp = 0;
|
||
|
||
switch (con)
|
||
{
|
||
case VOL_UNIT_SET:
|
||
{
|
||
if( tabdata.item0_page0_vunit == VOLTAGE_V )
|
||
{
|
||
tabdata.item0_page0_vunit = VOLTAGE_MV;
|
||
}
|
||
else
|
||
{
|
||
tabdata.item0_page0_vunit = VOLTAGE_V;
|
||
}
|
||
|
||
//修改单位后,更新上下限
|
||
set_item0_text(VOL_UP_SET);
|
||
set_item0_text(VOL_LOW_SET);
|
||
}
|
||
break;
|
||
|
||
case VOL_UP_SET:
|
||
{
|
||
if( tabdata.item0_page0_vunit == VOLTAGE_V )
|
||
{
|
||
tabdata.item0_page0_vup[0] = tabdata.item0_page0_vup[0] + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page0_vup[0] > VOL[0].up) tabdata.item0_page0_vup[0] = VOL[0].up;
|
||
if(tabdata.item0_page0_vup[0] < VOL[0].low) tabdata.item0_page0_vup[0] = VOL[0].low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page0_vup[0] < tabdata.item0_page0_vlow[0]) tabdata.item0_page0_vup[0] = tabdata.item0_page0_vlow[0];
|
||
}
|
||
else
|
||
{
|
||
tabdata.item0_page0_vup[1] = tabdata.item0_page0_vup[1] + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page0_vup[1] > VOL[1].up) tabdata.item0_page0_vup[1] = VOL[1].up;
|
||
if(tabdata.item0_page0_vup[1] < VOL[1].low) tabdata.item0_page0_vup[1] = VOL[1].low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page0_vup[1] < tabdata.item0_page0_vlow[1]) tabdata.item0_page0_vup[1] = tabdata.item0_page0_vlow[1];
|
||
}
|
||
}
|
||
break;
|
||
|
||
case VOL_LOW_SET:
|
||
{
|
||
if( tabdata.item0_page0_vunit == VOLTAGE_V )
|
||
{
|
||
tabdata.item0_page0_vlow[0] = tabdata.item0_page0_vlow[0] + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page0_vlow[0] > VOL[0].up) tabdata.item0_page0_vlow[0] = VOL[0].up;
|
||
if(tabdata.item0_page0_vlow[0] < VOL[0].low) tabdata.item0_page0_vlow[0] = VOL[0].low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page0_vlow[0] > tabdata.item0_page0_vup[0]) tabdata.item0_page0_vlow[0] = tabdata.item0_page0_vup[0];
|
||
}
|
||
else
|
||
{
|
||
tabdata.item0_page0_vlow[1] = tabdata.item0_page0_vlow[1] + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page0_vlow[1] > VOL[1].up) tabdata.item0_page0_vlow[1] = VOL[1].up;
|
||
if(tabdata.item0_page0_vlow[1] < VOL[1].low) tabdata.item0_page0_vlow[1] = VOL[1].low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page0_vlow[1] > tabdata.item0_page0_vup[1]) tabdata.item0_page0_vlow[1] = tabdata.item0_page0_vup[1];
|
||
}
|
||
}
|
||
break;
|
||
|
||
case CURRENT_UP_SET:
|
||
{
|
||
tabdata.item0_page0_cup = tabdata.item0_page0_cup + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page0_cup > CUR.up) tabdata.item0_page0_cup = CUR.up;
|
||
if(tabdata.item0_page0_cup < CUR.low) tabdata.item0_page0_cup = CUR.low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page0_cup < tabdata.item0_page0_clow) tabdata.item0_page0_cup = tabdata.item0_page0_clow;
|
||
}
|
||
break;
|
||
|
||
case CURRENT_LOW_SET:
|
||
{
|
||
tabdata.item0_page0_clow = tabdata.item0_page0_clow + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page0_clow > CUR.up) tabdata.item0_page0_clow = CUR.up;
|
||
if(tabdata.item0_page0_clow < CUR.low) tabdata.item0_page0_clow = CUR.low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page0_clow > tabdata.item0_page0_cup) tabdata.item0_page0_clow = tabdata.item0_page0_cup;
|
||
}
|
||
break;
|
||
|
||
case RES_UP_SET:
|
||
{
|
||
tabdata.item0_page0_rup = tabdata.item0_page0_rup + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page0_rup > RES.up) tabdata.item0_page0_rup = RES.up;
|
||
if(tabdata.item0_page0_rup < RES.low) tabdata.item0_page0_rup = RES.low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page0_rup < tabdata.item0_page1_rlow) tabdata.item0_page0_rup = tabdata.item0_page1_rlow;
|
||
}
|
||
break;
|
||
|
||
case RES_LOW_SET:
|
||
{
|
||
tabdata.item0_page1_rlow = tabdata.item0_page1_rlow + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page1_rlow > RES.up) tabdata.item0_page1_rlow = RES.up;
|
||
if(tabdata.item0_page1_rlow < RES.low) tabdata.item0_page1_rlow = RES.low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page1_rlow > tabdata.item0_page0_rup) tabdata.item0_page1_rlow = tabdata.item0_page0_rup;
|
||
}
|
||
break;
|
||
|
||
case FRE_UP_SET:
|
||
{
|
||
tabdata.item0_page1_fup = tabdata.item0_page1_fup + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page1_fup > FRE.up) tabdata.item0_page1_fup = FRE.up;
|
||
if(tabdata.item0_page1_fup < FRE.low) tabdata.item0_page1_fup = FRE.low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page1_fup < tabdata.item0_page1_flow) tabdata.item0_page1_fup = tabdata.item0_page1_flow;
|
||
}
|
||
break;
|
||
|
||
case FRE_LOW_SET:
|
||
{
|
||
tabdata.item0_page1_flow = tabdata.item0_page1_flow + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page1_flow > FRE.up) tabdata.item0_page1_flow = FRE.up;
|
||
if(tabdata.item0_page1_flow < FRE.low) tabdata.item0_page1_flow = FRE.low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page1_flow > tabdata.item0_page1_fup) tabdata.item0_page1_flow = tabdata.item0_page1_fup;
|
||
}
|
||
break;
|
||
|
||
case TC_TYPE_SET:
|
||
{
|
||
enum_temp = (uint8_t)tabdata.item0_page1_TCtype;
|
||
enum_temp = enum_temp + step;
|
||
if(enum_temp > 12) enum_temp = 5;
|
||
if(enum_temp < 5) enum_temp = 12;
|
||
tabdata.item0_page1_TCtype = (SIG_FUNCTIONS_TYPE)enum_temp;
|
||
|
||
//修改单位后,更新上下限
|
||
set_item0_text(TC_UP_SET);
|
||
set_item0_text(TC_LOW_SET);
|
||
}
|
||
break;
|
||
|
||
case TC_UP_SET:
|
||
{
|
||
enum_temp = (uint8_t)tabdata.item0_page1_TCtype;
|
||
enum_temp -= 5;
|
||
|
||
tabdata.item0_page1_TCup[enum_temp]= tabdata.item0_page1_TCup[enum_temp] + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page1_TCup[enum_temp] > TC[enum_temp].up) tabdata.item0_page1_TCup[enum_temp] = TC[enum_temp].up;
|
||
if(tabdata.item0_page1_TCup[enum_temp] < TC[enum_temp].low) tabdata.item0_page1_TCup[enum_temp] = TC[enum_temp].low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page1_TCup[enum_temp] < tabdata.item0_page1_TClow[enum_temp]) tabdata.item0_page1_TCup[enum_temp] = tabdata.item0_page1_TClow[enum_temp];
|
||
}
|
||
break;
|
||
|
||
case TC_LOW_SET:
|
||
{
|
||
enum_temp = (uint8_t)tabdata.item0_page1_TCtype;
|
||
enum_temp -= 5;
|
||
|
||
tabdata.item0_page1_TClow[enum_temp]= tabdata.item0_page1_TClow[enum_temp] + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page1_TClow[enum_temp] > TC[enum_temp].up) tabdata.item0_page1_TClow[enum_temp] = TC[enum_temp].up;
|
||
if(tabdata.item0_page1_TClow[enum_temp] < TC[enum_temp].low) tabdata.item0_page1_TClow[enum_temp] = TC[enum_temp].low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page1_TClow[enum_temp] > tabdata.item0_page1_TCup[enum_temp]) tabdata.item0_page1_TClow[enum_temp] = tabdata.item0_page1_TCup[enum_temp];
|
||
}
|
||
break;
|
||
|
||
case RTD_UP_SET:
|
||
{
|
||
tabdata.item0_page2_RTDup = tabdata.item0_page2_RTDup + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page2_RTDup > RTD.up) tabdata.item0_page2_RTDup = RTD.up;
|
||
if(tabdata.item0_page2_RTDup < RTD.low) tabdata.item0_page2_RTDup = RTD.low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page2_RTDup < tabdata.item0_page2_RTDlow) tabdata.item0_page2_RTDup = tabdata.item0_page2_RTDlow;
|
||
}
|
||
break;
|
||
|
||
case RTD_LOW_SET:
|
||
{
|
||
tabdata.item0_page2_RTDlow = tabdata.item0_page2_RTDlow + step;
|
||
|
||
//上下限幅
|
||
if(tabdata.item0_page2_RTDlow > RTD.up) tabdata.item0_page2_RTDlow = RTD.up;
|
||
if(tabdata.item0_page2_RTDlow < RTD.low) tabdata.item0_page2_RTDlow = RTD.low;
|
||
|
||
//防止自相矛盾
|
||
if(tabdata.item0_page2_RTDlow > tabdata.item0_page2_RTDup) tabdata.item0_page2_RTDlow = tabdata.item0_page2_RTDup;
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
//修改选项卡0的文本
|
||
void set_item0_text(uint8_t con)
|
||
{
|
||
char str_temp[16] = {0};
|
||
uint8_t enum_temp = 0;
|
||
|
||
switch (con)
|
||
{
|
||
case VOL_UNIT_SET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
if(tabdata.item0_page0_vunit == VOLTAGE_V)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_01, "V");
|
||
}
|
||
else if(tabdata.item0_page0_vunit == VOLTAGE_MV)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_01, "mV");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(tabdata.item0_page0_vunit == VOLTAGE_V)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_01, "< V >");
|
||
}
|
||
else if(tabdata.item0_page0_vunit == VOLTAGE_MV)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_01, "< mV >");
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
case VOL_UP_SET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
if(tabdata.item0_page0_vunit == VOLTAGE_V)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page0_vup[0]);
|
||
}
|
||
else if(tabdata.item0_page0_vunit == VOLTAGE_MV)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page0_vup[1]);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(tabdata.item0_page0_vunit == VOLTAGE_V)
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page0_vup[0]);
|
||
}
|
||
else if(tabdata.item0_page0_vunit == VOLTAGE_MV)
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page0_vup[1]);
|
||
}
|
||
}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_11, str_temp);
|
||
}
|
||
break;
|
||
|
||
case VOL_LOW_SET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
if(tabdata.item0_page0_vunit == VOLTAGE_V)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page0_vlow[0]);
|
||
}
|
||
else if(tabdata.item0_page0_vunit == VOLTAGE_MV)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page0_vlow[1]);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(tabdata.item0_page0_vunit == VOLTAGE_V)
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page0_vlow[0]);
|
||
}
|
||
else if(tabdata.item0_page0_vunit == VOLTAGE_MV)
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page0_vlow[1]);
|
||
}
|
||
}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_21, str_temp);
|
||
}
|
||
break;
|
||
|
||
case CURRENT_UP_SET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page0_cup);
|
||
}
|
||
else
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page0_cup);
|
||
}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, str_temp);
|
||
}
|
||
break;
|
||
|
||
case CURRENT_LOW_SET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page0_clow);
|
||
}
|
||
else
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page0_clow);
|
||
}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_41, str_temp);
|
||
}
|
||
break;
|
||
|
||
case RES_UP_SET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page0_rup);
|
||
}
|
||
else
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page0_rup);
|
||
}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_51, str_temp);
|
||
}
|
||
break;
|
||
|
||
case RES_LOW_SET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page1_rlow);
|
||
}
|
||
else
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page1_rlow);
|
||
}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_01, str_temp);
|
||
}
|
||
break;
|
||
|
||
case FRE_UP_SET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page1_fup);
|
||
}
|
||
else
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page1_fup);
|
||
}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_11, str_temp);
|
||
}
|
||
break;
|
||
|
||
case FRE_LOW_SET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page1_flow);
|
||
}
|
||
else
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page1_flow);
|
||
}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_21, str_temp);
|
||
}
|
||
break;
|
||
|
||
case TC_TYPE_SET:
|
||
{
|
||
switch (tabdata.item0_page1_TCtype)
|
||
{
|
||
case TC_K:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "K ℃");
|
||
}
|
||
else
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "< K ℃ >");
|
||
}
|
||
}
|
||
break;
|
||
|
||
case TC_S:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "S ℃");
|
||
}
|
||
else
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "< S ℃ >");
|
||
}
|
||
}
|
||
break;
|
||
|
||
case TC_N:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "N ℃");
|
||
}
|
||
else
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "< N ℃ >");
|
||
}
|
||
}
|
||
break;
|
||
|
||
case TC_B:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "B ℃");
|
||
}
|
||
else
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "< B ℃ >");
|
||
}
|
||
}
|
||
break;
|
||
|
||
case TC_E:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "E ℃");
|
||
}
|
||
else
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "< E ℃ >");
|
||
}
|
||
}
|
||
break;
|
||
|
||
case TC_J:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "J ℃");
|
||
}
|
||
else
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "< J ℃ >");
|
||
}
|
||
}
|
||
break;
|
||
|
||
case TC_R:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "R ℃");
|
||
}
|
||
else
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "< R ℃ >");
|
||
}
|
||
}
|
||
break;
|
||
|
||
case TC_T:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "T ℃");
|
||
}
|
||
else
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_31, "< T ℃ >");
|
||
}
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
}
|
||
break;
|
||
|
||
case TC_UP_SET:
|
||
{
|
||
enum_temp = (uint8_t)tabdata.item0_page1_TCtype;
|
||
enum_temp -= 5;
|
||
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page1_TCup[enum_temp]);
|
||
}
|
||
else
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page1_TCup[enum_temp]);
|
||
}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_41, str_temp);
|
||
}
|
||
break;
|
||
|
||
case TC_LOW_SET:
|
||
{
|
||
enum_temp = (uint8_t)tabdata.item0_page1_TCtype;
|
||
enum_temp -= 5;
|
||
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page1_TClow[enum_temp]);
|
||
}
|
||
else
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page1_TClow[enum_temp]);
|
||
}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_51, str_temp);
|
||
}
|
||
break;
|
||
|
||
case RTD_UP_SET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page2_RTDup);
|
||
}
|
||
else
|
||
{
|
||
sprintf(str_temp,"< %d >",tabdata.item0_page2_RTDup);
|
||
}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_01, str_temp);
|
||
}
|
||
break;
|
||
|
||
case RTD_LOW_SET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
sprintf(str_temp,"%d",tabdata.item0_page2_RTDlow);
|
||
}
|
||
else
|
||
{sprintf(str_temp,"< %d >",tabdata.item0_page2_RTDlow);}
|
||
|
||
lv_label_set_text(guider_ui.screen_setting_label_11, str_temp);
|
||
}
|
||
break;
|
||
|
||
case PAGE_PV:
|
||
{
|
||
sprintf(str_temp,"< %d / %d >",tabdata.item_page, I0_PAGE_MAX);
|
||
lv_label_set_text(guider_ui.screen_setting_label_page, str_temp);
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
//修改选项卡1的值
|
||
int16_t save_cnt = 0, reset_cnt = 0;
|
||
void set_item1_value(uint8_t con, int8_t step)
|
||
{
|
||
switch (con)
|
||
{
|
||
case LIGHT_STATUS:
|
||
{
|
||
if(tabdata.item1_page0_lightflag)
|
||
{
|
||
tabdata.item1_page0_lightflag = 0;
|
||
LIGHT_OFF;
|
||
}
|
||
else
|
||
{
|
||
tabdata.item1_page0_lightflag = 1;
|
||
LIGHT_ON;
|
||
}
|
||
}
|
||
break;
|
||
|
||
case DATA_SAVE:
|
||
{
|
||
if(tabdata.item1_page0_saveflag == 0)
|
||
{
|
||
tabdata.item1_page0_saveflag = 1;
|
||
|
||
//执行保存
|
||
set_item1_text(DATA_SAVE);
|
||
eeprom_datasave();
|
||
save_cnt = 0;
|
||
}
|
||
}
|
||
break;
|
||
|
||
case DATA_RESET:
|
||
{
|
||
if(tabdata.item1_page0_resetflag == 0)
|
||
{
|
||
tabdata.item1_page0_resetflag = 1;
|
||
|
||
//执行复位
|
||
item0_data_init();
|
||
reset_cnt = 0;
|
||
}
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
//修改选项卡1的文本
|
||
void set_item1_text(uint8_t con)
|
||
{
|
||
char str_temp[16] = {0};
|
||
|
||
switch (con)
|
||
{
|
||
case LIGHT_STATUS:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
if(tabdata.item1_page0_lightflag)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_01, "ON");
|
||
}
|
||
else
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_01, "OFF");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if(tabdata.item1_page0_lightflag)
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_01, "< ON >");
|
||
}
|
||
else
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_01, "< OFF >");
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
case DATA_SAVE:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
switch (tabdata.item1_page0_saveflag)
|
||
{
|
||
case 0:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_11, "未保存");
|
||
}
|
||
break;
|
||
|
||
case 1:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_11, "保存中");
|
||
}
|
||
break;
|
||
|
||
case 2:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_11, "已保存");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
switch (tabdata.item1_page0_saveflag)
|
||
{
|
||
case 0:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_11, "< 未保存 >");
|
||
}
|
||
break;
|
||
|
||
case 1:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_11, "< 保存中 >");
|
||
}
|
||
break;
|
||
|
||
case 2:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_11, "< 已保存 >");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
case DATA_RESET:
|
||
{
|
||
if(tabdata.content_focus == 0)
|
||
{
|
||
switch (tabdata.item1_page0_resetflag)
|
||
{
|
||
case 0:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_21, "未复位");
|
||
}
|
||
break;
|
||
|
||
case 1:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_21, "复位中");
|
||
}
|
||
break;
|
||
|
||
case 2:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_21, "已复位");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
switch (tabdata.item1_page0_resetflag)
|
||
{
|
||
case 0:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_21, "< 未复位 >");
|
||
}
|
||
break;
|
||
|
||
case 1:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_21, "< 复位中 >");
|
||
}
|
||
break;
|
||
|
||
case 2:
|
||
{
|
||
lv_label_set_text(guider_ui.screen_setting_label_21, "< 已复位 >");
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
|
||
case PAGE_PV:
|
||
{
|
||
sprintf(str_temp,"< %d / %d >",tabdata.item_page, I1_PAGE_MAX);
|
||
lv_label_set_text(guider_ui.screen_setting_label_page, str_temp);
|
||
}
|
||
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.item1_page0_saveflag == 1)
|
||
{
|
||
save_cnt++;
|
||
if(save_cnt > 5)
|
||
{
|
||
save_cnt = 0;
|
||
|
||
if(eeprom_wrt_error_flag == 0)
|
||
{
|
||
//未出错
|
||
tabdata.item1_page0_saveflag = 2;
|
||
|
||
set_item1_text(DATA_SAVE);
|
||
}
|
||
else
|
||
{
|
||
//出现过错误
|
||
tabdata.item1_page0_saveflag = 0;
|
||
|
||
set_item1_text(DATA_SAVE);
|
||
}
|
||
}
|
||
}
|
||
|
||
if(tabdata.item1_page0_resetflag == 1)
|
||
{
|
||
reset_cnt++;
|
||
if(reset_cnt > 5)
|
||
{
|
||
reset_cnt = 0;
|
||
tabdata.item1_page0_resetflag = 2;
|
||
|
||
set_item1_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);
|
||
// }
|
||
}
|
||
|
||
|