From d0495cd3fc955bc355660d9b496f44700a55733b Mon Sep 17 00:00:00 2001 From: sc <2401809606@qq.com> Date: Mon, 12 Jan 2026 01:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BF=A1=E6=81=AF=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/PLC_link.c | 3 +- applications/data/DATA_comm.c | 10 +++++-- applications/data/SC828_DATA_table.c | 29 +++++++++++++++---- applications/data/Variable.c | 10 +++++-- applications/data/Variable.h | 10 +++++-- .../lvgl/guider/generated/setup_scr_screen.c | 2 +- applications/lvgl/lv__user_gui.c | 1 + 7 files changed, 52 insertions(+), 13 deletions(-) diff --git a/applications/PLC_link.c b/applications/PLC_link.c index e7b997b..d32ded6 100644 --- a/applications/PLC_link.c +++ b/applications/PLC_link.c @@ -65,7 +65,8 @@ static void mb_plc_read_regs(mb_inst_t *hinst) // 写入 Modbus mb_write_bits(hinst, 2256, DO_TABLE_SIZE, w_buffer); - //输入寄存器d0->6000 u16 r_regsD[AI_TABLE_SIZE]; + //输入寄存器d0->6000 + u16 r_regsD[AI_TABLE_SIZE]; // 读 Modbus mb_read_regs(hinst, 6000, AI_TABLE_SIZE, r_regsD); for (int i = 0; i < AI_TABLE_SIZE; i++) diff --git a/applications/data/DATA_comm.c b/applications/data/DATA_comm.c index c7400b5..413b149 100644 --- a/applications/data/DATA_comm.c +++ b/applications/data/DATA_comm.c @@ -442,9 +442,15 @@ void pasre_DAT(const char *api, const char *json_str) else if (strcmp(api, "SC832") == 0) {//当前细节信息 cJSON_AddItemToObject(dat,"Pump",cJSON_CreateNumber(Pump));//泵 - cJSON_AddItemToObject(dat,"TC",cJSON_CreateNumber(TC));//温度比例 + cJSON_AddItemToObject(dat,"TC",cJSON_CreateNumber(TC_H));//温度比例 + cJSON_AddItemToObject(dat,"TCL",cJSON_CreateNumber(TC_L));//温度比例 cJSON_AddItemToObject(dat,"Fan",cJSON_CreateNumber(Fan));//风机 - cJSON_AddItemToObject(dat,"Pull",cJSON_CreateNumber(Pull));//提布 + cJSON_AddItemToObject(dat,"Pull",cJSON_CreateNumber(Pull1));//提布 + cJSON_AddItemToObject(dat,"Pull2",cJSON_CreateNumber(Pull2));//提布 + cJSON_AddItemToObject(dat,"Pull3",cJSON_CreateNumber(Pull3));//提布 + cJSON_AddItemToObject(dat,"Pull4",cJSON_CreateNumber(Pull4));//提布 + cJSON_AddItemToObject(dat,"Pull5",cJSON_CreateNumber(Pull5));//提布 + cJSON_AddItemToObject(dat,"Pull6",cJSON_CreateNumber(Pull6));//提布 cJSON_AddItemToObject(dat,"Swing",cJSON_CreateNumber(Swing));//摆布 cJSON_AddItemToObject(dat,"STA",cJSON_CreateNumber(STA));//料1 cJSON_AddItemToObject(dat,"STB",cJSON_CreateNumber(STB));//料2 diff --git a/applications/data/SC828_DATA_table.c b/applications/data/SC828_DATA_table.c index fefcd61..a3f08df 100644 --- a/applications/data/SC828_DATA_table.c +++ b/applications/data/SC828_DATA_table.c @@ -310,8 +310,10 @@ void DATA_INSTRUCTION_START(char p[25]){ rt_snprintf(step_table[i].StepID_S2, 3,"000"); rt_snprintf(step_table[i].StepID_S3, 3,"000"); } - Pump = 0;TC = 0;Fan = 0;Pull = 0;Swing = 0; - STA = 0;STB = 0;STC = 0;Time = 0;StepN = 0; + Pump = 0;TC_H = 0;TC_L = 0;Fan = 0; + Swing = 0;Pull1 = 0;Pull2 = 0;Pull3 = 0; + Pull4 = 0;Pull5 = 0;Pull6 = 0;StepN = 0; + STA = 0;STB = 0;STC = 0;Time = 0; P6 = 0;P7 = 0;P8 = 0;P9 = 0;P10 = 0; P1 = 0;P2 =0;P3 =0;P4 =0;P5 =0; P1S1 =0;P2S1 =0;P3S1 =0;P4S1 =0; @@ -353,8 +355,10 @@ void DATA_INSTRUCTION_STOP(){ rt_snprintf(step_table[i].StepID_S2, 3,"000"); rt_snprintf(step_table[i].StepID_S3, 3,"000"); } - Pump = 0;TC = 0;Fan = 0;Pull = 0;Swing = 0; - STA = 0;STB = 0;STC = 0;Time = 0;StepN = 0; + Pump = 0;TC_H = 0;TC_L = 0;Fan = 0; + Swing = 0;Pull1 = 0;Pull2 = 0;Pull3 = 0; + Pull4 = 0;Pull5 = 0;Pull6 = 0;StepN = 0; + STA = 0;STB = 0;STC = 0;Time = 0; P6 = 0;P7 = 0;P8 = 0;P9 = 0;P10 = 0; P1 = 0;P2 =0;P3 =0;P4 =0;P5 =0; P1S1 =0;P2S1 =0;P3S1 =0;P4S1 =0; @@ -396,6 +400,7 @@ void table_thread_entry(void *parameter) { rt_thread_delay(1000); + //Ai输入 MTT = get_ai_value(4001)/10.0f; MUT = get_ai_value(4002)/10.0f; STTA = get_ai_value(4003)/10.0f; @@ -407,7 +412,21 @@ void table_thread_entry(void *parameter) STLC = get_ai_value(4010); MTH = get_ai_value(4022); - + //Ao输出 + get_ao_value(5001,TC_H); + get_ao_value(5002,TC_L); + get_ao_value(5003,Fan); + get_ao_value(5004,Pump); + get_ao_value(5005,STA); + get_ao_value(5006,STB); + get_ao_value(5007,STC); + get_ao_value(5008,Swing); + get_ao_value(5009,Pull1); + get_ao_value(5010,Pull2); + get_ao_value(5011,Pull3); + get_ao_value(5012,Pull4); + get_ao_value(5013,Pull5); + get_ao_value(5014,Pull6); } } diff --git a/applications/data/Variable.c b/applications/data/Variable.c index 8142fda..db157b0 100644 --- a/applications/data/Variable.c +++ b/applications/data/Variable.c @@ -56,9 +56,15 @@ float STLC = 0.0f;//料c水位 // 控制输出 unsigned int Pump = 0;//主泵 -unsigned int TC = 0;//温度比例 +unsigned int TC_H = 0;//温度比例 +unsigned int TC_L = 0;//温度比例 unsigned int Fan = 0;//风机 -unsigned int Pull = 0;//提布 +unsigned int Pull1 = 0;//提布 +unsigned int Pull2= 0;//提布 +unsigned int Pull3 = 0;//提布 +unsigned int Pull4 = 0;//提布 +unsigned int Pull5 = 0;//提布 +unsigned int Pull6 = 0;//提布 unsigned int Swing = 0;//摆布 unsigned int STA = 0;//料a比例 unsigned int STB = 0; diff --git a/applications/data/Variable.h b/applications/data/Variable.h index 78e6e57..1a016dd 100644 --- a/applications/data/Variable.h +++ b/applications/data/Variable.h @@ -42,9 +42,15 @@ extern unsigned int UserInfoStart; extern unsigned int RUN; extern unsigned int STEPID; extern unsigned int Pump; -extern unsigned int TC; +extern unsigned int TC_H;//温度比例 +extern unsigned int TC_L;//温度比例 extern unsigned int Fan; -extern unsigned int Pull; +extern unsigned int Pull1; +extern unsigned int Pull2; +extern unsigned int Pull3; +extern unsigned int Pull4; +extern unsigned int Pull5; +extern unsigned int Pull6; extern unsigned int Swing; extern unsigned int STA; extern unsigned int STB; diff --git a/applications/lvgl/guider/generated/setup_scr_screen.c b/applications/lvgl/guider/generated/setup_scr_screen.c index 1042282..88e2e38 100644 --- a/applications/lvgl/guider/generated/setup_scr_screen.c +++ b/applications/lvgl/guider/generated/setup_scr_screen.c @@ -903,7 +903,7 @@ void setup_scr_screen(lv_ui *ui) //Write codes screen_w_io ui->screen_w_io = lv_tabview_create(ui->screen_tabview_tab_3, LV_DIR_RIGHT, 50); lv_obj_set_pos(ui->screen_w_io, 0, 1); - lv_obj_set_size(ui->screen_w_io, 984, 460); + lv_obj_set_size(ui->screen_w_io, 980, 450); lv_obj_set_scrollbar_mode(ui->screen_w_io, LV_SCROLLBAR_MODE_OFF); //Write style for screen_w_io, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. diff --git a/applications/lvgl/lv__user_gui.c b/applications/lvgl/lv__user_gui.c index b153a2d..0953387 100644 --- a/applications/lvgl/lv__user_gui.c +++ b/applications/lvgl/lv__user_gui.c @@ -31,6 +31,7 @@ void setup_user_screen(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_textarea_set_text(ui->screen_machine_id, machine_ID);//设备id lv_textarea_set_text(ui->screen_machine_name, machine_name);//设备名