sggt/App/APP_WU/Src/key_functions_setting.c

1074 lines
39 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "key_functions_setting.h"
//KEY_SETTING
uint8_t log_page = 1; //输入/输出记录页面的页码
uint8_t setting_window_cursor = 0, setting_window_cursor_prv = 0; //弹窗内的游标
void key_functions_setting(void)
{
if( key_pv.status == KEY_STATUS_DISABLE ) return;
//临时游标,替代枚举变量进行加减运算
uint8_t cursor_temp = 0;
uint8_t cursor_start = 0;
uint8_t cursor_end = 0;
switch (key_pv.tag)
{
case KEY_BACK:
{
key = 0;
key_char2struct();
switch (current_operation)
{
case SET_ITEM_CHOOSE:
{
//加载主界面
if(!scr_main_set_flag)
{
scr_main_set_flag = 1;
setup_scr_screen_main(&guider_ui);
delay_cnt(200); //不加延时有概率卡死
}
scr_main_recover();
lv_scr_load(guider_ui.screen_main);
lv_obj_clear_flag(guider_ui.screen_main, LV_OBJ_FLAG_HIDDEN);
//隐藏设置界面对象
lv_obj_add_flag(guider_ui.screen_setting, LV_OBJ_FLAG_HIDDEN);
menu_data.scr_now = SCREEN_MAIN;
set_coil_val(COIL_ADDR_SCREEN_SWITCH, 0);
}
break;
case SET_CONTENT_CHOOSE:
{
//熄灭当前选中的内容
setting_contents_check(99, tabdata.content_cursor);
//取消内容选中与焦点
tabdata.content_cursor = 0;
tabdata.content_cursor_prv = 99;
tabdata.item_page = 1;
tabdata.item_page_prv = 1;
tabdata.content_focus = 0;
//当前操作从“内容选择” 返回 至“选项卡选择”,按键配置同步更新
current_operation = SET_ITEM_CHOOSE;
key_config_update(current_operation);
}
break;
case SET_CONTENT_MODIFY:
{
//当存在焦点时,取消焦点,返回内容选择
tabdata.content_focus = 0;
setting_contents_check(tabdata.content_cursor, CONTENT_EMPTY);
//更新当前游标所在内容的文本(焦点前后不一致)
tabdata.current_content = content_cur_char2enum(tabdata.item_cursor ,tabdata.content_cursor);
switch (tabdata.item_cursor)
{
case ITEM_0:
{
set_item0_text(tabdata.current_content);
if(tabdata.current_content == VOL_UNIT_SET)
{
set_item0_text(VOL_UP_SET);
set_item0_text(VOL_LOW_SET);
}
if(tabdata.current_content == TC_TYPE_SET)
{
set_item0_text(TC_UP_SET);
set_item0_text(TC_LOW_SET);
}
}
break;
case ITEM_1:
{
set_item1_text(tabdata.current_content);
}
break;
case ITEM_2:
{
set_item2_text(tabdata.current_content);
}
break;
case ITEM_3:
{
set_item3_text(tabdata.current_content);
}
break;
default:
break;
}
tabdata.current_content = CONTENT_EMPTY;
//当前操作从“内容修改” 返回 至“内容选择”,按键配置同步更新
current_operation = SET_CONTENT_CHOOSE;
key_config_update(current_operation);
}
break;
case SET_WINDOW_MODIFY:
{
lv_obj_add_flag(guider_ui.screen_setting_window_set, LV_OBJ_FLAG_HIDDEN);
//熄灭游标
setting_window_num_check(99, setting_window_cursor);
setting_window_cursor = 3;
setting_window_cursor_prv = 99;
//取消焦点
tabdata.content_focus = 0;
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
//更新文本
setting_window2val();
set_item0_text(tabdata.current_content);
current_operation = SET_CONTENT_CHOOSE;
key_config_update(current_operation);
}
break;
case SET_SHOW_LOG:
{
//恢复至原本页面
setting_items_page(ITEM_2, 1);
tabdata.content_focus = 0;
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
//当前操作从“查看记录” 返回 至“内容选择”,按键配置同步更新
current_operation = SET_CONTENT_CHOOSE;
key_config_update(current_operation);
}
break;
case SET_COMMUNICATION_SWITCH:
{
//恢复至原本页面
setting_contents_check(99, com_switch_cursor);
setting_items_page(ITEM_2, 1);
tabdata.content_focus = 0;
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
//当前操作从“通讯模式选择” 返回 至“内容选择”,按键配置同步更新
current_operation = SET_CONTENT_CHOOSE;
key_config_update(current_operation);
}
break;
case SET_COMMUNICATION_MODIFY:
{
tabdata.content_focus = 0;
setting_contents_check(com_switch_cursor, com_switch_cursor_prv);
set_communication_text(com_switch_cursor);
current_operation = SET_COMMUNICATION_SWITCH;
key_config_update(current_operation);
}
break;
case PROG_OUT_CONFIG_1:
{
if(tabdata.content_focus == 0)
{
//恢复至原本页面
setting_contents_check(99, cursor_conf1);
setting_items_page(ITEM_2, 1);
tabdata.content_focus = 0;
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
//当前操作从“通讯模式选择” 返回 至“内容选择”,按键配置同步更新
current_operation = SET_CONTENT_CHOOSE;
key_config_update(current_operation);
}
else
{
tabdata.content_focus = 0;
setting_contents_check(cursor_conf1, cursor_conf1_prv);
text_update_conf1(cursor_conf1);
}
}
break;
case PROG_OUT_CONFIG_2:
{
if(tabdata.content_focus == 0)
{
setting_contents_check(99, cursor_conf2);
program_out_config1();
//游标调整至“下一步的位置”
cursor_conf1 = 3;
cursor_conf1_prv = 0;
setting_contents_check(cursor_conf1, cursor_conf1_prv);
current_operation = PROG_OUT_CONFIG_1;
key_config_update(current_operation);
}
else
{
tabdata.content_focus = 0;
setting_contents_check(cursor_conf2, cursor_conf2_prv);
if((progout_data.output_mode == PROG_OUT_TRIANGLE)&&(cursor_conf2 > 2))
{
text_update_conf2(cursor_conf2 + 2);
}
else
{
text_update_conf2(cursor_conf2);
}
}
}
break;
default:
break;
}
}
break;
case KEY_UP:
{
key = 0;
key_char2struct();
switch (current_operation)
{
case SET_ITEM_CHOOSE:
{
cursor_start = (uint8_t)ITEM_0;
cursor_end = (uint8_t)ITEM_3;
cursor_temp = (uint8_t)tabdata.item_cursor;
cursor_temp = (cursor_temp <= cursor_start)?(cursor_end):(cursor_temp - 1);
tabdata.item_cursor_prv = tabdata.item_cursor;
tabdata.item_cursor = (ITEMS)cursor_temp;
//更新文本
setting_items_check(tabdata.item_cursor, tabdata.item_cursor_prv);
}
break;
case SET_CONTENT_CHOOSE:
{
switch (tabdata.item_cursor)
{
case ITEM_0:
{
cursor_start = 0;
cursor_end = 5;
}
break;
case ITEM_1:
{
cursor_start = 0;
cursor_end = 3;
}
break;
case ITEM_2:
{
cursor_start = 0;
cursor_end = 3;
}
break;
case ITEM_3:
{
cursor_start = 0;
cursor_end = 3;
}
break;
default:
break;
}
cursor_temp = tabdata.content_cursor;
cursor_temp = ( cursor_temp <= cursor_start)?(cursor_end):(cursor_temp - 1);
tabdata.content_cursor_prv = tabdata.content_cursor;
tabdata.content_cursor = cursor_temp;
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
}
break;
case SET_WINDOW_MODIFY:
{
//增加弹窗内指定数字的值
if(setting_window_cursor == 4)
{
setting_window_num[setting_window_cursor] = !setting_window_num[setting_window_cursor];
}
else
{
setting_window_num[setting_window_cursor] += 1;
if( setting_window_num[setting_window_cursor] > 9 ) setting_window_num[setting_window_cursor] = 0;
}
setting_window_set_num(setting_window_cursor);
}
break;
case SET_COMMUNICATION_SWITCH:
{
cursor_start = 0;
cursor_end = 3;
cursor_temp = com_switch_cursor;
cursor_temp = ( cursor_temp <= cursor_start)?(cursor_end):(cursor_temp - 1);
com_switch_cursor_prv = com_switch_cursor;
com_switch_cursor = cursor_temp;
setting_contents_check(com_switch_cursor, com_switch_cursor_prv);
}
break;
case PROG_OUT_CONFIG_1:
{
if(tabdata.content_focus == 0)
{
cursor_conf1_prv = cursor_conf1;
cursor_conf1 -= 1;
if(cursor_conf1 > 200) cursor_conf1 = 3;
setting_contents_check(cursor_conf1, cursor_conf1_prv);
}
}
break;
case PROG_OUT_CONFIG_2:
{
if(tabdata.content_focus == 0)
{
cursor_conf2_prv = cursor_conf2;
cursor_conf2 -= 1;
if( (cursor_conf2 < 1)&&(progout_data.output_mode == PROG_OUT_STEP) ) cursor_conf2 = 4;
if( (cursor_conf2 < 1)&&(progout_data.output_mode == PROG_OUT_TRIANGLE) ) cursor_conf2 = 5;
setting_contents_check(cursor_conf2, cursor_conf2_prv);
}
}
break;
default:
break;
}
}
break;
case KEY_DOWN:
{
key = 0;
key_char2struct();
switch (current_operation)
{
case SET_ITEM_CHOOSE:
{
cursor_start = (uint8_t)ITEM_0;
cursor_end = (uint8_t)ITEM_3;
cursor_temp = (uint8_t)tabdata.item_cursor;
cursor_temp = (cursor_temp >= cursor_end)?(cursor_start):(cursor_temp + 1);
tabdata.item_cursor_prv = tabdata.item_cursor;
tabdata.item_cursor = (ITEMS)cursor_temp;
setting_items_check(tabdata.item_cursor, tabdata.item_cursor_prv);
}
break;
case SET_CONTENT_CHOOSE:
{
switch (tabdata.item_cursor)
{
case ITEM_0:
{
cursor_start = 0;
cursor_end = 5;
}
break;
case ITEM_1:
{
cursor_start = 0;
cursor_end = 3;
}
break;
case ITEM_2:
{
cursor_start = 0;
cursor_end = 3;
}
break;
case ITEM_3:
{
cursor_start = 0;
cursor_end = 3;
}
break;
default:
break;
}
cursor_temp = tabdata.content_cursor;
cursor_temp = ( cursor_temp >= cursor_end)?(cursor_start):(cursor_temp + 1);
tabdata.content_cursor_prv = tabdata.content_cursor;
tabdata.content_cursor = cursor_temp;
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
}
break;
case SET_WINDOW_MODIFY:
{
//减小弹窗内指定数字的值
if(setting_window_cursor == 4)
{
setting_window_num[setting_window_cursor] = !setting_window_num[setting_window_cursor];
}
else
{
setting_window_num[setting_window_cursor] -= 1;
if( setting_window_num[setting_window_cursor] > 200 ) setting_window_num[setting_window_cursor] = 9;
}
//更新文本
setting_window_set_num(setting_window_cursor);
}
break;
case SET_COMMUNICATION_SWITCH:
{
cursor_start = 0;
cursor_end = 3;
cursor_temp = com_switch_cursor;
cursor_temp = ( cursor_temp >= cursor_end)?(cursor_start):(cursor_temp + 1);
com_switch_cursor_prv = com_switch_cursor;
com_switch_cursor = cursor_temp;
setting_contents_check(com_switch_cursor, com_switch_cursor_prv);
}
break;
case PROG_OUT_CONFIG_1:
{
if(tabdata.content_focus == 0)
{
cursor_conf1_prv = cursor_conf1;
cursor_conf1 += 1;
if(cursor_conf1 > 3) cursor_conf1 = 0;
setting_contents_check(cursor_conf1, cursor_conf1_prv);
}
}
break;
case PROG_OUT_CONFIG_2:
{
if(tabdata.content_focus == 0)
{
cursor_conf2_prv = cursor_conf2;
cursor_conf2 += 1;
if( (cursor_conf2 > 4)&&(progout_data.output_mode == PROG_OUT_STEP) ) cursor_conf2 = 1;
if( (cursor_conf2 > 5)&&(progout_data.output_mode == PROG_OUT_TRIANGLE) ) cursor_conf2 = 1;
setting_contents_check(cursor_conf2, cursor_conf2_prv);
}
}
break;
default:
break;
}
}
break;
case KEY_OK:
{
key = 0;
key_char2struct();
switch (current_operation)
{
case SET_ITEM_CHOOSE:
{
//选中某个选项卡后,点亮该选项卡内的第一个内容
tabdata.content_cursor = 0;
tabdata.content_cursor_prv = 99;
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
//当前操作从“选项卡选择” 切换 至“内容选择”,按键配置同步更新
current_operation = SET_CONTENT_CHOOSE;
key_config_update(current_operation);
}
break;
case SET_CONTENT_CHOOSE:
{
//选中选项卡内的某个内容后,焦点当前选中内容
tabdata.content_focus = 1;
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
//焦点后更新所选内容的文本
tabdata.current_content = content_cur_char2enum(tabdata.item_cursor, tabdata.content_cursor);
switch (tabdata.item_cursor)
{
case ITEM_0:
{
if( setting_window_display() == 0 )
{
set_item0_text(tabdata.current_content);
//当前操作从“内容选择” 切换 至“内容修改”,按键配置同步更新
current_operation = SET_CONTENT_MODIFY;
key_config_update(current_operation);
}
else
{
//点亮窗口内游标游标从第3位开始
setting_window_cursor = 3;
setting_window_cursor_prv = 99;
setting_window_num_check(setting_window_cursor, setting_window_cursor_prv);
//当前操作从“内容选择” 切换 至“弹窗修改”,按键配置同步更新
current_operation = SET_WINDOW_MODIFY;
key_config_update(current_operation);
}
}
break;
case ITEM_1:
{
set_item1_text(tabdata.current_content);
//当前操作从“内容选择” 切换 至“内容修改”,按键配置同步更新
current_operation = SET_CONTENT_MODIFY;
key_config_update(current_operation);
}
break;
case ITEM_2:
{
switch (tabdata.current_content)
{
case INPUT_LOG:
{
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_01, lv_color_hex(COLOR_ITEMS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
show_IO_log(IO_INPUT, 1);
//当前操作从“内容选择” 切换 至“查看记录”,按键配置同步更新
current_operation = SET_SHOW_LOG;
key_config_update(current_operation);
}
break;
case OUTPUT_LOG:
{
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_11, lv_color_hex(COLOR_ITEMS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
show_IO_log(IO_OUTPUT, 1);
//当前操作从“内容选择” 切换 至“查看记录”,按键配置同步更新
current_operation = SET_SHOW_LOG;
key_config_update(current_operation);
}
break;
case COMMUNICATION:
{
//取消焦点,底色恢复正常
tabdata.content_focus = 0;
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_21, lv_color_hex(COLOR_ITEMS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
//切换至通讯选择界面
communication_select();
current_operation = SET_COMMUNICATION_SWITCH;
key_config_update(current_operation);
}
break;
case PROGRAM_OUTPUT:
{
tabdata.content_focus = 0;
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_31, lv_color_hex(COLOR_ITEMS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
program_out_config1();
current_operation = PROG_OUT_CONFIG_1;
key_config_update(current_operation);
}
break;
default:
break;
}
}
break;
case ITEM_3:
{
set_item3_text(tabdata.current_content);
//当前操作从“内容选择” 切换 至“内容修改”,按键配置同步更新
current_operation = SET_CONTENT_MODIFY;
key_config_update(current_operation);
}
break;
default:
break;
}
}
break;
case SET_COMMUNICATION_SWITCH:
{
if(com_switch_cursor != TEXT_MODBUS_CONFIG)
{
tabdata.content_focus = 1;
setting_contents_check(com_switch_cursor, com_switch_cursor_prv);
set_communication_text(com_switch_cursor);
current_operation = SET_COMMUNICATION_MODIFY;
key_config_update(current_operation);
}
else if( tabdata.modbus_type == SIG_MASTER)
{
//【主界面, 设置界面】共用一块内存空间,两者之间通过隐藏&显示切换
//【Modbus主站配置界面, Modbus主站收发界面】共用一块内存空间两者之间通过隐藏&显示切换
//设置界面 -> Modbus主站配置界面时立即删除主界面对象异步删除设置界面加载配置界面切换至收发界面时再加载收发界面对象
//设置界面 <- Modbus主站配置界面时立即删除收发界面对象异步删除配置界面加载设置界面切换至主界面时再加载主界面对象
tabdata.content_focus = 0;
lv_obj_set_style_bg_color(guider_ui.screen_setting_label_31, lv_color_hex(COLOR_ITEMS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT);
//立即删除主界面的相关内容,释放内存
if(scr_main_set_flag)
{
//加载过的情况下才能删除,否则会进入硬件错误中断。
scr_main_set_flag = 0;
lv_obj_del(guider_ui.screen_main);
}
//设置modbus配置界面的内容
setup_scr_screen_modbus_config(&guider_ui);
scr_modbus_config_recover();
delay_cnt(200); //不加延时有概率卡死
lv_scr_load(guider_ui.screen_modbus_config); //加载界面
menu_data.scr_now = SCREEN_MODBUS_MASTER_CONFIG;
//异步删除设置界面,更加安全
lv_obj_del_async(guider_ui.screen_setting);
//当前操作变更为MODBUS主站配置
current_operation = MODBUS_MASTER_CONFIG;
key_config_update(current_operation);
}
}
break;
case PROG_OUT_CONFIG_1:
{
if(cursor_conf1 != CONF1_NEXT)
{
tabdata.content_focus = 1;
setting_contents_check(cursor_conf1, cursor_conf1_prv);
text_update_conf1(cursor_conf1);
}
else
{
setting_contents_check(99, cursor_conf1);
program_out_config2();
current_operation = PROG_OUT_CONFIG_2;
key_config_update(current_operation);
}
}
break;
case PROG_OUT_CONFIG_2:
{
tabdata.content_focus = 1;
setting_contents_check(cursor_conf2, cursor_conf2_prv);
uint8_t cur_temp = 0;
if(progout_data.output_mode == PROG_OUT_TRIANGLE)
{
cur_temp = (cursor_conf2 <= 2)?(cursor_conf2):(cursor_conf2 + 2);
}
else
{
cur_temp = cursor_conf2;
}
text_update_conf2(cur_temp);
}
break;
default:
break;
}
}
break;
case KEY_LEFT:
{
key = 0;
key_char2struct();
switch (current_operation)
{
case SET_CONTENT_CHOOSE:
{
//不存在焦点时,执行翻页操作
switch (tabdata.item_cursor)
{
case ITEM_0:
{
tabdata.item_page_prv = tabdata.item_page;
tabdata.item_page = ( tabdata.item_page <= 1)?(I0_PAGE_MAX):(tabdata.item_page - 1);
setting_items_page(ITEM_0, tabdata.item_page);
//翻页后熄灭原本的游标
setting_contents_check(99, tabdata.content_cursor);
//翻页后点亮新的一页的第一个内容
tabdata.content_cursor = 0;
tabdata.content_cursor_prv = 99;
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
}
break;
case ITEM_1:
{}
break;
case ITEM_2:
{}
break;
case ITEM_3:
{}
break;
default:
break;
}
}
break;
case SET_CONTENT_MODIFY:
{
//存在焦点后,修改内容
tabdata.current_content = content_cur_char2enum(tabdata.item_cursor, tabdata.content_cursor);
setting_contents_modify(tabdata.item_cursor, tabdata.current_content, -1);
}
break;
case SET_WINDOW_MODIFY:
{
//向左移动弹窗内游标
setting_window_cursor_prv = setting_window_cursor;
setting_window_cursor -= 1;
if(setting_window_cursor > 200) setting_window_cursor = 4;
setting_window_num_check(setting_window_cursor, setting_window_cursor_prv);
}
break;
case SET_SHOW_LOG:
{
//查看记录
if( tabdata.current_content == INPUT_LOG )
{
log_page--;
if(log_page > 10) log_page = 1;
if(log_page < 1) log_page = 10;
show_IO_log(IO_INPUT, log_page);
return;
}
if (tabdata.current_content == OUTPUT_LOG)
{
log_page--;
if(log_page > 10) log_page = 1;
if(log_page < 1) log_page = 10;
show_IO_log(IO_OUTPUT, log_page);
return;
}
}
break;
case SET_COMMUNICATION_MODIFY:
{
set_communication_modify(com_switch_cursor, -1);
set_communication_text(com_switch_cursor);
}
break;
case PROG_OUT_CONFIG_1:
{
if(tabdata.content_focus == 1)
{
val_modify_conf1(-1);
text_update_conf1(cursor_conf1);
}
}
break;
case PROG_OUT_CONFIG_2:
{
if(tabdata.content_focus == 1)
{
val_modify_conf2(-5);
}
}
break;
default:
break;
}
}
break;
case KEY_RIGHT:
{
key = 0;
key_char2struct();
switch (current_operation)
{
case SET_CONTENT_CHOOSE:
{
//翻页
switch (tabdata.item_cursor)
{
case ITEM_0:
{
tabdata.item_page_prv = tabdata.item_page;
tabdata.item_page = ( tabdata.item_page >= I0_PAGE_MAX)?(1):(tabdata.item_page + 1);
setting_items_page(ITEM_0, tabdata.item_page);
//翻页后熄灭原本的游标
setting_contents_check(99, tabdata.content_cursor);
//翻页后点亮新的一页的第一个内容
tabdata.content_cursor = 0;
tabdata.content_cursor_prv = 99;
setting_contents_check(tabdata.content_cursor, tabdata.content_cursor_prv);
}
break;
case ITEM_1:
{}
break;
case ITEM_2:
{}
break;
case ITEM_3:
{}
break;
default:
break;
}
}
break;
case SET_CONTENT_MODIFY:
{
//存在焦点后,修改内容
tabdata.current_content = content_cur_char2enum(tabdata.item_cursor, tabdata.content_cursor);
setting_contents_modify(tabdata.item_cursor, tabdata.current_content, 1);
}
break;
case SET_WINDOW_MODIFY:
{
//向右移动弹窗内游标
setting_window_cursor_prv = setting_window_cursor;
setting_window_cursor += 1;
if(setting_window_cursor > 4) setting_window_cursor = 0;
setting_window_num_check(setting_window_cursor, setting_window_cursor_prv);
}
break;
case SET_SHOW_LOG:
{
//查看记录
if( tabdata.current_content == INPUT_LOG )
{
log_page++;
if(log_page > 10) log_page = 1;
if(log_page < 1) log_page = 10;
show_IO_log(IO_INPUT, log_page);
return;
}
if (tabdata.current_content == OUTPUT_LOG)
{
log_page++;
if(log_page > 10) log_page = 1;
if(log_page < 1) log_page = 10;
show_IO_log(IO_OUTPUT, log_page);
return;
}
}
break;
case SET_COMMUNICATION_MODIFY:
{
set_communication_modify(com_switch_cursor, 1);
set_communication_text(com_switch_cursor);
}
break;
case PROG_OUT_CONFIG_1:
{
if(tabdata.content_focus == 1)
{
val_modify_conf1(1);
text_update_conf1(cursor_conf1);
}
}
break;
case PROG_OUT_CONFIG_2:
{
if(tabdata.content_focus == 1)
{
val_modify_conf2(5);
}
}
break;
default:
break;
}
}
break;
case KEY_OUT:
{
key = 0;
key_char2struct();
if( (current_operation == PROG_OUT_CONFIG_2)&&(tabdata.content_focus == 0) )
{
//熄灭游标
setting_contents_check(99, cursor_conf2);
//加载主界面
if(!scr_main_set_flag)
{
scr_main_set_flag = 1;
setup_scr_screen_main(&guider_ui);
delay_cnt(200); //不加延时有概率卡死
}
scr_main_recover();
lv_scr_load(guider_ui.screen_main);
lv_obj_clear_flag(guider_ui.screen_main, LV_OBJ_FLAG_HIDDEN);
//隐藏设置界面对象
lv_obj_add_flag(guider_ui.screen_setting, LV_OBJ_FLAG_HIDDEN);
//当前操作切换至“编程输出执行”,按键配置同步更新
current_operation = PROG_OUT_PROCESSING;
key_config_update(current_operation);
progout_data.process = PROGOUT_START;
switch (progout_data.output_unit)
{
case PROG_OUT_V:
{
sig_channel_select(IO_OUTPUT, VOLTAGE_V);
mux_signal.data_sv = 0;
progout_data.out_min = tabdata.item0_page0_vlow[0];
progout_data.out_max = tabdata.item0_page0_vup[0];
}
break;
case PROG_OUT_MA:
{
sig_channel_select(IO_OUTPUT, CURRENT_MA);
mux_signal.data_sv = 0;
progout_data.out_min = tabdata.item0_page0_clow;
progout_data.out_max = tabdata.item0_page0_cup;
}
break;
default:
break;
}
menu_data.io_on2off = IO_ON;
io_on2off_status();
//切换至本地控制
set_coil_val(COIL_ADDR_HOLD_SV_CTRL, 0);
//当前页面为主界面
menu_data.scr_now = SCREEN_MAIN;
set_coil_val(COIL_ADDR_SCREEN_SWITCH, 0);
}
}
break;
case KEY_NONE:
{
key = 0;
key_char2struct();
}
default:
{
key = 0;
key_char2struct();
}
break;
}
}