Files
g0b1vetx-board/Board/data.c
T
2584532475@qq.com 555025be10 Merge branch 'master' of https://gitee.com/zyjzjs/g0b1vetx-board
# Conflicts:
#	Board/data.c
#	Board/data.h
#	Board/di-board.c
#	Board/di-board.h
#	MDK-ARM/GB01VETx.uvguix.Memory
2024-05-31 17:12:42 +08:00

300 lines
7.8 KiB
C

#include "data.h"
#include <rtthread.h>
/******************************************
* 版本信息
******************************************/
volatile const char _makeData[] = __DATE__; //12字节,编译日期
volatile const char _makeTime[] = __TIME__; //9字节
volatile const char cBootv[] = "Ver3.0.0"; //获取时添加上面两个时间信息,最大长度64字节
char _versionTemp[64];
<<<<<<< HEAD
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},
{"fact", DownFact}
=======
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} ,
{"fact",DownFact}
>>>>>>> 3a537f633c99d30fa3fe5d01105f6525a48d3d72
};
const StrIndex_t cSiteType[] =
{
<<<<<<< HEAD
{"sluice", SiteSluice},
{"flow", SiteFlow},
{"press", SiteSee},
{"auto", SiteColl}, // 自动化采集站
{"trans", SiteServer},
{"level", SiteLevel},
{"skew", SiteSkew} //测斜仪
=======
{"sluice",SiteSluice} ,
{"flow",SiteFlow} ,
{"press",SiteSee} ,
{"auto",SiteColl} , // 自动化采集站
{"trans",SiteServer} ,
{"level",SiteLevel},
{"skew",SiteSkew} //测斜仪
>>>>>>> 3a537f633c99d30fa3fe5d01105f6525a48d3d72
};
const StrIndex_t cMotorType[] =
{
<<<<<<< HEAD
{"mg1000", MT_MG_1000},
{"qh100", MT_QH_V100},
{"qh200", MT_QH_V200},
{"zs100", MT_ZS_V100},
{"jz200", MT_JZ_V200}, // 金志 4-20 ma
=======
{"mg1000",MT_MG_1000} ,
{"qh100", MT_QH_V100} ,
{"qh200", MT_QH_V200} ,
{"zs100", MT_ZS_V100} ,
{"jz200", MT_JZ_V200} , // 金志 4-20 ma
>>>>>>> 3a537f633c99d30fa3fe5d01105f6525a48d3d72
{"dy100", MT_DY_V100}, // 大禹锥型阀
{"kg100", MT_KG_V100}, // 开关量模块
{"kr100", MT_KR_V100}, // 闸位计
{"asca3", MT_ASC_A3}, // A3 驱动器
{"ascws", MT_ASC_WS}, // A3 驱动器
};
const StrIndex_t c4851Type[] =
{
<<<<<<< HEAD
{"mg1000", ST_MG_1000},
{"qh100", ST_QH_V100},
{"qh200", ST_QH_V200},
{"zs100", ST_ZS_V100}, // 中盛4-20ma
{"dy100", ST_DY_V100},
{"kg100", ST_KG_V100},
{"at100", ST_AT_V100},
{"kr100", ST_KR_V100},
=======
{"mg1000",ST_MG_1000} ,
{"qh100",ST_QH_V100} ,
{"qh200",ST_QH_V200} ,
{"dy100",ST_DY_V100} ,
{"kg100",ST_KG_V100} ,
{"at100",ST_AT_V100} ,
>>>>>>> 3a537f633c99d30fa3fe5d01105f6525a48d3d72
};
const StrIndex_t cU485Type[] =
{
{"modbus", 0}
};
// 485 2 通道
<<<<<<< HEAD
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},
{"mi600", ST_MI_600} // 测斜仪
=======
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},
{"mi600",ST_MI_600} // 测斜仪
>>>>>>> 3a537f633c99d30fa3fe5d01105f6525a48d3d72
};
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];
InclinometerData_t IncData[6]; // 测斜仪数据
SysData_t SysData;
<<<<<<< HEAD
SOFTRTC_t g_SoftRtc =
{
23, 10, 1, 0, 0, 0
=======
SOFTRTC_t g_SoftRtc = {
23,10,1,0,0,0
>>>>>>> 3a537f633c99d30fa3fe5d01105f6525a48d3d72
};
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;
}
/**********************************************
获取boot版本信息
**********************************************/
<<<<<<< HEAD
void *GetVersion (void)
{
int i = rt_sprintf (_versionTemp, "%s-%s %s", cBootv, _makeData, _makeTime);
_versionTemp[i] = 0;
return (void*) _versionTemp;
=======
void *GetVersion(void)
{
int i = rt_sprintf(_versionTemp,"%s-%s %s",cBootv, _makeData, _makeTime);
_versionTemp[i] = 0;
return (void*)_versionTemp;
>>>>>>> 3a537f633c99d30fa3fe5d01105f6525a48d3d72
}