192 lines
5.0 KiB
C
192 lines
5.0 KiB
C
#include "data.h"
|
|
#include <rtthread.h>
|
|
|
|
|
|
|
|
const StrIndex_t cDownDataType[] =
|
|
{
|
|
{"run",DownRun} ,
|
|
{"stop",DownStop} ,
|
|
{"open",DownOpen} ,
|
|
{"close",DownClose} ,
|
|
{"reg_ans",DownRegistAns} ,
|
|
{"heart_ans",DownHeartAns},
|
|
{"update",DownUpdate},
|
|
{"reboot",DownReboot},
|
|
{"config",DownConfig},
|
|
{"read",DownRead}
|
|
};
|
|
|
|
|
|
|
|
const StrIndex_t cSiteType[] =
|
|
{
|
|
{"sluice",SiteSluice} ,
|
|
{"flow",SiteFlow} ,
|
|
{"press",SiteSee} ,
|
|
{"auto",SiteColl} ,
|
|
{"trans",SiteServer} ,
|
|
{"level",SiteLevel}
|
|
};
|
|
|
|
|
|
const StrIndex_t cMotorType[] =
|
|
{
|
|
{"mg1000",MT_MG_1000} ,
|
|
{"qh100",MT_QH_V100} ,
|
|
{"qh200",MT_QH_V200} ,
|
|
{"zs100",MT_ZS_V100} ,
|
|
{"dy100",MT_DY_V100} ,
|
|
{"kg100",MT_KG_V100}
|
|
};
|
|
|
|
const StrIndex_t c4851Type[] =
|
|
{
|
|
{"mg1000",ST_MG_1000} ,
|
|
{"qh100",ST_QH_V100} ,
|
|
{"qh200",ST_QH_V200} ,
|
|
{"dy100",ST_DY_V100} ,
|
|
{"kg100",ST_KG_V100} ,
|
|
};
|
|
|
|
const StrIndex_t cU485Type[] =
|
|
{
|
|
{"modbus",0}
|
|
};
|
|
|
|
const StrIndex_t c4852Type[] =
|
|
{
|
|
{"rds600",ST_RDS_600} ,
|
|
{"tds300",ST_TDS_300} ,
|
|
{"ht100",ST_HT_V100} ,
|
|
{"zkjszk",ST_ZK_JSZK},
|
|
{"djx100",ST_DJX_100},
|
|
{"rds300",ST_RDS_300}
|
|
};
|
|
|
|
|
|
const ParShallInfo_t ParShallTale[] =
|
|
{
|
|
{.w = 0,.c = 0,.m = 0},
|
|
{.w = 0.152, .c = 0.381, .m = 1.58 ,.minLeve = 0.03, .maxLeve = 0.45, .minFlow = 1.5/1000, .maxFlow = 100/1000},
|
|
{.w = 0.25, .c = 0.561, .m = 1.513 ,.minLeve = 0.03, .maxLeve = 0.60, .minFlow = 3.0/1000, .maxFlow = 250/1000},
|
|
{.w = 0.30, .c = 0.679, .m = 1.521 ,.minLeve = 0.03, .maxLeve = 0.75, .minFlow = 3.5/1000, .maxFlow = 400/1000},
|
|
{.w = 0.45, .c = 1.038, .m = 1.537 ,.minLeve = 0.03, .maxLeve = 0.75, .minFlow = 4.5/1000, .maxFlow = 630/1000},
|
|
{.w = 0.60, .c = 1.403, .m = 1.548 ,.minLeve = 0.05, .maxLeve = 0.75, .minFlow = 12.5/1000, .maxFlow = 850/1000},
|
|
{.w = 0.75, .c = 1.772, .m = 1.557 ,.minLeve = 0.06, .maxLeve = 0.75, .minFlow = 25.0/1000, .maxFlow = 1100/1000},
|
|
{.w = 0.90, .c = 2.147, .m = 1.565 ,.minLeve = 0.06, .maxLeve = 0.75, .minFlow = 30.0/1000, .maxFlow = 1250/1000},
|
|
{.w = 1.00, .c = 2.397, .m = 1.569 ,.minLeve = 0.06, .maxLeve = 0.80, .minFlow = 30.0/1000, .maxFlow = 1500/1000},
|
|
{.w = 1.20, .c = 2.904, .m = 1.577 ,.minLeve = 0.06, .maxLeve = 0.80, .minFlow = 35.0/1000, .maxFlow = 2000/1000},
|
|
{.w = 1.50, .c = 3.668, .m = 1.586 ,.minLeve = 0.06, .maxLeve = 0.80, .minFlow = 45.0/1000, .maxFlow = 2500/1000},
|
|
{.w = 1.80, .c = 4.440, .m = 1.593 ,.minLeve = 0.08, .maxLeve = 0.80, .minFlow = 80.0/1000, .maxFlow = 3000/1000},
|
|
{.w = 2.10, .c = 5.222, .m = 1.599 ,.minLeve = 0.08, .maxLeve = 0.80, .minFlow = 95.0/1000, .maxFlow = 3600/1000},
|
|
{.w = 2.40, .c = 6.004, .m = 1.605 ,.minLeve = 0.08, .maxLeve = 0.80, .minFlow = 100.0/1000, .maxFlow = 4000/1000},
|
|
|
|
{.w = 3.05, .c = 7.463, .m = 1.6 ,.minLeve = 0.09, .maxLeve = 1.07, .minFlow = 0.16, .maxFlow = 8.28},
|
|
{.w = 3.66, .c = 8.859, .m = 1.6 ,.minLeve = 0.09, .maxLeve = 1.37, .minFlow = 0.19, .maxFlow = 14.68},
|
|
{.w = 4.57, .c = 10.96, .m = 1.6 ,.minLeve = 0.09, .maxLeve = 1.67, .minFlow = 0.23, .maxFlow = 25.04},
|
|
{.w = 6.10, .c = 14.45, .m = 1.6 ,.minLeve = 0.09, .maxLeve = 1.83, .minFlow = 0.31, .maxFlow = 37.97},
|
|
|
|
{.w = 7.62, .c = 17.94, .m = 1.6 ,.minLeve = 0.09, .maxLeve = 1.83, .minFlow = 0.38, .maxFlow = 47.16},
|
|
{.w = 9.14, .c = 21.44, .m = 1.6 ,.minLeve = 0.09, .maxLeve = 1.83, .minFlow = 0.46, .maxFlow = 56.33},
|
|
{.w = 12.19, .c = 28.43, .m = 1.6 ,.minLeve = 0.09, .maxLeve = 1.83, .minFlow = 0.60, .maxFlow = 74.70},
|
|
{.w = 15.24, .c = 35.41, .m = 1.6 ,.minLeve = 0.09, .maxLeve = 1.83, .minFlow = 0.75, .maxFlow = 93.04},
|
|
|
|
} ;
|
|
|
|
|
|
|
|
SluiceData_t SluiceData[SLUICE_COUTN];
|
|
WaterData_t WaterData[WATER_COUTN];
|
|
SysData_t SysData;
|
|
|
|
uint32_t g_ifconfig = 0;
|
|
uint32_t g_ifupdate = 0;
|
|
|
|
|
|
int cMotorGetType (char * str)
|
|
{
|
|
for (int i =0;i < sizeof(cMotorType)/sizeof(StrIndex_t);i++)
|
|
{
|
|
if (rt_memcmp(str,cMotorType[i].str,rt_strlen(str)) == 0)
|
|
{
|
|
return cMotorType[i].index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
|
|
int c4851GetType(char * str)
|
|
{
|
|
rt_kprintf("485 option count:%d\r\n",sizeof(c4851Type)/sizeof(StrIndex_t)) ;
|
|
for (int i =0;i < sizeof(c4851Type)/sizeof(StrIndex_t);i++)
|
|
{
|
|
rt_kprintf("%s,%s\r\n",str,c4851Type[i].str) ;
|
|
if (rt_memcmp(str,c4851Type[i].str,rt_strlen(str)) == 0)
|
|
{
|
|
return c4851Type[i].index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
int c4852GetType(char * str)
|
|
{
|
|
for (int i =0;i < sizeof(c4852Type)/sizeof(StrIndex_t);i++)
|
|
{
|
|
if (rt_memcmp(str,c4852Type[i].str,rt_strlen(str)) == 0)
|
|
{
|
|
return c4852Type[i].index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
|
|
int cU485GetType(char *str)
|
|
{
|
|
for (int i =0;i < sizeof(cU485Type)/sizeof(StrIndex_t);i++)
|
|
{
|
|
if (rt_memcmp(str,cU485Type[i].str,rt_strlen(str)) == 0)
|
|
{
|
|
return cU485Type[i].index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
|
|
int cDownType2Index(char * str)
|
|
{
|
|
for (int i =0;i < sizeof(cDownDataType)/sizeof(StrIndex_t);i++)
|
|
{
|
|
if (rt_memcmp(str,cDownDataType[i].str,rt_strlen(str)) == 0)
|
|
{
|
|
return cDownDataType[i].index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
|
|
|
|
int cSiteType2Index(char * str)
|
|
{
|
|
for (int i =0;i < sizeof(cSiteType)/sizeof(StrIndex_t);i++)
|
|
{
|
|
if (rt_memcmp(str,cSiteType[i].str,rt_strlen(str)) == 0)
|
|
{
|
|
return cSiteType[i].index;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|