|
|
|
@ -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 |
|
|
|
{} |
|
|
|
|