Browse Source

sccm数据分析添加

master
忱 沈 3 weeks ago
parent
commit
313fb91321
  1. 44
      applications/data/DATA_comm.c
  2. 87
      applications/data/SC828_DATA_table.c
  3. 2
      applications/data/SC828_DATA_table.h

44
applications/data/DATA_comm.c

@ -285,9 +285,14 @@ void pasre_DAT(const char *api, const char *json_str)
char ins_[8]; char ins_[8];
GET_STRING(ins_, root, "INSTRUCTION", sizeof(ins_)); GET_STRING(ins_, root, "INSTRUCTION", sizeof(ins_));
if (strcmp(ins_, "START") == 0) if (strcmp(ins_, "START") == 0)
{} {
GET_STRING(Work, root, "Work", sizeof(Work));
DATA_INSTRUCTION_START(Work);
}
else if (strcmp(ins_, "STOP") == 0) else if (strcmp(ins_, "STOP") == 0)
{} {
DATA_INSTRUCTION_STOP();
}
else if (strcmp(ins_, "PAUSE") == 0) else if (strcmp(ins_, "PAUSE") == 0)
{} {}
else if (strcmp(ins_, "CONTINUE") == 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_, "JUMP") == 0)
{} {}
else if (strcmp(ins_, "INSERT") == 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) 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",0);
if (!(ID_s < 0 || ID_s >= 99)) if (!(ID_s < 0 || ID_s >= 99))
{ {

87
applications/data/SC828_DATA_table.c

@ -1,5 +1,6 @@
#include "SC828_DATA_table.h" #include "SC828_DATA_table.h"
#include <rtthread.h> #include <rtthread.h>
#include "Variable.h"
// 系统数据状态表(表格) // 系统数据状态表(表格)
IO_State_DATA data_table[] = { IO_State_DATA data_table[] = {
@ -260,3 +261,89 @@ void DATA_Table_Init(){
rt_snprintf(step_table[i].StepID_S3, 3,"000"); 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");
}

2
applications/data/SC828_DATA_table.h

@ -61,4 +61,6 @@ extern const unsigned char AIO_TABLE_SIZE;
extern const unsigned char DATA_TABLE_SIZE; extern const unsigned char DATA_TABLE_SIZE;
void DATA_Table_Init(void);// void DATA_Table_Init(void);//
void DATA_INSTRUCTION_START(char p[25]);
void DATA_INSTRUCTION_STOP();
#endif #endif

Loading…
Cancel
Save