From 313fb9132181c5d557efc95d59c31575e42d1838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=B1=20=E6=B2=88?= <2401809606@qq.com> Date: Fri, 2 Jan 2026 16:53:13 +0800 Subject: [PATCH] =?UTF-8?q?sccm=E6=95=B0=E6=8D=AE=E5=88=86=E6=9E=90?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/data/DATA_comm.c | 44 ++++++++++++-- applications/data/SC828_DATA_table.c | 87 ++++++++++++++++++++++++++++ applications/data/SC828_DATA_table.h | 2 + 3 files changed, 127 insertions(+), 6 deletions(-) diff --git a/applications/data/DATA_comm.c b/applications/data/DATA_comm.c index a0899e3..f123ca0 100644 --- a/applications/data/DATA_comm.c +++ b/applications/data/DATA_comm.c @@ -285,9 +285,14 @@ void pasre_DAT(const char *api, const char *json_str) char ins_[8]; GET_STRING(ins_, root, "INSTRUCTION", sizeof(ins_)); if (strcmp(ins_, "START") == 0) - {} + { + GET_STRING(Work, root, "Work", sizeof(Work)); + DATA_INSTRUCTION_START(Work); + } else if (strcmp(ins_, "STOP") == 0) - {} + { + DATA_INSTRUCTION_STOP(); + } else if (strcmp(ins_, "PAUSE") == 0) {} else if (strcmp(ins_, "CONTINUE") == 0) @@ -295,15 +300,42 @@ void pasre_DAT(const char *api, const char *json_str) else if (strcmp(ins_, "JUMP") == 0) {} else if (strcmp(ins_, "INSERT") == 0) - {} - else if (strcmp(ins_, "EDIT") == 0) { + } + else if (strcmp(ins_, "EDIT") == 0) + {//编辑 + int ID_s; + GET_INT_FROM_ANY(ID_s,root, "ID",0); + GET_INT_FROM_ANY(step_table[ID_s-1].Parameter1, root, "P1", 0); + GET_INT_FROM_ANY(step_table[ID_s-1].Parameter2, root, "P2", 0); + GET_INT_FROM_ANY(step_table[ID_s-1].Parameter3, root, "P3", 0); + GET_INT_FROM_ANY(step_table[ID_s-1].Parameter4, root, "P4", 0); + GET_INT_FROM_ANY(step_table[ID_s-1].Parameter5, root, "P5", 0); + GET_INT_FROM_ANY(step_table[ID_s-1].Parameter1_S1, root, "P1S1",0); + GET_INT_FROM_ANY(step_table[ID_s-1].Parameter2_S1, root, "P2S1",0); + GET_INT_FROM_ANY(step_table[ID_s-1].Parameter3_S1, root, "P3S1",0); + GET_INT_FROM_ANY(step_table[ID_s-1].Parameter4_S1, root, "P4S1",0); + GET_INT_FROM_ANY(step_table[ID_s-1].Parameter5_S1, root, "P5S1",0); + step_table[ID_s-1].Parameter1_S2 = 0; + step_table[ID_s-1].Parameter2_S2 = 0; + step_table[ID_s-1].Parameter3_S2 = 0; + step_table[ID_s-1].Parameter4_S2 = 0; + step_table[ID_s-1].Parameter5_S2 = 0; + step_table[ID_s-1].Parameter1_S3 = 0; + step_table[ID_s-1].Parameter2_S3 = 0; + step_table[ID_s-1].Parameter3_S3 = 0; + step_table[ID_s-1].Parameter4_S3 = 0; + step_table[ID_s-1].Parameter5_S3 = 0; + GET_STRING(step_table[ID_s-1].StepID, root, "StepID", 3); + GET_STRING(step_table[ID_s-1].StepID_S1, root, "SIDS1", 3); + rt_snprintf(step_table[ID_s-1].StepID_S2, 3,"000"); + rt_snprintf(step_table[ID_s-1].StepID_S3, 3,"000"); } else if (strcmp(ins_, "DELETE") == 0) - { + {//删除 int ID_s; - GET_INT_FROM_ANY(ID_s, root, "ID", sizeof(ID_s)); + GET_INT_FROM_ANY(ID_s,root, "ID",0); if (!(ID_s < 0 || ID_s >= 99)) { diff --git a/applications/data/SC828_DATA_table.c b/applications/data/SC828_DATA_table.c index b123e80..4bc5dd2 100644 --- a/applications/data/SC828_DATA_table.c +++ b/applications/data/SC828_DATA_table.c @@ -1,5 +1,6 @@ #include "SC828_DATA_table.h" #include +#include "Variable.h" // 系统数据状态表(表格) IO_State_DATA data_table[] = { @@ -260,3 +261,89 @@ void DATA_Table_Init(){ rt_snprintf(step_table[i].StepID_S3, 3,"000"); } } +//运行指令:开始 +void DATA_INSTRUCTION_START(char p[25]){ + for(int i=0;i<99;i++) + { + step_table[i].RUN = 0; + step_table[i].Parameter1 = 0; + step_table[i].Parameter2 = 0; + step_table[i].Parameter3 = 0; + step_table[i].Parameter4 = 0; + step_table[i].Parameter5 = 0; + step_table[i].Parameter1_S1 = 0; + step_table[i].Parameter2_S1 = 0; + step_table[i].Parameter3_S1 = 0; + step_table[i].Parameter4_S1 = 0; + step_table[i].Parameter5_S1 = 0; + step_table[i].Parameter1_S2 = 0; + step_table[i].Parameter2_S2 = 0; + step_table[i].Parameter3_S2 = 0; + step_table[i].Parameter4_S2 = 0; + step_table[i].Parameter5_S2 = 0; + step_table[i].Parameter1_S3 = 0; + step_table[i].Parameter2_S3 = 0; + step_table[i].Parameter3_S3 = 0; + step_table[i].Parameter4_S3 = 0; + step_table[i].Parameter5_S3 = 0; + rt_snprintf(step_table[i].StepID, 3,"000"); + rt_snprintf(step_table[i].StepID_S1, 3,"000"); + 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; + 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; + P5S1 =0;P1S2 =0;P2S2 =0;P3S2 =0; + P4S2 =0;P5S2 =0;P1S3 =0;P2S3 =0; + P3S3 =0;P4S3 =0;P5S3 =0; + rt_snprintf(StepID, 3,"000"); + rt_snprintf(SIDS1, 3,"000"); + rt_snprintf(SIDS2, 3,"000"); + rt_snprintf(SIDS3, 3,"000"); +} +//运行指令:结束 +void DATA_INSTRUCTION_STOP(){ + for(int i=0;i<99;i++) + { + step_table[i].RUN = 0; + step_table[i].Parameter1 = 0; + step_table[i].Parameter2 = 0; + step_table[i].Parameter3 = 0; + step_table[i].Parameter4 = 0; + step_table[i].Parameter5 = 0; + step_table[i].Parameter1_S1 = 0; + step_table[i].Parameter2_S1 = 0; + step_table[i].Parameter3_S1 = 0; + step_table[i].Parameter4_S1 = 0; + step_table[i].Parameter5_S1 = 0; + step_table[i].Parameter1_S2 = 0; + step_table[i].Parameter2_S2 = 0; + step_table[i].Parameter3_S2 = 0; + step_table[i].Parameter4_S2 = 0; + step_table[i].Parameter5_S2 = 0; + step_table[i].Parameter1_S3 = 0; + step_table[i].Parameter2_S3 = 0; + step_table[i].Parameter3_S3 = 0; + step_table[i].Parameter4_S3 = 0; + step_table[i].Parameter5_S3 = 0; + rt_snprintf(step_table[i].StepID, 3,"000"); + rt_snprintf(step_table[i].StepID_S1, 3,"000"); + 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; + 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; + P5S1 =0;P1S2 =0;P2S2 =0;P3S2 =0; + P4S2 =0;P5S2 =0;P1S3 =0;P2S3 =0; + P3S3 =0;P4S3 =0;P5S3 =0; + rt_snprintf(StepID, 3,"000"); + rt_snprintf(SIDS1, 3,"000"); + rt_snprintf(SIDS2, 3,"000"); + rt_snprintf(SIDS3, 3,"000"); +} diff --git a/applications/data/SC828_DATA_table.h b/applications/data/SC828_DATA_table.h index aa5bcf6..2222e74 100644 --- a/applications/data/SC828_DATA_table.h +++ b/applications/data/SC828_DATA_table.h @@ -61,4 +61,6 @@ extern const unsigned char AIO_TABLE_SIZE; extern const unsigned char DATA_TABLE_SIZE; void DATA_Table_Init(void);// +void DATA_INSTRUCTION_START(char p[25]); +void DATA_INSTRUCTION_STOP(); #endif