io页面ui刷新逻辑修改

This commit is contained in:
sc committed 2026-03-08 00:04:55 +08:00
1 parent f687b4aac4
commit 281662556f
5 files changed
+63 -9

No files matched your search

+33 -1
View File
@@ -260,15 +260,18 @@ static void tabview_event_cb(lv_event_t *e)
// 根据 tab_id 执行不同操作
switch (tab_id) {
case 0://工单页面
io_ui_show=0;
break;
case 1://工艺页面
io_ui_show=0;
break;
case 2:
io_ui_show=1;
break;
case 3://程序页面
io_ui_show=0;
lv_obj_add_state(guider_ui.screen_set_Edit,LV_STATE_DISABLED);
lv_obj_add_state(guider_ui.screen_set_Insert,LV_STATE_DISABLED);
lv_obj_add_state(guider_ui.screen_set_Delete,LV_STATE_DISABLED);
@@ -276,18 +279,47 @@ static void tabview_event_cb(lv_event_t *e)
UI_pname_row();
break;
case 4:
io_ui_show=0;
break;
}
}
}
// 机台页面事件回调函数
static void w_io_event_cb(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t *tabview = lv_event_get_target(e);
if (code == LV_EVENT_VALUE_CHANGED) {
// 获取当前选中的 Tab 索引
uint16_t tab_id = lv_tabview_get_tab_act(tabview);
// 根据 tab_id 执行不同操作
switch (tab_id) {
case 0:
io_ui_size=0;
break;
case 1:
io_ui_size=1;
break;
case 2:
io_ui_size=2;
break;
case 3:
io_ui_size=3;
break;
}
}
}
void custom_init(lv_ui *ui)
{
lv_obj_clear_flag(lv_tabview_get_content(ui->screen_tabview), LV_OBJ_FLAG_SCROLLABLE);//禁止左右滑动
lv_obj_clear_flag(lv_tabview_get_content(ui->screen_w_io), LV_OBJ_FLAG_SCROLLABLE);//禁止左右滑动
//选项卡回调事件设置
lv_obj_add_event_cb(ui->screen_tabview, tabview_event_cb, LV_EVENT_VALUE_CHANGED, NULL);//
lv_obj_add_event_cb(ui->screen_w_io, w_io_event_cb, LV_EVENT_VALUE_CHANGED, NULL);//
lv_obj_set_style_pad_all(ui->screen_tabview_tab_1, 0, LV_PART_MAIN);
lv_obj_set_style_pad_all(ui->screen_tabview_tab_2, 0, LV_PART_MAIN);
+1 -4
View File
@@ -94,10 +94,7 @@ void setup_s_screen(lv_ui *ui)
lv_obj_add_flag(ui->screen_inf_lock, LV_OBJ_FLAG_HIDDEN);
}
update_led_i();
update_led_o();
update_io_labels();
update_io_ui();
}
static void time_update_timer_cb(lv_timer_t * timer)
+24 -1
View File
@@ -23,8 +23,9 @@
#include <ui_data_labels.h>
#include "libcsv.h"
// 全局或静态数组
char io_ui_size =0;
char io_ui_show=0;
char buf[8];
lv_obj_t *di_led_array[64];
lv_obj_t *do_led_array[64];
@@ -263,6 +264,28 @@ void update_led_o(void)
}
}
void update_io_ui(void)
{
if(io_ui_show==1)
{
switch (io_ui_size)
{
case 0:
update_led_i();
break;
case 1:
update_led_o();
break;
case 2:
update_io_labels();
break;
case 3:
break;
}
}
}
/**
* 获取当前时间字符串,格式:2025/01/25 13:55:11
* @param buf 输出缓冲区
+3 -3
View File
@@ -91,15 +91,15 @@ extern WorkOrder_DATA_tab * WorkDATA_tab;
extern Program_DATA_tab * ProgramDATA_tab;
extern STEP_DATA_tab * StepDATA_tab;
extern char io_ui_size;
extern char io_ui_show;
extern lv_obj_t *di_led_array[64];
extern lv_obj_t *do_led_array[64];
extern lv_obj_t *di_labels[24]; // DI: AIO4001 ~ AIO4024 (24个)
extern lv_obj_t *do_labels[16]; // DO: AIO5001 ~ AIO5016 (16个)
void ui_init_io(lv_ui *ui);
void update_io_labels(void);
void update_led_i(void);
void update_led_o(void);
void update_io_ui(void);
char* get_time_str(char *buf, size_t size);
+2
View File
@@ -92,5 +92,7 @@ void STEP_DATA_set_ui(IO_STEP_DATA* STEPDATA_inf)
lv_dropdown_set_selected(guider_ui.screen_stepinf_s1,get_step_name(STEPDATA_inf->StepID));
lv_dropdown_set_selected(guider_ui.screen_stepinf_s2,get_step_namer(STEPDATA_inf->StepID_S1));
lv_dropdown_set_selected(guider_ui.screen_stepinf_s3,get_step_namer(STEPDATA_inf->StepID_S2));
lv_obj_clear_flag(guider_ui.screen_stepinf_s1b, LV_OBJ_FLAG_HIDDEN);
}