|
|
@@ -265,6 +265,7 @@ static void HMI_Decode(void)
|
|
|
HMI_WRITE("workSta.bt0.val=%d",atoi(device_status.sim));
|
|
|
//ID
|
|
|
HMI_WRITE("menu.equipid.txt=\"%s\"",device_status.imei);
|
|
|
+ HMI_WRITE("menu.deviceId.txt=\"%s\"",device_status.deviceId);
|
|
|
//HMI_WRITE("workSta.equipid.txt=\"%s\"",device_status.imei);
|
|
|
//数据上传间隔
|
|
|
HMI_WRITE("uploadSet.datt.val=%d",device_status.dattim);
|
|
|
@@ -652,6 +653,26 @@ static void HMI_Decode(void)
|
|
|
device_status.vol = 111;
|
|
|
LOG_I("开始排虫!");
|
|
|
}
|
|
|
+ //设备编码设置
|
|
|
+ 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];
|
|
|
@@ -1123,23 +1144,6 @@ static void HMI_Decode(void)
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- //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;
|
|
|
@@ -1715,6 +1719,7 @@ void Check_ParamConfig(void)
|
|
|
/*设备类型,7孢子仪,3测报灯,默认设置测报灯*/
|
|
|
device_status.dtype = 3;
|
|
|
device_status.version_type = 4; //4.0
|
|
|
+ device_status.Power_Type = 0; //0-电池供电;1-交流供电
|
|
|
device_status.clt_time = 10; //收集时间
|
|
|
device_status.heattime = 10; //加热时间
|
|
|
device_status.heatvalue=100;//加热温度
|
|
|
@@ -1743,6 +1748,7 @@ void Check_ParamConfig(void)
|
|
|
device_status.run_sta = 0;
|
|
|
|
|
|
sprintf(device_status.driver, "%s",VERSION_HK);
|
|
|
+ sprintf(device_status.deviceId,"0");
|
|
|
rt_sprintf(device_status.tempture, "-15");
|
|
|
rt_sprintf(device_status.humidity, "31");
|
|
|
rt_sprintf(device_status.mqttcfg1, "8.136.98.49");
|
|
|
@@ -1775,6 +1781,8 @@ 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("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
|
|
|
+
|
|
|
LOG_I("SOFTWARE VERSION:%s",device_status.driver);
|
|
|
LOG_I("Default paramconf is:");
|
|
|
LOG_I("stime:%d",device_status.iSave);
|
|
|
@@ -1828,6 +1836,8 @@ 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("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;
|
|
|
//工作完成标志位
|
|
|
@@ -1885,9 +1895,6 @@ void Check_ParamConfig(void)
|
|
|
else if (device_status.version_type==30) {
|
|
|
rt_sprintf(device_status.driver, "%s",VERSION_Robot);
|
|
|
}
|
|
|
- else if (device_status.version_type==48) {
|
|
|
- rt_sprintf(device_status.driver, "%s",VERSION_HK_4800W);
|
|
|
- }
|
|
|
/*定制三色光源*/
|
|
|
#if LAMP_EN == 1
|
|
|
if(device_status.sunBar%3!=0)
|
|
|
@@ -1919,6 +1926,8 @@ 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("PowerType:%d",device_status.Power_Type);
|
|
|
+ LOG_I("deviceId:%s",device_status.deviceId);
|
|
|
}
|
|
|
//RTC时间判断,如果当前年份小于2020,提示需要设置时间,切换为光控
|
|
|
if(device_status.update_flag==1)
|
|
|
@@ -2005,7 +2014,8 @@ void ResetParamDefault(void)
|
|
|
device_status.collecting_eh1 = 10;
|
|
|
device_status.collecting_sh2 = 14;
|
|
|
device_status.collecting_eh2 = 16;
|
|
|
-
|
|
|
+ device_status.Power_Type = 1;
|
|
|
+ ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
|
|
|
if(device_status.dtype==3)
|
|
|
{
|
|
|
device_status.clt_time = 10; //收集时间
|
|
|
@@ -2083,6 +2093,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));
|