#include "app_screen_modbus.h" lv_obj_t *lvobj_window_trx_nums[32]; //modbus配置项的游标 MOD_CONF_ITEMS mod_mas_conf_cursor = MOD_CONF_SLAVE_ID; MOD_CONF_ITEMS mod_mas_conf_cursor_prv = MOD_CONF_NONE; uint8_t config_focus = 0; //modbus收发界面的选项游标 MOD_TRX_ITEMS mod_mas_trx_cursor = MOD_TRX_PREVIOUS; MOD_TRX_ITEMS mod_mas_trx_cursor_prv = MOD_TRX_NONE; uint8_t trx_focus = 0; void config_items_set_color(MOD_CONF_ITEMS cur, uint32_t color) { switch (cur) { case MOD_CONF_SLAVE_ID: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_value_device_addr, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case MOD_CONF_START_ADDRESS: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_value_start_addr, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case MOD_CONF_BYTES: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_value_bytes, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case MOD_CONF_TIMEOUT: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_value_timeout, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case MOD_CONF_COMMAND: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_value_cmd, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case MOD_CONF_REGISTER_NUM: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_value_register_num, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case MOD_CONF_CALIBRATION: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_value_calibration, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case MOD_CONF_NEXT: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_value_next, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; default: break; } } void config_items_check(MOD_CONF_ITEMS cur, MOD_CONF_ITEMS cur_prv) { uint32_t color = 0; if(config_focus == 1) { color = COLOR_CONTENTS_FOCUSED; } else { color = COLOR_CONTENTS_CHECKED; } //点亮cur config_items_set_color(cur, color); //熄灭cur——prv config_items_set_color(cur_prv, COLOR_ITEMS_UNCHECKED); } void config_window_num_check(uint8_t cur, uint8_t cur_prv) { switch (cur) { case 0: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_num_0, lv_color_hex(COLOR_CONTENTS_CHECKED), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case 1: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_num_1, lv_color_hex(COLOR_CONTENTS_CHECKED), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case 2: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_num_2, lv_color_hex(COLOR_CONTENTS_CHECKED), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case 3: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_num_3, lv_color_hex(COLOR_CONTENTS_CHECKED), LV_PART_MAIN|LV_STATE_DEFAULT); } break; default: break; } switch (cur_prv) { case 0: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_num_0, lv_color_hex(COLOR_CONTENTS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case 1: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_num_1, lv_color_hex(COLOR_CONTENTS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case 2: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_num_2, lv_color_hex(COLOR_CONTENTS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case 3: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_config_num_3, lv_color_hex(COLOR_CONTENTS_UNCHECKED), LV_PART_MAIN|LV_STATE_DEFAULT); } break; default: break; } } void config_window_num_set(uint8_t pos, uint8_t num) { char str_temp[8] = {0}; if( num < 16 ) { sprintf(str_temp, "%x", num); } else if (num == 20) { strcpy(str_temp, "0"); } else if (num == 21) { strcpy(str_temp, "x"); } else { strcpy(str_temp, "-"); } switch (pos) { case 0: { lv_label_set_text(guider_ui.screen_modbus_config_num_0, str_temp); } break; case 1: { lv_label_set_text(guider_ui.screen_modbus_config_num_1, str_temp); } break; case 2: { lv_label_set_text(guider_ui.screen_modbus_config_num_2, str_temp); } break; case 3: { lv_label_set_text(guider_ui.screen_modbus_config_num_3, str_temp); } break; default: break; } } void config_window_update(void) { switch (mod_mas_conf_cursor) { case MOD_CONF_SLAVE_ID: { //前两位显示“0x”,游标从3开始,2-3 window_config_num[0] = 20; window_config_num[1] = 21; window_config_num[2] = mod_master.target_id >> 4; window_config_num[3] = mod_master.target_id & 0x0F; for(uint8_t i = 0; i < 4; i++) { config_window_num_set(i, window_config_num[i]); } window_config_cursor = 3; window_config_cursor_prv = 99; config_window_num_check(window_config_cursor, window_config_cursor_prv); lv_obj_clear_flag(guider_ui.screen_modbus_config_window_config, LV_OBJ_FLAG_HIDDEN); } break; case MOD_CONF_START_ADDRESS: { //游标从3开始,0-3 window_config_num[0] = 0x000F & (mod_master.start_address >> 12); window_config_num[1] = 0x000F & (mod_master.start_address >> 8); window_config_num[2] = 0x000F & (mod_master.start_address >> 4); window_config_num[3] = 0x000F & (mod_master.start_address ); for(uint8_t i = 0; i < 4; i++) { config_window_num_set(i, window_config_num[i]); } window_config_cursor = 3; window_config_cursor_prv = 99; config_window_num_check(window_config_cursor, window_config_cursor_prv); lv_obj_clear_flag(guider_ui.screen_modbus_config_window_config, LV_OBJ_FLAG_HIDDEN); } break; case MOD_CONF_COMMAND: { //前两位显示“0x”,游标从3开始,2-3 window_config_num[0] = 20; window_config_num[1] = 21; window_config_num[2] = mod_master.command_code >> 4; window_config_num[3] = mod_master.command_code & 0x0F; for(uint8_t i = 0; i < 4; i++) { config_window_num_set(i, window_config_num[i]); } window_config_cursor = 3; window_config_cursor_prv = 99; config_window_num_check(window_config_cursor, window_config_cursor_prv); lv_obj_clear_flag(guider_ui.screen_modbus_config_window_config, LV_OBJ_FLAG_HIDDEN); } break; case MOD_CONF_REGISTER_NUM: { //第一位显示“0”,游标从1开始,1-3 window_config_num[0] = 0; window_config_num[1] = mod_master.register_num / 100; window_config_num[2] = (mod_master.register_num / 10) % 10; window_config_num[3] = mod_master.register_num % 10; for(uint8_t i = 0; i < 4; i++) { config_window_num_set(i, window_config_num[i]); } window_config_cursor = 3; window_config_cursor_prv = 99; config_window_num_check(window_config_cursor, window_config_cursor_prv); lv_obj_clear_flag(guider_ui.screen_modbus_config_window_config, LV_OBJ_FLAG_HIDDEN); } break; default: break; } } void config_window2value(void) { char str_temp[16]; switch (mod_mas_conf_cursor) { case MOD_CONF_SLAVE_ID: { mod_master.target_id = window_config_num[2] & 0x0F; mod_master.target_id <<= 4; mod_master.target_id += window_config_num[3] & 0x0F; sprintf(str_temp, "0x%02x", mod_master.target_id); lv_label_set_text(guider_ui.screen_modbus_config_value_device_addr, str_temp); } break; case MOD_CONF_START_ADDRESS: { mod_master.start_address = window_config_num[0] & 0x0F; mod_master.start_address <<= 4; mod_master.start_address += window_config_num[1] & 0x0F; mod_master.start_address <<= 4; mod_master.start_address += window_config_num[2] & 0x0F; mod_master.start_address <<= 4; mod_master.start_address += window_config_num[3] & 0x0F; sprintf(str_temp, "0x%04x", mod_master.start_address); lv_label_set_text(guider_ui.screen_modbus_config_value_start_addr, str_temp); } break; case MOD_CONF_COMMAND: { mod_master.command_code= window_config_num[2]; mod_master.command_code <<= 4; mod_master.command_code += window_config_num[3]; sprintf(str_temp, "0x%02x", mod_master.command_code); lv_label_set_text(guider_ui.screen_modbus_config_value_cmd, str_temp); } break; case MOD_CONF_REGISTER_NUM: { mod_master.register_num = window_config_num[1]*100 + window_config_num[2]*10 + window_config_num[3]; sprintf(str_temp, "%d", mod_master.register_num); lv_label_set_text(guider_ui.screen_modbus_config_value_register_num, str_temp); } break; default: break; } } //打开trx弹窗后,初始化显示内容 void trx_window_init(void) { //界面切换时会删除下列对象,因此每次打开弹窗时都应该执行下列操作 lvobj_window_trx_nums[0] = guider_ui.screen_modbus_trx_num_00; lvobj_window_trx_nums[1] = guider_ui.screen_modbus_trx_num_01; lvobj_window_trx_nums[2] = guider_ui.screen_modbus_trx_num_02; lvobj_window_trx_nums[3] = guider_ui.screen_modbus_trx_num_03; lvobj_window_trx_nums[4] = guider_ui.screen_modbus_trx_num_04; lvobj_window_trx_nums[5] = guider_ui.screen_modbus_trx_num_05; lvobj_window_trx_nums[6] = guider_ui.screen_modbus_trx_num_06; lvobj_window_trx_nums[7] = guider_ui.screen_modbus_trx_num_07; lvobj_window_trx_nums[8] = guider_ui.screen_modbus_trx_num_10; lvobj_window_trx_nums[9] = guider_ui.screen_modbus_trx_num_11; lvobj_window_trx_nums[10] = guider_ui.screen_modbus_trx_num_12; lvobj_window_trx_nums[11] = guider_ui.screen_modbus_trx_num_13; lvobj_window_trx_nums[12] = guider_ui.screen_modbus_trx_num_14; lvobj_window_trx_nums[13] = guider_ui.screen_modbus_trx_num_15; lvobj_window_trx_nums[14] = guider_ui.screen_modbus_trx_num_16; lvobj_window_trx_nums[15] = guider_ui.screen_modbus_trx_num_17; lvobj_window_trx_nums[16] = guider_ui.screen_modbus_trx_num_20; lvobj_window_trx_nums[17] = guider_ui.screen_modbus_trx_num_21; lvobj_window_trx_nums[18] = guider_ui.screen_modbus_trx_num_22; lvobj_window_trx_nums[19] = guider_ui.screen_modbus_trx_num_23; lvobj_window_trx_nums[20] = guider_ui.screen_modbus_trx_num_24; lvobj_window_trx_nums[21] = guider_ui.screen_modbus_trx_num_25; lvobj_window_trx_nums[22] = guider_ui.screen_modbus_trx_num_26; lvobj_window_trx_nums[23] = guider_ui.screen_modbus_trx_num_27; lvobj_window_trx_nums[24] = guider_ui.screen_modbus_trx_num_30; lvobj_window_trx_nums[25] = guider_ui.screen_modbus_trx_num_31; lvobj_window_trx_nums[26] = guider_ui.screen_modbus_trx_num_32; lvobj_window_trx_nums[27] = guider_ui.screen_modbus_trx_num_33; lvobj_window_trx_nums[28] = guider_ui.screen_modbus_trx_num_34; lvobj_window_trx_nums[29] = guider_ui.screen_modbus_trx_num_35; lvobj_window_trx_nums[30] = guider_ui.screen_modbus_trx_num_36; lvobj_window_trx_nums[31] = guider_ui.screen_modbus_trx_num_37; char str_temp[8]; for(uint8_t i = 0; i < 32; i++) { if(window_trx_num[i] == 16) { lv_label_set_text(lvobj_window_trx_nums[i], "-"); } else { sprintf(str_temp, "%x", window_trx_num[i]); lv_label_set_text(lvobj_window_trx_nums[i], str_temp); } } } void trx_items_set_color(MOD_TRX_ITEMS cur, uint32_t color) { switch (cur) { case MOD_TRX_DATA: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_value_Data, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case MOD_TRX_PREVIOUS: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_label_previous, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case MOD_TRX_SET: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_label_set, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; case MOD_TRX_SEND: { lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_label_send, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); } break; default: break; } } void trx_items_check(MOD_TRX_ITEMS cur, MOD_TRX_ITEMS cur_prv) { uint32_t color = 0; if(trx_focus == 1) { color = COLOR_CONTENTS_FOCUSED; } else { color = COLOR_CONTENTS_CHECKED; } //点亮cur trx_items_set_color(cur, color); //熄灭cur——prv trx_items_set_color(cur_prv, COLOR_ITEMS_UNCHECKED); } void trx_set_window_num_color(uint8_t cur, uint32_t color) { //设备底色的接口函数数据类型不一样,用lvobj_window_trx_nums[i]循环会进入硬件错误中断 switch (cur) { case 0: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_00, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 1: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_01, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 2: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_02, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 3: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_03, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 4: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_04, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 5: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_05, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 6: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_06, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 7: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_07, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 8: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_10, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 9: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_11, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 10: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_12, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 11: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_13, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 12: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_14, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 13: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_15, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 14: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_16, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 15: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_17, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 16: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_20, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 17: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_21, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 18: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_22, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 19: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_23, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 20: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_24, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 21: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_25, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 22: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_26, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 23: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_27, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 24: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_30, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 25: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_31, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 26: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_32, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 27: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_33, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 28: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_34, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 29: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_35, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 30: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_36, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; case 31: lv_obj_set_style_bg_color(guider_ui.screen_modbus_trx_num_37, lv_color_hex(color), LV_PART_MAIN|LV_STATE_DEFAULT); break; default: break; } } void trx_window_num_check(uint8_t cur, uint8_t cur_prv) { if(window_trx_focus == 1) { trx_set_window_num_color(cur, COLOR_CONTENTS_FOCUSED); } else { trx_set_window_num_color(cur, COLOR_CONTENTS_CHECKED); } trx_set_window_num_color(cur_prv, COLOR_CONTENTS_UNCHECKED); } void trx_window_num2val(void) { //初次打开trx界面的弹窗时,所有的位置均为“-”。 //从左往右,从上往下,以第一个出现的“-”作为终止位 uint8_t val_len = 0; char str0[10] = {0}; char str_temp[150] = {0}; //从第0个开始,寻找终止位 for(uint8_t i = 0; i < 32; i++) { //[0,15]为十六进制单字符,16规定为“-” if( window_trx_num[i] == 16 ) { if( i % 2 ) { //[][][]...[x,-],“-”在奇数位,置零 window_trx_num[i] = 0; val_len = (i+1)/2; } else { val_len = i/2; } for(uint8_t j = 0; j < val_len; j++) { mod_master.data_tx_value[j] = window_trx_num[2*j]; mod_master.data_tx_value[j] <<= 4; mod_master.data_tx_value[j] += window_trx_num[2*j + 1]&0x0F; } break; } } //在Data窗格内显示mod_master.data_tx_value for(uint8_t k = 0; k < val_len; k++) { sprintf(str0, "%02x ", mod_master.data_tx_value[k]); strcat(str_temp, str0); } lv_label_set_text(guider_ui.screen_modbus_trx_value_Data, str_temp); } void scr_modbus_config_recover(void) { //标题 lv_label_set_text(guider_ui.screen_modbus_config_label_title, text_pack.modbus_master_title); //左列名称 lv_label_set_text(guider_ui.screen_modbus_config_label_device_addr, text_pack.modbus_master_item[0]); lv_label_set_text(guider_ui.screen_modbus_config_label_start_addr, text_pack.modbus_master_item[1]); lv_label_set_text(guider_ui.screen_modbus_config_label_bytes, text_pack.modbus_master_item[2]); lv_label_set_text(guider_ui.screen_modbus_config_label_timeout, text_pack.modbus_master_item[3]); lv_label_set_text(guider_ui.screen_modbus_config_label_cmd, text_pack.modbus_master_item[4]); lv_label_set_text(guider_ui.screen_modbus_config_label_register_num, text_pack.modbus_master_item[5]); lv_label_set_text(guider_ui.screen_modbus_config_label_calibration, text_pack.modbus_master_item[6]); lv_label_set_text(guider_ui.screen_modbus_config_label_next, text_pack.modbus_master_item[7]); char str_temp[16]; //右列值 sprintf(str_temp, "0x%02x", mod_master.target_id); lv_label_set_text(guider_ui.screen_modbus_config_value_device_addr, str_temp); sprintf(str_temp, "0x%04x", mod_master.start_address); lv_label_set_text(guider_ui.screen_modbus_config_value_start_addr, str_temp); sprintf(str_temp, "%d", mod_master.byte_num); lv_label_set_text(guider_ui.screen_modbus_config_value_bytes, str_temp); sprintf(str_temp, "%d", mod_master.timeout); lv_label_set_text(guider_ui.screen_modbus_config_value_timeout, str_temp); sprintf(str_temp, "0x%02x", mod_master.command_code); lv_label_set_text(guider_ui.screen_modbus_config_value_cmd, str_temp); sprintf(str_temp, "%d", mod_master.register_num); lv_label_set_text(guider_ui.screen_modbus_config_value_register_num, str_temp); //lv_label_set_text(guider_ui.screen_modbus_config_value_calibration, ); //lv_label_set_text(guider_ui.screen_modbus_config_value_next, ); //配置项的游标 mod_mas_conf_cursor = MOD_CONF_SLAVE_ID; mod_mas_conf_cursor_prv = MOD_CONF_NONE; config_items_check(mod_mas_conf_cursor, mod_mas_conf_cursor_prv); } void scr_modbus_trx_recover(void) { //根据当前语言,刷新标题 lv_label_set_text(guider_ui.screen_modbus_trx_label_Data, text_pack.modbus_master_trx_item[0]); lv_label_set_text(guider_ui.screen_modbus_trx_label_previous, text_pack.modbus_master_trx_item[1]); lv_label_set_text(guider_ui.screen_modbus_trx_label_set, text_pack.modbus_master_trx_item[2]); lv_label_set_text(guider_ui.screen_modbus_trx_label_send, text_pack.modbus_master_trx_item[3]); //清空数据、发送、接收框 lv_label_set_text(guider_ui.screen_modbus_trx_value_Data,""); lv_label_set_text(guider_ui.screen_modbus_trx_value_Tx,""); lv_label_set_text(guider_ui.screen_modbus_trx_value_Rx,""); mod_mas_trx_cursor = MOD_TRX_PREVIOUS; mod_mas_trx_cursor_prv = MOD_TRX_NONE; trx_items_check(mod_mas_trx_cursor, mod_mas_trx_cursor_prv); } uint8_t trx_focus_cnt = 0; void screen_modbus_trx_run(void) { //mobus收发界面,ok按下焦点后,亮一段时间后恢复原色 if(trx_focus) { trx_focus_cnt++; if(trx_focus_cnt >= 2) { trx_focus_cnt = 0; trx_focus = 0; trx_items_check(mod_mas_trx_cursor, MOD_TRX_NONE); } } }