diff --git a/.cproject b/.cproject index 162ccf9..42d764f 100644 --- a/.cproject +++ b/.cproject @@ -1,1056 +1,1056 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project index 350c330..f059ea4 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ - project + 828F diff --git a/applications/INI/config.c b/applications/INI/config.c index 3d2220f..28fa076 100644 --- a/applications/INI/config.c +++ b/applications/INI/config.c @@ -35,7 +35,7 @@ int read_write_sample(void) } // 读取各种类型的值 strncpy(machine_ID, ini_get_value(ini, "CONFIG", "ID","99"),sizeof(machine_ID)); - machine_name = ini_get_value(ini, "CONFIG", "NAME","828"); + machine_name = ini_get_value(ini, "CONFIG", "NAME","SC828"); //// ini_set_value(ini,"database", "host","192.168.9.1"); diff --git a/applications/data/DATA_comm.c b/applications/data/DATA_comm.c index e663f36..c85c137 100644 --- a/applications/data/DATA_comm.c +++ b/applications/data/DATA_comm.c @@ -131,6 +131,7 @@ void pasre_DAT(const char *api, const char *json_str) cJSON_AddItemToObject(dat,"SYSTEMP",cJSON_CreateNumber(sys_temperature)); cJSON_AddItemToObject(dat,"SYSHUM",cJSON_CreateNumber(sys_humidity)); cJSON_AddItemToObject(dat,"SYSTIME",cJSON_CreateString(systime)); + cJSON_AddItemToObject(dat,"NAME",cJSON_CreateString(machine_name)); cJSON_AddItemToObject(dat,"VAR",cJSON_CreateString(sys_var)); } else if (strcmp(api, "SC810") == 0) @@ -292,12 +293,47 @@ void pasre_DAT(const char *api, const char *json_str) else if (strcmp(ins_, "INSERT") == 0) {} else if (strcmp(ins_, "EDIT") == 0) - {} + { + + } else if (strcmp(ins_, "DELETE") == 0) { int ID_s; GET_INT_FROM_ANY(ID_s, root, "ID", sizeof(ID_s)); + if (!(ID_s < 0 || ID_s >= 99)) + { + // 1. 如果不是最后一项,将 [index+1, 98] 前移一位到 [index, 97] + if (ID_s < 98) { + memmove(&step_table[ID_s],&step_table[ID_s + 1],(98 - ID_s) * sizeof(IO_STEP_DATA)); + } + } + // 2. 末尾(最后一个位置)填入空步骤 + step_table[99].RUN = 0; + step_table[99].Parameter1 = 0; + step_table[99].Parameter2 = 0; + step_table[99].Parameter3 = 0; + step_table[99].Parameter4 = 0; + step_table[99].Parameter5 = 0; + step_table[99].Parameter1_S1 = 0; + step_table[99].Parameter2_S1 = 0; + step_table[99].Parameter3_S1 = 0; + step_table[99].Parameter4_S1 = 0; + step_table[99].Parameter5_S1 = 0; + step_table[99].Parameter1_S2 = 0; + step_table[99].Parameter2_S2 = 0; + step_table[99].Parameter3_S2 = 0; + step_table[99].Parameter4_S2 = 0; + step_table[99].Parameter5_S2 = 0; + step_table[99].Parameter1_S3 = 0; + step_table[99].Parameter2_S3 = 0; + step_table[99].Parameter3_S3 = 0; + step_table[99].Parameter4_S3 = 0; + step_table[99].Parameter5_S3 = 0; + rt_snprintf(step_table[99].StepID, 3,"000"); + rt_snprintf(step_table[99].StepID_S1, 3,"000"); + rt_snprintf(step_table[99].StepID_S2, 3,"000"); + rt_snprintf(step_table[99].StepID_S3, 3,"000"); } else {} diff --git a/applications/data/Variable.c b/applications/data/Variable.c index 5ddb3a6..3743962 100644 --- a/applications/data/Variable.c +++ b/applications/data/Variable.c @@ -14,8 +14,8 @@ unsigned int sys_run_time;//运行时间 char *DATA_dat; char DATA_machins[3]; char DATA_api[5]; -char *machine_name = "828"; -char machine_ID[3] = "1"; +char *machine_name; +char machine_ID[3]; // 状态标志 char MACHINE_ERR = 0;