|
@@ -168,7 +168,7 @@ static void Hmi_thread_entry(void *parameter)
|
|
|
rx_buffer[rx_length] = '\0';
|
|
rx_buffer[rx_length] = '\0';
|
|
|
//LOG_I("%s",rx_buffer);
|
|
//LOG_I("%s",rx_buffer);
|
|
|
//\r 对应的hex为0x0d,0x0a,占两个字节,屏幕发送的数据都以\r结尾
|
|
//\r 对应的hex为0x0d,0x0a,占两个字节,屏幕发送的数据都以\r结尾
|
|
|
- HMI_Decode();
|
|
|
|
|
|
|
+ //HMI_Decode();
|
|
|
}
|
|
}
|
|
|
/*********************************************************************************************************************/
|
|
/*********************************************************************************************************************/
|
|
|
//rt_kprintf("%04d-%02d-%02d %02d:%02d:%02d\n",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
//rt_kprintf("%04d-%02d-%02d %02d:%02d:%02d\n",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
@@ -197,965 +197,6 @@ void Start_timer_Uart2(void)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-/***************************** 解析从屏幕收到的数据 begin **********************************/
|
|
|
|
|
-static void HMI_Decode(void)
|
|
|
|
|
-{
|
|
|
|
|
- time_t now = time(RT_NULL);
|
|
|
|
|
- static struct tm tm;
|
|
|
|
|
- gmtime_r(&now, &tm);
|
|
|
|
|
- char *json_temp;
|
|
|
|
|
- char *var=NULL;
|
|
|
|
|
- rt_free(var);
|
|
|
|
|
- if(device_status.refresh_num==0) device_status.refresh_num = 10;
|
|
|
|
|
- if(strstr(rx_buffer,"getFullData") != NULL){
|
|
|
|
|
- char *readinfo = makeJson_ReadInfo();
|
|
|
|
|
- if(device_status.refresh_num==5)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.refresh_num = 15;
|
|
|
|
|
- DTU_Write("%s",readinfo);
|
|
|
|
|
- //list_mem();
|
|
|
|
|
- device_status.hmi_fresh = 1;
|
|
|
|
|
- rt_thread_delay(100);
|
|
|
|
|
- }
|
|
|
|
|
- //在解析getinfo中清除超时
|
|
|
|
|
- if(device_status.refresh_timeout==30)
|
|
|
|
|
- {
|
|
|
|
|
- rt_sprintf(device_status.sim,"1");
|
|
|
|
|
- rt_sprintf(device_status.net,"1");
|
|
|
|
|
- rt_sprintf(device_status.csq,"0");
|
|
|
|
|
- device_status.camsta = 1;
|
|
|
|
|
- device_status.link_sta=0;
|
|
|
|
|
- device_status.refresh_timeout=0;
|
|
|
|
|
- }
|
|
|
|
|
- rt_free(readinfo);
|
|
|
|
|
- device_status.refresh_num--;
|
|
|
|
|
- device_status.refresh_timeout++;
|
|
|
|
|
- if(device_status.version_type!=6)
|
|
|
|
|
- {
|
|
|
|
|
- HMI_WRITE("uploadSet.iccid.txt=\"%s\"",device_status.iccid);
|
|
|
|
|
- if(strstr(device_status.mqttcfg1,"8.136.98.49")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- HMI_WRITE("uploadSet.plt.val=%d",RESET);
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(device_status.mqttcfg1,"120.27.222.26")!=NULL) {
|
|
|
|
|
- HMI_WRITE("uploadSet.plt.val=%d",SET);
|
|
|
|
|
- }
|
|
|
|
|
- //HMI_WRITE("mqttcfg.mqtt1Message.txt=\"%s\"",device_status.mqttcfg1);
|
|
|
|
|
- HMI_WRITE("uploadSet.t0.txt=\"%s\"",device_status.mqttcfg1);
|
|
|
|
|
-
|
|
|
|
|
- //更新固件版本号
|
|
|
|
|
- HMI_WRITE("debug.t3.txt=\"%s\"",device_status.driver);
|
|
|
|
|
- //更新固件编译日期
|
|
|
|
|
- HMI_WRITE("debug.t4.txt=\"%s\"",device_status.driver_compile);
|
|
|
|
|
- //
|
|
|
|
|
- HMI_WRITE("debug.t5.txt=\"%s\"",device_status.driver_bl);
|
|
|
|
|
- HMI_WRITE("debug.t7.txt=\"%s\"",device_status.driver_compile);
|
|
|
|
|
- //更新dtu/rtu版本
|
|
|
|
|
- HMI_WRITE("debug.t9.txt=\"%s\"",device_status.driver_4g);
|
|
|
|
|
- //更新时间
|
|
|
|
|
- HMI_WRITE("menu.rtc.txt=\"%04d-%02d-%02d %02d:%02d:%02d\"",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
|
|
|
- HMI_WRITE("workSta.rtc.txt=\"%04d-%02d-%02d %02d:%02d:%02d\"",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
|
|
|
- HMI_WRITE("set.t0.txt=\"%d\"",tm.tm_hour);
|
|
|
|
|
- HMI_WRITE("set.t1.txt=\"%d\"",tm.tm_min);
|
|
|
|
|
- HMI_WRITE("set.t2.txt=\"%d\"",tm.tm_sec);
|
|
|
|
|
- //更新电压
|
|
|
|
|
- HMI_WRITE("workSta.vbat.txt=\"%s\"",device_status.voltage);
|
|
|
|
|
- //更新电流
|
|
|
|
|
- HMI_WRITE("workSta.power.txt=\"%s\"",device_status.power);
|
|
|
|
|
-
|
|
|
|
|
- //更新温湿度数据
|
|
|
|
|
- HMI_WRITE("workSta.envHum.val=%d",atoi(device_status.humidity));
|
|
|
|
|
- HMI_WRITE("workSta.envTem.val=%d",atoi(device_status.tempture));
|
|
|
|
|
- //更新电池状态
|
|
|
|
|
- HMI_WRITE("workSta.batStatus.val=%d",device_status.bat_status);
|
|
|
|
|
- //更新上仓门状态
|
|
|
|
|
- HMI_WRITE("workSta.upStatus.val=%d",device_status.up_status);
|
|
|
|
|
- //更新下仓门状态
|
|
|
|
|
- HMI_WRITE("workSta.downStatus.val=%d",device_status.down_status);
|
|
|
|
|
- //更新工作状态
|
|
|
|
|
- HMI_WRITE("workSta.workStatus.val=%d",device_status.work_status);
|
|
|
|
|
- //更新温控状态
|
|
|
|
|
- HMI_WRITE("workSta.tempStatus.val=%d",device_status.temp_status);
|
|
|
|
|
- //更新雨控状态
|
|
|
|
|
- HMI_WRITE("workSta.rainStatus.val=%d",device_status.rain_status);
|
|
|
|
|
- //更新光控状态
|
|
|
|
|
- HMI_WRITE("workSta.sunStatus.val=%d",device_status.sun_status);
|
|
|
|
|
- //更新有线连接状态
|
|
|
|
|
- HMI_WRITE("menu.va_net.val=%d",device_status.link_sta);
|
|
|
|
|
- //更新CSQ
|
|
|
|
|
- HMI_WRITE("menu.csq_value.txt=\"%s\"",device_status.csq);
|
|
|
|
|
- HMI_WRITE("menu.va_csq.val=%d",atoi(device_status.csq));
|
|
|
|
|
- HMI_WRITE("workSta.csq_value.txt=\"%s\"",device_status.csq);
|
|
|
|
|
- //更新收集时间
|
|
|
|
|
- HMI_WRITE("sysSet.stime.val=%d",device_status.clt_time);
|
|
|
|
|
- //更新加热时间
|
|
|
|
|
- HMI_WRITE("workSta.heatTime.val=%d",device_status.heattime);
|
|
|
|
|
- HMI_WRITE("sysSet.jtime.val=%d",device_status.heattime);
|
|
|
|
|
- //
|
|
|
|
|
- HMI_WRITE("sysSet.vol.val=%d",device_status.vol);
|
|
|
|
|
- //更新加热时间和温度
|
|
|
|
|
- HMI_WRITE("workSta.heatTem.val=%d",device_status.heattem);
|
|
|
|
|
- HMI_WRITE("sysSet.jheat.val=%d",device_status.heatvalue);
|
|
|
|
|
- //更新加热状态
|
|
|
|
|
- HMI_WRITE("workSta.heatStatus.val=%d",device_status.heat_status);
|
|
|
|
|
-
|
|
|
|
|
- //更新密码
|
|
|
|
|
- HMI_WRITE("inputPasswd.pwdData.txt=\"8888\"");
|
|
|
|
|
- //更新时间设置中的参数
|
|
|
|
|
- //更新定时模式
|
|
|
|
|
- HMI_WRITE("clockSet.timeSwitch.val=%d",device_status.timeSwitch);
|
|
|
|
|
- //更新光控定时时长
|
|
|
|
|
- HMI_WRITE("clockSet.sunBar.val=%d",device_status.sunBar);
|
|
|
|
|
- //更新时控开始
|
|
|
|
|
- HMI_WRITE("clockSet.startBar.val=%d",device_status.startBar);
|
|
|
|
|
- //更新时控结束
|
|
|
|
|
- HMI_WRITE("clockSet.stopBar.val=%d",device_status.stopBar);
|
|
|
|
|
- //SIM卡状态
|
|
|
|
|
- HMI_WRITE("workSta.bt0.val=%d",atoi(device_status.sim));
|
|
|
|
|
- //ID
|
|
|
|
|
- HMI_WRITE("menu.equipid.txt=\"%s\"",device_status.imei);
|
|
|
|
|
- //HMI_WRITE("workSta.equipid.txt=\"%s\"",device_status.imei);
|
|
|
|
|
- //数据上传间隔
|
|
|
|
|
- HMI_WRITE("uploadSet.datt.val=%d",device_status.dattim);
|
|
|
|
|
- //语音音量
|
|
|
|
|
- HMI_WRITE("sysSet.vol.val=%d",device_status.vol);
|
|
|
|
|
- //更新熄屏时间
|
|
|
|
|
- if(device_status.thsp<60) device_status.thsp = device_status.thsp * 60;
|
|
|
|
|
- HMI_WRITE("thsp=%d",device_status.thsp);
|
|
|
|
|
- }
|
|
|
|
|
- HMI_WRITE("menu.cam_sta.val=%d",device_status.camsta);
|
|
|
|
|
-
|
|
|
|
|
- #if BOOT_ERR == 1
|
|
|
|
|
- if(atoi(device_status.gps)==1){
|
|
|
|
|
- HMI_WRITE("menu.gps_state.txt=\"定位成功:(%s)%d/%d\"",device_status.gps_state,device_status.gps_inuse,device_status.gps_view);
|
|
|
|
|
- }else if(atoi(device_status.gps)==2){
|
|
|
|
|
- HMI_WRITE("menu.gps_state.txt=\"定位成功:(基站)\"");
|
|
|
|
|
- }
|
|
|
|
|
- #endif
|
|
|
|
|
-
|
|
|
|
|
- //更新联网状态
|
|
|
|
|
- if(atoi(device_status.net)==1)
|
|
|
|
|
- {
|
|
|
|
|
- HMI_WRITE("menu.net.val=1");
|
|
|
|
|
- HMI_WRITE("workSta.net.val=1");
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- HMI_WRITE("workSta.net.val=0");
|
|
|
|
|
- HMI_WRITE("menu.net.val=0");
|
|
|
|
|
- }
|
|
|
|
|
- if(atoi(device_status.csq)==0&&atoi(device_status.net)==1)
|
|
|
|
|
- {
|
|
|
|
|
- HMI_WRITE("menu.net.val=1");
|
|
|
|
|
- HMI_WRITE("workSta.net.val=2");
|
|
|
|
|
- }
|
|
|
|
|
- if(device_status.dtype==7)
|
|
|
|
|
- {
|
|
|
|
|
- //更新温湿度数据
|
|
|
|
|
- HMI_WRITE("workSta.env_hum.txt=\"%s\"",device_status.humidity);
|
|
|
|
|
- HMI_WRITE("workSta.env_tem.txt=\"%s\"",device_status.tempture);
|
|
|
|
|
- HMI_WRITE("workSta.on_off.val=%d",device_status.ds);
|
|
|
|
|
- HMI_WRITE("workSta.work_sta.val=%d",device_status.work_status);
|
|
|
|
|
- HMI_WRITE("workSta.collect_fan.val=%d",device_status.collect_fan_status);
|
|
|
|
|
- //更新电池状态
|
|
|
|
|
- HMI_WRITE("workSta.bat_sta.val=%d",device_status.bat_status);
|
|
|
|
|
- //更新散热风机状态
|
|
|
|
|
- HMI_WRITE("workSta.cool_fan.val=%d",device_status.cool_fan_status);
|
|
|
|
|
- //更新开关状态
|
|
|
|
|
- HMI_WRITE("workSta.on_off.val=%d",device_status.ds);
|
|
|
|
|
- //更新工作状态
|
|
|
|
|
- HMI_WRITE("workSta.work_sta.val=%d",device_status.work_status);
|
|
|
|
|
- //箱内温度-外壳
|
|
|
|
|
- HMI_WRITE("workSta.box_tmp.txt=\"%d\"",device_status.box_temp);
|
|
|
|
|
- HMI_WRITE("temHum.box_tmp.txt=\"%d\"",device_status.box_temp);
|
|
|
|
|
- //制冷开关
|
|
|
|
|
- HMI_WRITE("workSta.cold_sw.val=%d",device_status.cold_sw);
|
|
|
|
|
- HMI_WRITE("sysSet.cold_sw.val=%d",device_status.cold_sw);
|
|
|
|
|
- //制冷状态
|
|
|
|
|
- HMI_WRITE("workSta.cold_sta.val=%d",device_status.cold_status);
|
|
|
|
|
- HMI_WRITE("sysSet.cold_sw.val=%d",device_status.cold_sw);
|
|
|
|
|
- //培养温度
|
|
|
|
|
- HMI_WRITE("workSta.set_temp.val=%d",device_status.heatvalue);
|
|
|
|
|
- HMI_WRITE("sysSet.keep.val=%d",device_status.heatvalue);
|
|
|
|
|
- //数据上传间隔
|
|
|
|
|
- HMI_WRITE("sysSet.datt.val=%d",device_status.dattim);
|
|
|
|
|
- HMI_WRITE("sysSet.lcd_time.val=%d",device_status.thsp*60);
|
|
|
|
|
- //当前温度-培养仓
|
|
|
|
|
- HMI_WRITE("workSta.pre_temp.val=%d",device_status.pre_temp);
|
|
|
|
|
- //设定培养时间
|
|
|
|
|
- HMI_WRITE("workSta.cul_time.val=%d",device_status.cul_time);
|
|
|
|
|
- HMI_WRITE("clockSet.stay.val=%d",device_status.cul_time);
|
|
|
|
|
- //已培养时间
|
|
|
|
|
- if(device_status.develop_flag==0)
|
|
|
|
|
- HMI_WRITE("workSta.staytime.txt=\"0\"");
|
|
|
|
|
- //滴液时间
|
|
|
|
|
- HMI_WRITE("clockSet.drop.val=%d",device_status.shake_sec);
|
|
|
|
|
- //采集开始时间1
|
|
|
|
|
- HMI_WRITE("clockSet.start1.val=%d",device_status.collecting_sh1);
|
|
|
|
|
- //采集开始时间2
|
|
|
|
|
- HMI_WRITE("clockSet.start2.val=%d",device_status.collecting_sh2);
|
|
|
|
|
- //采集结束时间1
|
|
|
|
|
- HMI_WRITE("clockSet.end1.val=%d",device_status.collecting_eh1);
|
|
|
|
|
- //采集结束时间2
|
|
|
|
|
- HMI_WRITE("clockSet.end2.val=%d",device_status.collecting_eh2);
|
|
|
|
|
- if(device_status.autotakepic==0) HMI_WRITE("sysTest.auto_flag.txt=\"\"");
|
|
|
|
|
- }
|
|
|
|
|
- /**********************************吸虫塔*********************************/
|
|
|
|
|
- if(device_status.version_type==6)
|
|
|
|
|
- {
|
|
|
|
|
- HMI_WRITE("menu.equipid.txt=\"%s\"",device_status.imei);
|
|
|
|
|
- //更新电压
|
|
|
|
|
- HMI_WRITE("menu.vbat.txt=\"%sV\"",device_status.voltage);
|
|
|
|
|
- //工作状态
|
|
|
|
|
- HMI_WRITE("menu.worksta.val=%d",device_status.work_status);
|
|
|
|
|
- //网卡0状态
|
|
|
|
|
- HMI_WRITE("menu.eth0_sta.val=%d",device_status.link_sta);
|
|
|
|
|
- //更新电流
|
|
|
|
|
- HMI_WRITE("menu.power.txt=\"%smA\"",device_status.power);
|
|
|
|
|
- //更新温湿度数据
|
|
|
|
|
- HMI_WRITE("menu.envHum.txt=\"%s%RH\"",device_status.humidity);
|
|
|
|
|
- HMI_WRITE("menu.envTem.txt=\"%s℃\"",device_status.tempture);
|
|
|
|
|
- HMI_WRITE("uploadSet.st.val=%d",device_status.startBar);
|
|
|
|
|
- HMI_WRITE("uploadSet.et.val=%d",device_status.stopBar);
|
|
|
|
|
- HMI_WRITE("menu.board_temp.txt=\"%d.%d℃\"",Get_Temprate()/100,Get_Temprate()%100);
|
|
|
|
|
- //数据上传间隔
|
|
|
|
|
- HMI_WRITE("menu.datt.val=%d",device_status.dattim);
|
|
|
|
|
- //SIM卡状态
|
|
|
|
|
- HMI_WRITE("menu.bt0.val=%d",atoi(device_status.sim));
|
|
|
|
|
- //更新震动时间
|
|
|
|
|
- HMI_WRITE("menu.shake_sec.val=%d",device_status.shake_sec);
|
|
|
|
|
- //校准屏幕的RTC
|
|
|
|
|
- HMI_WRITE("rtc0=%d",tm.tm_year+1900);
|
|
|
|
|
- HMI_WRITE("rtc1=%d",tm.tm_mon+1);
|
|
|
|
|
- HMI_WRITE("rtc2=%d",tm.tm_mday);
|
|
|
|
|
- HMI_WRITE("rtc3=%d",tm.tm_hour);
|
|
|
|
|
- HMI_WRITE("rtc4=%d",tm.tm_min);
|
|
|
|
|
- HMI_WRITE("rtc5=%d",tm.tm_sec);
|
|
|
|
|
-
|
|
|
|
|
- //更新熄屏时间
|
|
|
|
|
- HMI_WRITE("thsp=%d",device_status.thsp);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**********************************************************************/
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"getClockData")!=NULL) {
|
|
|
|
|
- //更新定时模式
|
|
|
|
|
- HMI_WRITE("clockSet.timeSwitch.val=%d",device_status.timeSwitch);
|
|
|
|
|
- //更新光控定时时长
|
|
|
|
|
- HMI_WRITE("clockSet.sunBar.val=%d",device_status.sunBar);
|
|
|
|
|
- //更新时控开始
|
|
|
|
|
- HMI_WRITE("clockSet.startBar.val=%d",device_status.startBar);
|
|
|
|
|
- //更新时控结束
|
|
|
|
|
- HMI_WRITE("clockSet.stopBar.val=%d",device_status.stopBar);
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"button")!=NULL) {
|
|
|
|
|
- LOG_D("button!");
|
|
|
|
|
- DTU_Write("button");
|
|
|
|
|
- }
|
|
|
|
|
- //拍照
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchPhoto=1")!=NULL) {
|
|
|
|
|
- device_status.photo_ws = 1;
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchPic=1")!=NULL) {
|
|
|
|
|
- device_status.photo_ws = 1;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //打开电磁阀
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchDrop=1")!=NULL) {
|
|
|
|
|
- LOG_I("开始滴液!");
|
|
|
|
|
- #if Color_EN == 1
|
|
|
|
|
- device_status.run_sta = 5;
|
|
|
|
|
- #else
|
|
|
|
|
- ctr_shake(ON, device_status.shake_sec);
|
|
|
|
|
- #endif
|
|
|
|
|
- }
|
|
|
|
|
- //关闭电磁阀
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchDrop=0")!=NULL) {
|
|
|
|
|
- LOG_I("停止滴液!");
|
|
|
|
|
- ctr_shake(OFF, 0);
|
|
|
|
|
- }
|
|
|
|
|
- //打开补光
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchLed=1")!=NULL) {
|
|
|
|
|
- LOG_I("打开补光!!");
|
|
|
|
|
- ctr_led(ON);
|
|
|
|
|
- }
|
|
|
|
|
- //关闭补光
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchLed=0")!=NULL) {
|
|
|
|
|
- LOG_I("关闭补光!!!");
|
|
|
|
|
- ctr_led(OFF);
|
|
|
|
|
- }
|
|
|
|
|
- //关闭加热
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchHeat=0")!=NULL) {
|
|
|
|
|
- device_status.heat_status = 0;
|
|
|
|
|
- ctr_Heat(OFF);
|
|
|
|
|
- LOG_I("Close Heat!");
|
|
|
|
|
- }
|
|
|
|
|
- //打开加热
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchHeat=1")!=NULL) {
|
|
|
|
|
- device_status.heat_status = 1;
|
|
|
|
|
- ctr_Heat(ON);
|
|
|
|
|
- LOG_I("Open Heat!");
|
|
|
|
|
- }
|
|
|
|
|
- //打开制冷
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchCold=1")!=NULL) {
|
|
|
|
|
- ctr_Cold(ON);
|
|
|
|
|
- LOG_I("Open Cold!");
|
|
|
|
|
- }
|
|
|
|
|
- //关闭制冷
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchCold=0")!=NULL) {
|
|
|
|
|
- ctr_Cold(OFF);
|
|
|
|
|
- LOG_I("Close Cold!");
|
|
|
|
|
- }
|
|
|
|
|
- //打开采集
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchCollect=1")!=NULL){
|
|
|
|
|
- ctr_Collect_Fan(ON);
|
|
|
|
|
- LOG_I("采集风机已打开!");
|
|
|
|
|
- }
|
|
|
|
|
- //关闭采集
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchCollect=0")!=NULL){
|
|
|
|
|
- ctr_Collect_Fan(OFF);
|
|
|
|
|
- LOG_I("采集风机已关闭!");
|
|
|
|
|
- }
|
|
|
|
|
- //打开散热
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchCool=1")!=NULL){
|
|
|
|
|
- ctr_Cool_Fan(ON);
|
|
|
|
|
- LOG_I("散热风机已打开!");
|
|
|
|
|
- }
|
|
|
|
|
- //关闭散热
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchCool=0")!=NULL){
|
|
|
|
|
- ctr_Cool_Fan(OFF);
|
|
|
|
|
- LOG_I("散热风机已关闭!");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //开始对焦拍照
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchAutopic=1")!=NULL){
|
|
|
|
|
- device_status.autotakepic=1;
|
|
|
|
|
- rt_kprintf("开始对焦拍照!\n");
|
|
|
|
|
- }
|
|
|
|
|
- //停止对焦拍照
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchAutopic=0")!=NULL){
|
|
|
|
|
- device_status.autotakepic=0;
|
|
|
|
|
- }
|
|
|
|
|
- //粘附测试-开
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchFsl=1")!=NULL){
|
|
|
|
|
- rt_kprintf("粘附测试开!\n");
|
|
|
|
|
- device_status.fsl_sw = 1;
|
|
|
|
|
- }
|
|
|
|
|
- //粘附测试-关
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchFsl=0")!=NULL){
|
|
|
|
|
- rt_kprintf("粘附测试关!\n");
|
|
|
|
|
- pwm_off(2, 0);
|
|
|
|
|
- pwm_off(3,0);
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchAutotest=1")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- LOG_I("开始一键测试!!!");
|
|
|
|
|
- device_status.auto_test_sw=1;
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchAutotest=1")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- LOG_I("停止一键测试!!!");
|
|
|
|
|
- device_status.auto_test_sw=0;
|
|
|
|
|
- }
|
|
|
|
|
- //震动
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchShake=1")!=NULL) {
|
|
|
|
|
- LOG_I("震动!");
|
|
|
|
|
- if(device_status.version_type==6)
|
|
|
|
|
- {
|
|
|
|
|
- Motor_shake(ON, device_status.shake_sec);
|
|
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
- ctr_shake(ON,device_status.shake_sec);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- //打开补光
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchFill=1")!=NULL) {
|
|
|
|
|
- rt_kprintf("\n打开补光!!!\n");
|
|
|
|
|
- ctr_led(ON);
|
|
|
|
|
- }
|
|
|
|
|
- //关闭补光
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchFill=0")!=NULL) {
|
|
|
|
|
- rt_kprintf("\n关闭补光!!!\n");
|
|
|
|
|
- ctr_led(OFF);
|
|
|
|
|
- }
|
|
|
|
|
- //打开灯管
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchLamp=1")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.test_flag=1;
|
|
|
|
|
- rt_kprintf("Open Lamp!\n");
|
|
|
|
|
- ctr_lamp(ON,1);
|
|
|
|
|
- #if LAMP_EN == 1
|
|
|
|
|
- ctr_lamp(ON,2);
|
|
|
|
|
- ctr_lamp(ON,3);
|
|
|
|
|
- #endif
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //关闭灯管
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchLamp=0")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.test_flag=0;
|
|
|
|
|
- rt_kprintf("Close Lamp1!\n");
|
|
|
|
|
- ctr_lamp(OFF,1);
|
|
|
|
|
- #if LAMP_EN == 1
|
|
|
|
|
- ctr_lamp(OFF,2);
|
|
|
|
|
- ctr_lamp(OFF,3);
|
|
|
|
|
- #endif
|
|
|
|
|
- }
|
|
|
|
|
- //关闭加热
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchHeat=0")!=NULL) {
|
|
|
|
|
- device_status.heat_status = 0;
|
|
|
|
|
- ctr_Heat(OFF);
|
|
|
|
|
- rt_kprintf("Close Heat!\n");
|
|
|
|
|
- }
|
|
|
|
|
- //打开加热
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchHeat=1")!=NULL) {
|
|
|
|
|
- device_status.heat_status = 1;
|
|
|
|
|
- ctr_Heat(ON);
|
|
|
|
|
- rt_kprintf("Open Heat!\n");
|
|
|
|
|
- }
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.Testpaichong")!=NULL){
|
|
|
|
|
- if(device_status.collt_box_sta==0){
|
|
|
|
|
- device_status.collt_box_sta = 111;
|
|
|
|
|
- }else{
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"请等待当前执行完成再进行操作\"");
|
|
|
|
|
- }
|
|
|
|
|
- LOG_I("排虫测试!");
|
|
|
|
|
- }
|
|
|
|
|
- //排虫
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.paichong")!=NULL){
|
|
|
|
|
- if(device_status.run_sta == 0){
|
|
|
|
|
- device_status.run_sta = 111;
|
|
|
|
|
- }else{
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"请等待当前执行完成再进行操作\"");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- LOG_I("开始排虫!");
|
|
|
|
|
- device_status.handle_bugger = 0;
|
|
|
|
|
- ef_set_env_blob("handle_bugger", &device_status.handle_bugger, sizeof(device_status.handle_bugger));
|
|
|
|
|
- }
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.shouchong")!=NULL){
|
|
|
|
|
- if(device_status.run_sta == 0){
|
|
|
|
|
- device_status.run_sta = 112;
|
|
|
|
|
- }else{
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"请等待当前执行完成再进行操作\"");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- LOG_I("开始收虫!");
|
|
|
|
|
- device_status.handle_bugger = 1;
|
|
|
|
|
- ef_set_env_blob("handle_bugger", &device_status.handle_bugger, sizeof(device_status.handle_bugger));
|
|
|
|
|
- }
|
|
|
|
|
- //设置设备时间
|
|
|
|
|
- else if (strstr(rx_buffer,"stamp=")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- var = strstr(rx_buffer,"=");
|
|
|
|
|
- var ++;
|
|
|
|
|
- LOG_I("设置时间:%s",var);
|
|
|
|
|
- static char year_s[5],month_s[3],day_s[3],hour_s[3],min_s[3],sec_s[3];
|
|
|
|
|
- strncpy(year_s, var, 4);
|
|
|
|
|
- strncpy(month_s,var+4,2);
|
|
|
|
|
- strncpy(day_s,var+6,2);
|
|
|
|
|
- strncpy(hour_s,var+8,2);
|
|
|
|
|
- strncpy(min_s,var+10,2);
|
|
|
|
|
- strncpy(sec_s,var+12,2);
|
|
|
|
|
- if(atoi(year_s)>=2024&&atoi(year_s)<3000&&atoi(month_s)>0&&atoi(month_s)<13&&atoi(day_s)>0&&atoi(day_s)<32)
|
|
|
|
|
- {
|
|
|
|
|
- if(set_date(atoi(year_s),atoi(month_s),atoi(day_s))==RT_EOK)
|
|
|
|
|
- {
|
|
|
|
|
- LOG_I("设置日期:%d年%d月%d日",atoi(year_s),atoi(month_s),atoi(day_s));
|
|
|
|
|
- if(atoi(hour_s)>0&&atoi(hour_s)<=24&&atoi(min_s)>=0&&atoi(min_s)<=59&&atoi(sec_s)>=0&&atoi(sec_s)<=59)
|
|
|
|
|
- {
|
|
|
|
|
- LOG_I("设置时间:%d时%d分%d秒",atoi(hour_s),atoi(min_s),atoi(sec_s));
|
|
|
|
|
- set_time(atoi(hour_s),atoi(min_s),atoi(sec_s));
|
|
|
|
|
- MA_save();
|
|
|
|
|
- }
|
|
|
|
|
- //上传最新数据
|
|
|
|
|
- device_status.num_updata = 2; //2秒后上报数据更新RTU的时间
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("set_date failed!");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- //定时设置
|
|
|
|
|
- else if (strstr(rx_buffer,"saveClockSet=")!=NULL) {
|
|
|
|
|
- char value_str[10];
|
|
|
|
|
- memset(value_str,0,sizeof(value_str));
|
|
|
|
|
- if(device_status.dtype==7)
|
|
|
|
|
- {
|
|
|
|
|
- var = strstr(rx_buffer,"=");
|
|
|
|
|
- var ++;
|
|
|
|
|
- strncpy(value_str,var,2);
|
|
|
|
|
- if(atoi(value_str)>=0&&atoi(value_str)<=23)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.collecting_sh1 = atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("collecting_sh1", &device_status.collecting_sh1, sizeof(device_status.collecting_sh1));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("Set collecting_sh1 Failed!");
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_str,0,sizeof(value_str));
|
|
|
|
|
- strncpy(value_str,var+2,2);
|
|
|
|
|
- if(atoi(value_str)>=0&&atoi(value_str)<=23)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.collecting_eh1 = atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("collecting_eh1", &device_status.collecting_eh1, sizeof(device_status.collecting_eh1));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("Set collecting_eh1 Failed!");
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_str,0,sizeof(value_str));
|
|
|
|
|
- strncpy(value_str,var+4,2);
|
|
|
|
|
- if(atoi(value_str)>=0&&atoi(value_str)<=23)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.collecting_sh2 = atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("collecting_sh2", &device_status.collecting_sh2, sizeof(device_status.collecting_sh2));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("Set collecting_sh2 Failed!");
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_str,0,sizeof(value_str));
|
|
|
|
|
- strncpy(value_str,var+6,2);
|
|
|
|
|
- if(atoi(value_str)>=0&&atoi(value_str)<=23)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.collecting_eh2 = atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("collecting_eh2", &device_status.collecting_eh2, sizeof(device_status.collecting_eh2));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("Set collecting_eh2 Failed!");
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_str,0,sizeof(value_str));
|
|
|
|
|
- strncpy(value_str,var+8,2);
|
|
|
|
|
- if(atoi(value_str)>=0&&atoi(value_str)<=23)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.shake_sec = atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("shake_sec", &device_status.shake_sec, sizeof(device_status.shake_sec));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("Set shake_sec Failed!");
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_str,0,sizeof(value_str));
|
|
|
|
|
- strncpy(value_str,var+10,2);
|
|
|
|
|
- if(atoi(value_str)>0&&atoi(value_str)<=24)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.cul_time = atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("cul_time", &device_status.cul_time, sizeof(device_status.cul_time));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("Set cul_time Failed!");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- MA_save();
|
|
|
|
|
- LOG_I("参数已保存:%d-%d-%d-%d-%d-%d",device_status.collecting_sh1,device_status.collecting_eh1,device_status.collecting_sh2,device_status.collecting_eh2,device_status.shake_sec,device_status.cul_time);
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- LOG_I("时间设置!");
|
|
|
|
|
- var=strstr(rx_buffer,"=");
|
|
|
|
|
- var++;
|
|
|
|
|
- strncpy(value_str,var,2);
|
|
|
|
|
- if(atoi(value_str) > 0 && atoi(value_str) <60)
|
|
|
|
|
- {
|
|
|
|
|
- if(device_status.version_type!=6)
|
|
|
|
|
- {
|
|
|
|
|
- #if LAMP_EN == 1
|
|
|
|
|
- if(device_status.sunBar%3==0)
|
|
|
|
|
- #endif
|
|
|
|
|
- device_status.sunBar=atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("sunBar", &device_status.sunBar, sizeof(device_status.sunBar));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- device_status.shake_sec = atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("shake_sec", &device_status.shake_sec, sizeof(device_status.shake_sec));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-// time_t now;
|
|
|
|
|
-// time(&now);
|
|
|
|
|
-// static struct tm nowstamp;
|
|
|
|
|
-// nowstamp =*localtime(&now);
|
|
|
|
|
-// nowstamp.tm_hour = nowstamp.tm_hour - 8;
|
|
|
|
|
-// static rt_uint32_t nowstamp_num = 0;
|
|
|
|
|
-// nowstamp_num = mktime(&nowstamp);
|
|
|
|
|
-// device_status.light_over_tim = device_status.sunBar * 3600 + nowstamp_num;
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("参数设置异常(光控时长):%d!!!",atoi(value_str));
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_str,0,sizeof(value_str));
|
|
|
|
|
- //时控开始时间
|
|
|
|
|
- strncpy(value_str,var+2,2);
|
|
|
|
|
- if(atoi(value_str) >= 0 && atoi(value_str) < 24)
|
|
|
|
|
- {
|
|
|
|
|
- #if 1
|
|
|
|
|
- device_status.startBar=atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("startBar", &device_status.startBar, sizeof(device_status.startBar));
|
|
|
|
|
- #endif
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("参数设置异常(开始):%d!!!",atoi(value_str));
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_str,0,sizeof(value_str));
|
|
|
|
|
- //
|
|
|
|
|
- strncpy(value_str,var+4,2);
|
|
|
|
|
- if(atoi(value_str) >= 0&& atoi(value_str) < 24)
|
|
|
|
|
- {
|
|
|
|
|
- #if 1
|
|
|
|
|
- device_status.stopBar=atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("stopBar", &device_status.stopBar, sizeof(device_status.stopBar));
|
|
|
|
|
- #endif
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("参数设置异常(结束):%d!!!",atoi(value_str));
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_str,0,sizeof(value_str));
|
|
|
|
|
- //
|
|
|
|
|
- strncpy(value_str,var+6,2);
|
|
|
|
|
- if(atoi(value_str) >= 0 && atoi(value_str) <= 1)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.timeSwitch=atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("timeSwitch", &device_status.timeSwitch, sizeof(device_status.timeSwitch));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- if(device_status.version_type==6)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.timeSwitch=1;
|
|
|
|
|
- device_status.dattim=atoi(value_str);
|
|
|
|
|
- ef_set_env_blob("dattim", &device_status.dattim, sizeof(device_status.dattim));
|
|
|
|
|
- ef_set_env_blob("timeSwitch", &device_status.timeSwitch, sizeof(device_status.timeSwitch));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("参数设置异常(模式):%d!!!",atoi(value_str));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- //2022/06/23,add:
|
|
|
|
|
- rt_sprintf(device_status.json_w_clock,"屏幕操作:修改工作时间:开始-%d,结束-%d,模式-%d(0-光控,1-时控)操作时间:%s",device_status.startBar,device_status.stopBar,device_status.timeSwitch,device_status.stamp);
|
|
|
|
|
- json_temp = makeJson_Warn(device_status.json_w_clock, "修改工作时间");
|
|
|
|
|
- ef_set_env_blob("json_w_clock", &device_status.json_w_clock, sizeof(device_status.json_w_clock)); //将修改屏幕参数操作记录保存到Flash中
|
|
|
|
|
- if(atoi(device_status.net)==0)
|
|
|
|
|
- DTU_Write("%s",json_temp);
|
|
|
|
|
- rt_free(json_temp);
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- MA_save();
|
|
|
|
|
- rt_free(var);
|
|
|
|
|
- rt_kprintf("工作时间参数已保存:模式-%d,光控时间-%d,时控开始时间-%d,时控结束时间-%d\n",device_status.timeSwitch,device_status.sunBar,device_status.startBar,device_status.stopBar);
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"saveSystemSet")!=NULL) {
|
|
|
|
|
- static char clt_time_str[3],heattime_str[3],heatvale_str[4],vol_str[4],thsp_str[5];
|
|
|
|
|
- static char value_temp[5];
|
|
|
|
|
- LOG_I("系统设置!");
|
|
|
|
|
- if(device_status.dtype==7)
|
|
|
|
|
- {
|
|
|
|
|
- LOG_I("系统设置,孢子仪!");
|
|
|
|
|
- var = strstr(rx_buffer,"=");
|
|
|
|
|
- var ++;
|
|
|
|
|
- memset(value_temp,0,sizeof(value_temp));
|
|
|
|
|
- strncpy(value_temp,var,2);
|
|
|
|
|
- if(atoi(value_temp)==0 || atoi(value_temp) == 1)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.cold_sw = atoi(value_temp); //制冷开关
|
|
|
|
|
- ef_set_env_blob("cold_sw", &device_status.cold_sw, sizeof(device_status.cold_sw));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("制冷开关参数设置错误!");
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_temp,0,sizeof(value_temp));
|
|
|
|
|
- strncpy(value_temp,var+2,2);
|
|
|
|
|
- if(atoi(value_temp)>=0 && atoi(value_temp) <= 7)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.vol = atoi(value_temp); //音量
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("音量参数设置错误!");
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_temp,0,sizeof(value_temp));
|
|
|
|
|
- strncpy(value_temp,var+4,2);
|
|
|
|
|
- if(atoi(value_temp)>=10 && atoi(value_temp) <= 50)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.heatvalue = atoi(value_temp); //设定的培养温度
|
|
|
|
|
- ef_set_env_blob("heatvalue", &device_status.heatvalue, sizeof(device_status.heatvalue));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("培养温度参数设置失败!");
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_temp,0,sizeof(value_temp));
|
|
|
|
|
- strncpy(value_temp,var+6,2);
|
|
|
|
|
- if(atoi(value_temp)>=1 && atoi(value_temp) <= 60)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.dattim = atoi(value_temp); //设定的数据上传间隔,单位:分钟
|
|
|
|
|
- ef_set_env_blob("dattim", &device_status.dattim, sizeof(device_status.dattim));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("数据上传间隔参数设置失败!");
|
|
|
|
|
- }
|
|
|
|
|
- memset(value_temp,0,sizeof(value_temp));
|
|
|
|
|
- strncpy(value_temp,var+8,2);
|
|
|
|
|
- if(atoi(value_temp)>=1 && atoi(value_temp) <= 30)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.thsp = atoi(value_temp); //设定的息屏间隔,单位:分钟
|
|
|
|
|
- ef_set_env_blob("thsp", &device_status.thsp, sizeof(device_status.thsp));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("数据息屏间隔参数设置失败!");
|
|
|
|
|
- }
|
|
|
|
|
- LOG_I("制冷开关:%d",device_status.cold_sw);
|
|
|
|
|
- LOG_I("系统设置已保存:\n自动熄屏-%d\n音量-%d\n培养温度-%d\n数据上传间隔-%d",device_status.thsp,device_status.vol,device_status.heatvalue,device_status.dattim);
|
|
|
|
|
- MA_save();
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- var = strstr(rx_buffer,"=");
|
|
|
|
|
- var ++;
|
|
|
|
|
- strncpy(clt_time_str,var,2);
|
|
|
|
|
- if(atoi(clt_time_str)>0 && atoi(clt_time_str) <= 30)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.clt_time = atoi(clt_time_str); //收集时间
|
|
|
|
|
- ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time));
|
|
|
|
|
- }
|
|
|
|
|
- strncpy(heattime_str,var+2,2);
|
|
|
|
|
- if(atoi(heattime_str)>0 && atoi(heattime_str) <= 30)
|
|
|
|
|
- {
|
|
|
|
|
- rt_kprintf("加热时间:%d\n",atoi(heattime_str));
|
|
|
|
|
- device_status.heattime = atoi(heattime_str); //加热时间
|
|
|
|
|
- ef_set_env_blob("jtime", &device_status.heattime, sizeof(device_status.heattime));
|
|
|
|
|
- }
|
|
|
|
|
- strncpy(heatvale_str,var+4,3);
|
|
|
|
|
- if(atoi(heatvale_str) > 0 && atoi(heatvale_str) <= 130)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.heatvalue=atoi(heatvale_str);
|
|
|
|
|
- ef_set_env_blob("jheat", &device_status.heatvalue, sizeof(device_status.heatvalue));
|
|
|
|
|
- }
|
|
|
|
|
- strncpy(vol_str,var+7,3);
|
|
|
|
|
- if(atoi(vol_str)>0&&atoi(vol_str)<8)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.vol = atoi(vol_str); //音量
|
|
|
|
|
- DTU_Write("volume=");
|
|
|
|
|
- }
|
|
|
|
|
- strncpy(thsp_str,var+10,4);
|
|
|
|
|
- if(atoi(thsp_str)>0&&atoi(thsp_str)<3600)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.thsp = atoi(thsp_str); //熄屏时间
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- rt_kprintf("参数设置失败!!!\n");
|
|
|
|
|
- }
|
|
|
|
|
- rt_thread_delay(1000);
|
|
|
|
|
- MA_save();
|
|
|
|
|
- rt_free(var);
|
|
|
|
|
- rt_kprintf("系统设置已保存:收集时间-%d,加热时间-%d,加热温度-%d,音量-%d,自动关屏-%d\n",device_status.clt_time,device_status.heattime,device_status.heatvalue,device_status.vol,device_status.thsp);
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"rtc_h=")!=NULL) {
|
|
|
|
|
- char rtc_h[2];
|
|
|
|
|
- var = strstr(rx_buffer,"=");
|
|
|
|
|
- var++;
|
|
|
|
|
- strncpy(rtc_h,var,2);
|
|
|
|
|
- if(atoi(rtc_h)>=0 && atoi(rtc_h) <= 24)
|
|
|
|
|
- {
|
|
|
|
|
- set_time(atoi(rtc_h), 99, 99);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"rtc_m=")!=NULL) {
|
|
|
|
|
- char rtc_m[2];
|
|
|
|
|
- var = strstr(rx_buffer,"=");
|
|
|
|
|
- var++;
|
|
|
|
|
- strncpy(rtc_m,var,2);
|
|
|
|
|
- if(atoi(rtc_m)>=0 && atoi(rtc_m) <= 24)
|
|
|
|
|
- {
|
|
|
|
|
- set_time(99, atoi(rtc_m), 99);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"rtc_s=")!=NULL) {
|
|
|
|
|
- char rtc_s[2];
|
|
|
|
|
- var = strstr(rx_buffer,"=");
|
|
|
|
|
- var++;
|
|
|
|
|
- strncpy(rtc_s,var,2);
|
|
|
|
|
- if(atoi(rtc_s)>=0 && atoi(rtc_s) <= 24)
|
|
|
|
|
- {
|
|
|
|
|
- set_time(99, 99, atoi(rtc_s));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if(strstr(rx_buffer,"saveUploadSet=")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- static char dattim_str[3];
|
|
|
|
|
- rt_kprintf("上传间隔设置!\n");
|
|
|
|
|
- var = strstr(rx_buffer,"=");
|
|
|
|
|
- var ++;
|
|
|
|
|
- strncpy(dattim_str,var,2);
|
|
|
|
|
- if(atoi(dattim_str)>=1&&atoi(dattim_str)<=120)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.dattim =atoi(dattim_str); //数据上传间隔
|
|
|
|
|
- ef_set_env_blob("dattim", &device_status.dattim, sizeof(device_status.dattim));
|
|
|
|
|
- MA_save();
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- rt_kprintf("设置失败!!!\n");
|
|
|
|
|
- }
|
|
|
|
|
- rt_free(var);
|
|
|
|
|
- rt_kprintf("数据上传设置:%d\n",device_status.dattim);
|
|
|
|
|
- }
|
|
|
|
|
- //光控测试
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchSun=1")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- rt_kprintf("光控测试!!!");
|
|
|
|
|
- ctr_lamp(ON,1);
|
|
|
|
|
- device_status.sun_test = 1;
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"setshake_sec=")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- static char shakesec_str[4];
|
|
|
|
|
- LOG_I("震动时间设置!");
|
|
|
|
|
- var = strstr(rx_buffer,"=");
|
|
|
|
|
- var ++;
|
|
|
|
|
- strncpy(shakesec_str,var,2);
|
|
|
|
|
- if(atoi(shakesec_str)>=0&&atoi(shakesec_str)<=10)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.shake_sec =atoi(shakesec_str)*10; //
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- LOG_E("设置失败!!!");
|
|
|
|
|
- }
|
|
|
|
|
- rt_free(var);
|
|
|
|
|
- LOG_D("震动时间设置:%d",device_status.shake_sec);
|
|
|
|
|
- }
|
|
|
|
|
- //恢复出厂设置电池
|
|
|
|
|
- else if (strstr(rx_buffer,"resetdcDefault")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- ResetParamDefault_DC();
|
|
|
|
|
- rt_thread_delay(1000);
|
|
|
|
|
- //2022/06/23,add:
|
|
|
|
|
- rt_sprintf(device_status.json_w_reset,"屏幕操作:系统重置:电池供电,操作时间:%04d-%02d-%02d %02d:%02d:%02d",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
|
|
|
- json_temp = makeJson_Warn(device_status.json_w_reset, "系统重置");
|
|
|
|
|
- ef_set_env_blob("json_w_reset", &device_status.json_w_reset, sizeof(device_status.json_w_reset)); //将修改屏幕参数操作记录保存到Flash中
|
|
|
|
|
- if(atoi(device_status.net)==0)
|
|
|
|
|
- DTU_Write("%s",json_temp);
|
|
|
|
|
- rt_free(json_temp);
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- //恢复出厂设置-交流
|
|
|
|
|
- else if (strstr(rx_buffer,"resetDefault")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- ResetParamDefault();
|
|
|
|
|
- rt_thread_delay(1000);
|
|
|
|
|
- //2022/06/23,add:
|
|
|
|
|
- rt_sprintf(device_status.json_w_reset,"屏幕操作:系统重置:交流供电,操作时间:%04d-%02d-%02d %02d:%02d:%02d",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
|
|
|
- json_temp = makeJson_Warn(device_status.json_w_reset, "系统重置");
|
|
|
|
|
- ef_set_env_blob("json_w_reset", &device_status.json_w_reset, sizeof(device_status.json_w_reset)); //将修改屏幕参数操作记录保存到Flash中
|
|
|
|
|
- if(atoi(device_status.net)==0)
|
|
|
|
|
- DTU_Write("%s",json_temp);
|
|
|
|
|
- rt_free(json_temp);
|
|
|
|
|
- }
|
|
|
|
|
- //获取SIM卡信息
|
|
|
|
|
- else if(strstr(rx_buffer,"getSim")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- //http://sim.openluat.com/api/wechat/openapidoc
|
|
|
|
|
- DTU_Write("getsiminfo");
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"DebugEnable")!=NULL) {
|
|
|
|
|
- Debug_log_ON();
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"DebugDisable")!=NULL) {
|
|
|
|
|
- Debug_log_OFF();
|
|
|
|
|
- }
|
|
|
|
|
- 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,"DisplayPower")!=RT_NULL)
|
|
|
|
|
- {
|
|
|
|
|
- HMI_WRITE("sysTest.sysTest_power.txt=\"%s\"",device_status.power);
|
|
|
|
|
- HMI_WRITE("sysTest.heat_txt.txt=\"%s\"",device_status.heat_power);
|
|
|
|
|
-// HMI_WRITE("sysTest.switchHeat.val=%d",device_status.heat_status);
|
|
|
|
|
- }
|
|
|
|
|
- //立即上传
|
|
|
|
|
- else if(strstr(rx_buffer,"uploaddata")!=RT_NULL)
|
|
|
|
|
- {
|
|
|
|
|
- UpLoad_Data();
|
|
|
|
|
- }
|
|
|
|
|
- else if (strstr(rx_buffer,"checkupdate")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- time_t now = time(RT_NULL);
|
|
|
|
|
- static struct tm tm;
|
|
|
|
|
- gmtime_r(&now, &tm);
|
|
|
|
|
- HMI_WRITE("hardcheck.tip_rtc.txt=\"%04d-%02d-%02d %02d:%02d:%02d\"",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
|
|
|
- HMI_WRITE("hardcheck.p0.pic=%d",70);
|
|
|
|
|
- //RTC时间判断,如果当前年份小于2020,提示需要设置时间
|
|
|
|
|
- if(tm.tm_year+1900<2020)
|
|
|
|
|
- {
|
|
|
|
|
- rt_kprintf("时间未设置:%04d-%02d-%02d %02d:%02d:%02d\n",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
|
|
|
- HMI_WRITE("hardcheck.tip_rtc.txt=%04d-%02d-%02d %02d:%02d:%02d",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- //进入bootloader模式
|
|
|
|
|
- else if (strstr(rx_buffer,"bootloader")!=NULL) {
|
|
|
|
|
- device_status.stop_in_bootloader = 1;
|
|
|
|
|
- ef_set_env_blob("stop_in_bootloader", &device_status.stop_in_bootloader, sizeof(device_status.stop_in_bootloader));
|
|
|
|
|
- rt_hw_cpu_reset();
|
|
|
|
|
- }
|
|
|
|
|
- //软件重启
|
|
|
|
|
- else if (strstr(rx_buffer,"reboot")!=NULL) {
|
|
|
|
|
- rt_hw_cpu_reset();
|
|
|
|
|
- }
|
|
|
|
|
- //屏幕上触发远程升级
|
|
|
|
|
- else if (strstr(rx_buffer,"hmi_update")!=NULL) {
|
|
|
|
|
- DTU_Write("hmi_update");
|
|
|
|
|
- device_status.update_flag = 1;
|
|
|
|
|
- ef_set_env_blob("update_flag", &device_status.update_flag, sizeof(device_status.update_flag));
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- rt_hw_cpu_reset();
|
|
|
|
|
- }else if (strstr(rx_buffer,"checkcamera")!=NULL){
|
|
|
|
|
- DTU_Write("{\"ctr_cam\":\"checkcamera\"}");
|
|
|
|
|
- //校准屏幕的RTC
|
|
|
|
|
- HMI_WRITE("rtc0=%d",tm.tm_year+1900);
|
|
|
|
|
- HMI_WRITE("rtc1=%d",tm.tm_mon+1);
|
|
|
|
|
- HMI_WRITE("rtc2=%d",tm.tm_mday);
|
|
|
|
|
- HMI_WRITE("rtc3=%d",tm.tm_hour);
|
|
|
|
|
- HMI_WRITE("rtc4=%d",tm.tm_min);
|
|
|
|
|
- HMI_WRITE("rtc5=%d",tm.tm_sec);
|
|
|
|
|
- //开启超时定时器
|
|
|
|
|
- Start_timer_Uart2();
|
|
|
|
|
- }else if (strstr(rx_buffer,"ReadCamParam")!=NULL){
|
|
|
|
|
- DTU_Write("{\"ctr_cam\":\"ReadParam\"}");
|
|
|
|
|
- //开启超时定时器
|
|
|
|
|
- Start_timer_Uart2();
|
|
|
|
|
- }//SaveCamParam:2070.00000-0.7-144-30-0-0-5472*5472
|
|
|
|
|
- else if (strstr(rx_buffer,"SaveCamParam")!=NULL){
|
|
|
|
|
- const char *prefix ="SaveCamParam:";
|
|
|
|
|
- size_t prefix_len = strlen(prefix);
|
|
|
|
|
- const char *start_pos = strstr(rx_buffer, prefix);
|
|
|
|
|
- if(start_pos!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- // 移动到前缀之后的位置
|
|
|
|
|
- start_pos += prefix_len;
|
|
|
|
|
- DTU_Write("%s",makeJson_Cam("SaveParam",start_pos));
|
|
|
|
|
- }
|
|
|
|
|
- //开启超时定时器
|
|
|
|
|
- Start_timer_Uart2();
|
|
|
|
|
- }else if (strstr(rx_buffer,"GrabOn")!=NULL){
|
|
|
|
|
- DTU_Write("{\"ctr_cam\":\"GrabOn\"}");
|
|
|
|
|
- //开启超时定时器
|
|
|
|
|
- Start_timer_Uart2();
|
|
|
|
|
- }else if (strstr(rx_buffer,"GrabOff")!=NULL){
|
|
|
|
|
- DTU_Write("{\"ctr_cam\":\"GrabOff\"}");
|
|
|
|
|
- //开启超时定时器
|
|
|
|
|
- Start_timer_Uart2();
|
|
|
|
|
- }
|
|
|
|
|
- else if(strstr(rx_buffer,"SelfCheck")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- //校准屏幕的RTC
|
|
|
|
|
- HMI_WRITE("rtc0=%d",tm.tm_year+1900);
|
|
|
|
|
- HMI_WRITE("rtc1=%d",tm.tm_mon+1);
|
|
|
|
|
- HMI_WRITE("rtc2=%d",tm.tm_mday);
|
|
|
|
|
- HMI_WRITE("rtc3=%d",tm.tm_hour);
|
|
|
|
|
- HMI_WRITE("rtc4=%d",tm.tm_min);
|
|
|
|
|
- HMI_WRITE("rtc5=%d",tm.tm_sec);
|
|
|
|
|
- device_status.selfcheck_ws = 2;
|
|
|
|
|
- LOG_W("开始自检:%d",device_status.selfcheck_ws);
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
#define EPS 1e-3
|
|
#define EPS 1e-3
|
|
|
// 找出一维数组中最大数的索引
|
|
// 找出一维数组中最大数的索引
|
|
@@ -1519,10 +560,10 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
if(device_status.auto_test_sw==1)
|
|
if(device_status.auto_test_sw==1)
|
|
|
{
|
|
{
|
|
|
//开始采集风机持续5S
|
|
//开始采集风机持续5S
|
|
|
- ctr_router(ON);
|
|
|
|
|
|
|
+ ctr_Heat(ON);
|
|
|
rt_thread_delay(1000*60);
|
|
rt_thread_delay(1000*60);
|
|
|
//关闭采集风机
|
|
//关闭采集风机
|
|
|
- ctr_router(OFF);
|
|
|
|
|
|
|
+ ctr_Heat(OFF);
|
|
|
//胶带传送
|
|
//胶带传送
|
|
|
turnlimit();
|
|
turnlimit();
|
|
|
rt_thread_delay(1000);
|
|
rt_thread_delay(1000);
|