|
|
@@ -266,6 +266,7 @@ static void HMI_Decode(void)
|
|
|
//ID
|
|
|
HMI_WRITE("menu.equipid.txt=\"%s\"",device_status.imei);
|
|
|
//HMI_WRITE("workSta.equipid.txt=\"%s\"",device_status.imei);
|
|
|
+ HMI_WRITE("menu.deviceId.txt=\"%s\"",device_status.deviceId);
|
|
|
//数据上传间隔
|
|
|
HMI_WRITE("menu.datt.txt=\"%d\"",device_status.dattim);
|
|
|
HMI_WRITE("menu.next.txt=\"%d\"",device_status.num_updata);
|
|
|
@@ -660,6 +661,26 @@ static void HMI_Decode(void)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ //设备编码设置
|
|
|
+ else if (strstr(rx_buffer,"deviceId=")!=NULL) {
|
|
|
+ char value_str[20];
|
|
|
+ memset(value_str,0,sizeof(value_str));
|
|
|
+ LOG_I("设备编码 长度:%d",strlen(rx_buffer));
|
|
|
+ if(strlen(rx_buffer)!=27){
|
|
|
+ LOG_E("编码长度错误!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var = strstr(rx_buffer,"=");
|
|
|
+ var ++;
|
|
|
+ strncpy(value_str,var,16); //设备编码为16位
|
|
|
+ rt_sprintf(device_status.deviceId,"%s",value_str);
|
|
|
+ ef_set_env_blob("deviceId", &device_status.deviceId, sizeof(device_status.deviceId));
|
|
|
+ LOG_I("解析到设备编码:%s",device_status.deviceId);
|
|
|
+ char *device_id = makeJson_Config_BDH(device_status.deviceId);
|
|
|
+ //发送json到RTU
|
|
|
+ DTU_Write("%s",device_id);
|
|
|
+ rt_free(device_id);
|
|
|
+ }
|
|
|
//定时设置
|
|
|
else if (strstr(rx_buffer,"saveClockSet=")!=NULL) {
|
|
|
char value_str[10];
|
|
|
@@ -887,10 +908,10 @@ static void HMI_Decode(void)
|
|
|
var = strstr(rx_buffer,"=");
|
|
|
var ++;
|
|
|
strncpy(clt_time_str,var,2);
|
|
|
- if(atoi(clt_time_str)>0 && atoi(clt_time_str) <= 30)
|
|
|
+ if(atoi(clt_time_str)>0 && atoi(clt_time_str) <= 240)
|
|
|
{
|
|
|
- device_status.clt_time = atoi(clt_time_str); //收集时间
|
|
|
- ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time));
|
|
|
+ device_status.cul_time = atoi(clt_time_str); //收集时间
|
|
|
+ ef_set_env_blob("cul_time", &device_status.cul_time, sizeof(device_status.cul_time));
|
|
|
}
|
|
|
strncpy(heattime_str,var+2,2);
|
|
|
if(atoi(heattime_str)>0 && atoi(heattime_str) <= 30)
|
|
|
@@ -972,6 +993,21 @@ static void HMI_Decode(void)
|
|
|
}
|
|
|
rt_free(var);
|
|
|
rt_kprintf("数据上传设置:%d\n",device_status.dattim);
|
|
|
+ }else if(strstr(rx_buffer,"saveXYtype=")!=NULL)
|
|
|
+ {
|
|
|
+ static char xy_str[3];
|
|
|
+ LOG_I("修改诱芯!");
|
|
|
+ var = strstr(rx_buffer,"=");
|
|
|
+ var ++;
|
|
|
+ strncpy(xy_str,var,2);
|
|
|
+ if(atoi(xy_str)>=0&&atoi(xy_str)<=100){
|
|
|
+ LOG_I("修改诱芯:%d",atoi(xy_str));
|
|
|
+ device_status.InsectSpecies =atoi(xy_str); //昆虫种类
|
|
|
+ ef_set_env_blob("InsectSpecies", &device_status.InsectSpecies, sizeof(device_status.InsectSpecies));
|
|
|
+ MA_save();
|
|
|
+ }else{
|
|
|
+ LOG_E("诱芯设置失败!");
|
|
|
+ }
|
|
|
}
|
|
|
//光控测试
|
|
|
else if(strstr(rx_buffer,"putTest.switchSun=1")!=NULL)
|
|
|
@@ -1082,38 +1118,6 @@ static void HMI_Decode(void)
|
|
|
else if (strstr(rx_buffer,"DebugDisable")!=NULL) {
|
|
|
Debug_log_OFF();
|
|
|
}
|
|
|
- //1.0
|
|
|
- else if (strstr(rx_buffer,"SwversionV1")!=NULL)
|
|
|
- {
|
|
|
- if(device_status.version_type != 1)
|
|
|
- {
|
|
|
- device_status.dtype = 3;
|
|
|
- device_status.version_type = 1;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_ZP);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
- MA_save();
|
|
|
- }
|
|
|
- else {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- //高空
|
|
|
- else if (strstr(rx_buffer,"SwversionV11")!=NULL)
|
|
|
- {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 11)
|
|
|
- {
|
|
|
- device_status.version_type = 11;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_GK);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
- MA_save();
|
|
|
- }
|
|
|
- else {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
//4.0
|
|
|
else if (strstr(rx_buffer,"SwversionV41")!=NULL) {
|
|
|
device_status.dtype = 3;
|
|
|
@@ -1130,84 +1134,6 @@ static void HMI_Decode(void)
|
|
|
else {
|
|
|
|
|
|
}
|
|
|
- }
|
|
|
- //4.0-4800w
|
|
|
- else if (strstr(rx_buffer,"SwversionV48")!=NULL) {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 48)
|
|
|
- {
|
|
|
- device_status.dtype = 3;
|
|
|
- device_status.version_type = 48;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_HK_4800W);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型+
|
|
|
- DTU_Write("SwversionV41");
|
|
|
- MA_save();
|
|
|
- }
|
|
|
- else {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- //水稻
|
|
|
- else if (strstr(rx_buffer,"SwversionV4")!=NULL) {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 4)
|
|
|
- {
|
|
|
- device_status.version_type = 4;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_HK_2000W);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
- DTU_Write("SwversionV4");
|
|
|
- MA_save();
|
|
|
- }
|
|
|
- else {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- //5.0测报灯
|
|
|
- else if (strstr(rx_buffer,"SwversionV5")!=NULL) {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type!=5)
|
|
|
- {
|
|
|
- device_status.version_type = 5;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_V5);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
- MA_save();
|
|
|
- }
|
|
|
- }
|
|
|
- //吸虫塔
|
|
|
- else if (strstr(rx_buffer,"SwversionV6")!=NULL) {
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 6)
|
|
|
- {
|
|
|
- device_status.version_type = 6;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_XCT);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //版本类型
|
|
|
- MA_save();
|
|
|
- }
|
|
|
- }
|
|
|
- else if (strstr(rx_buffer,"SwversionV30")!=NULL) {
|
|
|
- if(device_status.version_type != 30)
|
|
|
- {
|
|
|
- device_status.version_type = 30;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_Robot);
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- MA_save();
|
|
|
- }
|
|
|
- }
|
|
|
- else if((strstr(rx_buffer,"SwversionV7")!=NULL)) {
|
|
|
- if(device_status.dtype!=7)
|
|
|
- {
|
|
|
- LOG_D("设置版本类型:7");
|
|
|
- device_status.dtype = 7;
|
|
|
- device_status.version_type = 7;
|
|
|
- ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype)); //设备类型
|
|
|
- ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type)); //版本类型
|
|
|
- DTU_Write("SwversionV7");
|
|
|
- MA_save();
|
|
|
- }
|
|
|
}else if((strstr(rx_buffer,"SwversionV8")!=NULL)) {
|
|
|
if(device_status.dtype!=8)
|
|
|
{
|
|
|
@@ -1693,8 +1619,8 @@ void Check_ParamConfig(void)
|
|
|
{
|
|
|
device_status.iSave=FLASH_FLAG;
|
|
|
/*设备类型,7孢子仪,3测报灯,默认设置测报灯*/
|
|
|
- device_status.dtype = 3;
|
|
|
- device_status.version_type = 4; //4.0
|
|
|
+ device_status.dtype = 8;
|
|
|
+ device_status.version_type = 8; //4.0
|
|
|
device_status.clt_time = 10; //收集时间
|
|
|
device_status.heattime = 10; //加热时间
|
|
|
device_status.heatvalue=100;//加热温度
|
|
|
@@ -1719,9 +1645,11 @@ void Check_ParamConfig(void)
|
|
|
device_status.collecting_eh2 = 16;
|
|
|
device_status.cold_sw = 0;
|
|
|
device_status.heat_sw =0;
|
|
|
- device_status.cul_time = 1;
|
|
|
+ device_status.cul_time = 60;
|
|
|
device_status.run_sta = 0;
|
|
|
-
|
|
|
+ device_status.InsectSpecies = 0;
|
|
|
+ device_status.Power_Type = 0;
|
|
|
+ sprintf(device_status.deviceId,"0");
|
|
|
sprintf(device_status.driver, "%s",VERSION_HK);
|
|
|
rt_sprintf(device_status.tempture, "-15");
|
|
|
rt_sprintf(device_status.humidity, "31");
|
|
|
@@ -1755,6 +1683,9 @@ void Check_ParamConfig(void)
|
|
|
ef_set_env_blob("collecting_sh2",&device_status.collecting_sh2,sizeof(device_status.collecting_sh2)); //采集时间
|
|
|
ef_set_env_blob("collecting_eh2",&device_status.collecting_eh2,sizeof(device_status.collecting_eh2)); //采集时间
|
|
|
ef_set_env_blob("run_sta", &device_status.run_sta, sizeof(device_status.run_sta)); //
|
|
|
+ ef_set_env_blob("InsectSpecies", &device_status.InsectSpecies, sizeof(device_status.InsectSpecies)); //昆虫种类
|
|
|
+ ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type)); //供电类型
|
|
|
+ ef_set_env_blob("deviceId", &device_status.deviceId, sizeof(device_status.deviceId)); //设备编码
|
|
|
LOG_I("SOFTWARE VERSION:%s",device_status.driver);
|
|
|
LOG_I("Default paramconf is:");
|
|
|
LOG_I("stime:%d",device_status.iSave);
|
|
|
@@ -1767,6 +1698,8 @@ void Check_ParamConfig(void)
|
|
|
LOG_I("jheat:%d",device_status.heatvalue);
|
|
|
LOG_I("thsp:%d", device_status.thsp);
|
|
|
LOG_I("passwd:%d",device_status.passWord);
|
|
|
+ LOG_I("InsectSpecies:%d",device_status.InsectSpecies);
|
|
|
+ LOG_I("Power_Type:%d",device_status.Power_Type);
|
|
|
|
|
|
}//从easyflash读取参数配置
|
|
|
else if (device_status.iSave==FLASH_FLAG) {
|
|
|
@@ -1808,22 +1741,14 @@ void Check_ParamConfig(void)
|
|
|
ef_get_env_blob("collecting_sh2",&device_status.collecting_sh2,sizeof(device_status.collecting_sh2),NULL); //采集开始2
|
|
|
ef_get_env_blob("collecting_eh2",&device_status.collecting_eh2,sizeof(device_status.collecting_eh2),NULL); //采集结束2
|
|
|
ef_get_env_blob("run_sta",&device_status.run_sta,sizeof(device_status.run_sta),NULL); //运行状态
|
|
|
+ ef_get_env_blob("InsectSpecies",&device_status.InsectSpecies,sizeof(device_status.InsectSpecies),NULL); //昆虫种类
|
|
|
+ ef_get_env_blob("Power_Type",&device_status.Power_Type,sizeof(device_status.Power_Type),NULL); //昆虫种类
|
|
|
+ ef_get_env_blob("deviceId",&device_status.deviceId,sizeof(device_status.deviceId),NULL); //昆虫种类
|
|
|
device_status.light_over_tim = device_status.sunBar * 3600; //光控计数
|
|
|
- device_status.work_done = 0;
|
|
|
- //工作完成标志位
|
|
|
- if(device_status.dattim==0)
|
|
|
- {
|
|
|
- device_status.dattim = 20;
|
|
|
- }
|
|
|
- /*设备类型,7孢子仪,3测报灯,默认设置测报灯*/
|
|
|
- if(device_status.dtype!=7)
|
|
|
- {
|
|
|
- if(device_status.dtype!=8)
|
|
|
- device_status.dtype = 3;
|
|
|
- }
|
|
|
- else {
|
|
|
- device_status.version_type = 7;
|
|
|
- }
|
|
|
+ device_status.work_done = 0; //工作完成标志位
|
|
|
+
|
|
|
+ device_status.dtype = 8;
|
|
|
+ device_status.version_type = 8;
|
|
|
if(device_status.version_type==0)
|
|
|
{
|
|
|
app_partion_backup(); //固件备份至df_area
|
|
|
@@ -1902,6 +1827,10 @@ void Check_ParamConfig(void)
|
|
|
LOG_I("上传平台:%s",device_status.mqttcfg1);
|
|
|
LOG_I("孢子仪运行状态:%d",device_status.run_sta);
|
|
|
LOG_I("孢子仪采集时间:[%d-%d,%d-%d]",device_status.collecting_sh1,device_status.collecting_eh1,device_status.collecting_sh2,device_status.collecting_eh2);
|
|
|
+ LOG_I("InsectSpecies:%d",device_status.InsectSpecies);
|
|
|
+ LOG_I("PowerType:%d",device_status.Power_Type);
|
|
|
+ LOG_I("deviceId:%s",device_status.deviceId);
|
|
|
+
|
|
|
}
|
|
|
//RTC时间判断,如果当前年份小于2020,提示需要设置时间,切换为光控
|
|
|
if(device_status.update_flag==1)
|
|
|
@@ -1919,11 +1848,8 @@ void Check_ParamConfig(void)
|
|
|
|
|
|
ctr_router(ON);
|
|
|
Hmi_Fresh();
|
|
|
- if(device_status.dtype!=7)
|
|
|
- {
|
|
|
- Control_clear();
|
|
|
- Control_heat();
|
|
|
- }
|
|
|
+ Control_clear();
|
|
|
+ Control_heat();
|
|
|
dtu_data_play();
|
|
|
sht30_collect();
|
|
|
#if SENSOR_EN==1
|
|
|
@@ -1975,6 +1901,11 @@ void Check_ParamConfig(void)
|
|
|
}
|
|
|
void ResetParamDefault(void)
|
|
|
{
|
|
|
+ device_status.dtype = 8;
|
|
|
+ device_status.version_type = 8;
|
|
|
+ ef_set_env_blob("dtype", &device_status.dtype, sizeof(device_status.dtype));
|
|
|
+ device_status.InsectSpecies = 0;
|
|
|
+ ef_set_env_blob("InsectSpecies", &device_status.InsectSpecies, sizeof(device_status.InsectSpecies));
|
|
|
rt_sprintf(device_status.tempture,"%d",-15);
|
|
|
device_status.ds = 1; //设备状态开机
|
|
|
device_status.thsp = 300;
|
|
|
@@ -1984,14 +1915,17 @@ void ResetParamDefault(void)
|
|
|
device_status.collecting_eh1 = 10;
|
|
|
device_status.collecting_sh2 = 14;
|
|
|
device_status.collecting_eh2 = 16;
|
|
|
-
|
|
|
- if(device_status.dtype==3)
|
|
|
+ device_status.Power_Type = 1;
|
|
|
+ ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
|
|
|
+ if(device_status.dtype==8)
|
|
|
{
|
|
|
- device_status.clt_time = 10; //收集时间
|
|
|
- device_status.dattim = 20; //数据上传间隔
|
|
|
+ device_status.clt_time = 60; //收集时间
|
|
|
+ ef_set_env_blob("cul_time", &device_status.cul_time, sizeof(device_status.cul_time));
|
|
|
+ device_status.dattim = 30; //数据上传间隔
|
|
|
+ ef_set_env_blob("dattim", &device_status.dattim, sizeof(device_status.dattim)); //数据上传间隔
|
|
|
#if LAMP_EN == 0
|
|
|
- device_status.startBar = 20; //定时开始时间
|
|
|
- device_status.stopBar = 5; //定时结束时间
|
|
|
+ device_status.startBar = 0; //定时开始时间
|
|
|
+ device_status.stopBar = 0; //定时结束时间
|
|
|
#endif
|
|
|
device_status.heattime = 10; //加热时间
|
|
|
device_status.shake_ws = 1; //针对开关
|
|
|
@@ -2038,12 +1972,19 @@ void ResetParamDefault(void)
|
|
|
}
|
|
|
void ResetParamDefault_DC(void)
|
|
|
{
|
|
|
+ device_status.dtype = 8;
|
|
|
+ device_status.version_type = 8;
|
|
|
+ ef_set_env_blob("dtype", &device_status.dtype, sizeof(device_status.dtype));
|
|
|
+ device_status.InsectSpecies = 0;
|
|
|
+ ef_set_env_blob("InsectSpecies", &device_status.InsectSpecies, sizeof(device_status.InsectSpecies));
|
|
|
//将温度数据设置为-15摄氏度,以便上传的数据中包含温控数据
|
|
|
rt_sprintf(device_status.tempture,"%d",-15);
|
|
|
- device_status.clt_time = 10; //收集时间
|
|
|
- device_status.dattim = 20; //数据上传间隔
|
|
|
+ device_status.clt_time = 60; //收集时间
|
|
|
+ ef_set_env_blob("cul_time", &device_status.cul_time, sizeof(device_status.cul_time));
|
|
|
+ device_status.dattim = 30; //数据上传间隔
|
|
|
+ ef_set_env_blob("dattim", &device_status.dattim, sizeof(device_status.dattim)); //数据上传间隔
|
|
|
#if LAMP_EN == 0
|
|
|
- device_status.startBar = 20; //定时开始时间
|
|
|
+ device_status.startBar = 0; //定时开始时间
|
|
|
device_status.stopBar = 0; //定时结束时间
|
|
|
#endif
|
|
|
device_status.heattime = 10; //加热时间
|
|
|
@@ -2054,6 +1995,7 @@ void ResetParamDefault_DC(void)
|
|
|
#else
|
|
|
device_status.sunBar = 4;
|
|
|
#endif
|
|
|
+ device_status.Power_Type = 0;
|
|
|
device_status.tph = 70; //高温保护阈值
|
|
|
device_status.tpl = -5; //低温保护阈值
|
|
|
device_status.timeSwitch = 0; //定时模式
|
|
|
@@ -2062,6 +2004,8 @@ void ResetParamDefault_DC(void)
|
|
|
device_status.thsp = 300;
|
|
|
device_status.passWord = 8888;
|
|
|
device_status.timeSwitch = 0;
|
|
|
+ device_status.Power_Type = 0;
|
|
|
+ ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
|
|
|
ef_set_env_blob("ds", &device_status.ds, sizeof(device_status.ds));
|
|
|
ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time));
|
|
|
ef_set_env_blob("startBar", &device_status.startBar, sizeof(device_status.startBar));
|
|
|
@@ -2076,6 +2020,7 @@ void ResetParamDefault_DC(void)
|
|
|
ef_set_env_blob("shake_sec", &device_status.shake_sec, sizeof(device_status.shake_sec)); //震动时间
|
|
|
ef_set_env_blob("thsp", &device_status.thsp, sizeof(device_status.thsp));
|
|
|
ef_set_env_blob("passWord", &device_status.passWord,sizeof(device_status.passWord));
|
|
|
+ ef_set_env_blob("Power_Type", &device_status.passWord,sizeof(device_status.Power_Type));
|
|
|
DTU_Write("reset.mp3");
|
|
|
rt_thread_delay(1000);
|
|
|
}
|