Browse Source

默认信息机台名

master
忱 沈 3 weeks ago
parent
commit
5bdb8cbe2b
  1. 2106
      .cproject
  2. 2
      .project
  3. 2
      applications/INI/config.c
  4. 38
      applications/data/DATA_comm.c
  5. 4
      applications/data/Variable.c

2106
.cproject

File diff suppressed because it is too large

2
.project

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>project</name> <name>828F</name>
<comment /> <comment />
<projects> <projects>
</projects> </projects>

2
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)); 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"); //// ini_set_value(ini,"database", "host","192.168.9.1");

38
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,"SYSTEMP",cJSON_CreateNumber(sys_temperature));
cJSON_AddItemToObject(dat,"SYSHUM",cJSON_CreateNumber(sys_humidity)); cJSON_AddItemToObject(dat,"SYSHUM",cJSON_CreateNumber(sys_humidity));
cJSON_AddItemToObject(dat,"SYSTIME",cJSON_CreateString(systime)); cJSON_AddItemToObject(dat,"SYSTIME",cJSON_CreateString(systime));
cJSON_AddItemToObject(dat,"NAME",cJSON_CreateString(machine_name));
cJSON_AddItemToObject(dat,"VAR",cJSON_CreateString(sys_var)); cJSON_AddItemToObject(dat,"VAR",cJSON_CreateString(sys_var));
} }
else if (strcmp(api, "SC810") == 0) 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_, "INSERT") == 0)
{} {}
else if (strcmp(ins_, "EDIT") == 0) else if (strcmp(ins_, "EDIT") == 0)
{} {
}
else if (strcmp(ins_, "DELETE") == 0) else if (strcmp(ins_, "DELETE") == 0)
{ {
int ID_s; int ID_s;
GET_INT_FROM_ANY(ID_s, root, "ID", sizeof(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 else
{} {}

4
applications/data/Variable.c

@ -14,8 +14,8 @@ unsigned int sys_run_time;//运行时间
char *DATA_dat; char *DATA_dat;
char DATA_machins[3]; char DATA_machins[3];
char DATA_api[5]; char DATA_api[5];
char *machine_name = "828"; char *machine_name;
char machine_ID[3] = "1"; char machine_ID[3];
// 状态标志 // 状态标志
char MACHINE_ERR = 0; char MACHINE_ERR = 0;

Loading…
Cancel
Save