|
|
@@ -64,6 +64,9 @@ struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; /*初始化配置
|
|
|
static rt_thread_t hmi1 = RT_NULL;
|
|
|
static rt_thread_t ctr_motor = RT_NULL;
|
|
|
rt_device_t serial; /*串口设备句柄*/
|
|
|
+
|
|
|
+rt_timer_t timer_uart2 = RT_NULL;
|
|
|
+
|
|
|
/* 消息队列控制块 */
|
|
|
static struct rt_messagequeue rx_mq;//接收数据消息队列
|
|
|
static void HMI_Decode(void);
|
|
|
@@ -154,6 +157,24 @@ static void Hmi_thread_entry(void *parameter)
|
|
|
}
|
|
|
}
|
|
|
/*******************************************************************************************/
|
|
|
+static void t_uart2_callback(void *parameter)
|
|
|
+{
|
|
|
+ HMI_WRITE("sysSet.va0.txt=\"指令超时,请重试...\"");
|
|
|
+ LOG_I("t_uart2_callback");
|
|
|
+}
|
|
|
+
|
|
|
+void Start_timer_Uart2(void)
|
|
|
+{
|
|
|
+
|
|
|
+ if(timer_uart2!=RT_NULL){
|
|
|
+ rt_timer_start(timer_uart2);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LOG_E("timer_uart2 start Failed!");
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
/***************************** 解析从屏幕收到的数据 begin **********************************/
|
|
|
static void HMI_Decode(void)
|
|
|
@@ -181,6 +202,7 @@ static void HMI_Decode(void)
|
|
|
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;
|
|
|
}
|
|
|
@@ -281,6 +303,7 @@ static void HMI_Decode(void)
|
|
|
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);
|
|
|
@@ -288,6 +311,7 @@ static void HMI_Decode(void)
|
|
|
HMI_WRITE("menu.gps_state.txt=\"定位成功:(基站)\"");
|
|
|
}
|
|
|
#endif
|
|
|
+
|
|
|
//更新联网状态
|
|
|
if(atoi(device_status.net)==1)
|
|
|
{
|
|
|
@@ -1168,14 +1192,14 @@ static void HMI_Decode(void)
|
|
|
else if (strstr(rx_buffer,"DebugDisable")!=NULL) {
|
|
|
Debug_log_OFF();
|
|
|
}
|
|
|
- //1.0
|
|
|
- else if (strstr(rx_buffer,"SwversionV1")!=NULL)
|
|
|
+ //高空
|
|
|
+ else if (strstr(rx_buffer,"SwversionV11")!=NULL)
|
|
|
{
|
|
|
- if(device_status.version_type != 1)
|
|
|
+ device_status.dtype = 3;
|
|
|
+ if(device_status.version_type != 11)
|
|
|
{
|
|
|
- device_status.dtype = 3;
|
|
|
- device_status.version_type = 1;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_ZP);
|
|
|
+ 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();
|
|
|
@@ -1184,14 +1208,14 @@ static void HMI_Decode(void)
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- //高空
|
|
|
- else if (strstr(rx_buffer,"SwversionV11")!=NULL)
|
|
|
+ //1.0
|
|
|
+ else if (strstr(rx_buffer,"SwversionV1")!=NULL)
|
|
|
{
|
|
|
- device_status.dtype = 3;
|
|
|
- if(device_status.version_type != 11)
|
|
|
+ if(device_status.version_type != 1)
|
|
|
{
|
|
|
- device_status.version_type = 11;
|
|
|
- sprintf(device_status.driver, "%s",VERSION_GK);
|
|
|
+ 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();
|
|
|
@@ -1331,9 +1355,47 @@ static void HMI_Decode(void)
|
|
|
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();
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//入口函数-电机控制及
|
|
|
static void Ctr_Mortor_entry(void* parameter)
|
|
|
{
|
|
|
@@ -1362,7 +1424,7 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
ctr_Color_board(OPEN, 1000);
|
|
|
}
|
|
|
#endif
|
|
|
- #if 1
|
|
|
+ #if 0
|
|
|
time_t time_reset12V;
|
|
|
time(&time_reset12V);
|
|
|
static struct tm alarm_reset12V;
|
|
|
@@ -1524,7 +1586,7 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
rt_free(takephotojson);
|
|
|
}
|
|
|
photo_led_sec--;
|
|
|
- if(photo_led_sec==0&&device_status.version_type==48) //4800W相机
|
|
|
+ if(photo_led_sec==300) //
|
|
|
{
|
|
|
ctr_led(OFF);
|
|
|
photo_led_sec = 900;
|
|
|
@@ -1532,13 +1594,13 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
HMI_WRITE("sysTest.switchPhoto.val=0");
|
|
|
HMI_WRITE("sysTest.switchFill.val=0");
|
|
|
}
|
|
|
- else if (photo_led_sec==550&&device_status.version_type!=48) {
|
|
|
- ctr_led(OFF);
|
|
|
- photo_led_sec = 900;
|
|
|
- device_status.photo_ws = 0;
|
|
|
- HMI_WRITE("sysTest.switchPhoto.val=0");
|
|
|
- HMI_WRITE("sysTest.switchFill.val=0");
|
|
|
- }
|
|
|
+// else if (photo_led_sec==0&&device_status.version_type!=48) {
|
|
|
+// ctr_led(OFF);
|
|
|
+// photo_led_sec = 900;
|
|
|
+// device_status.photo_ws = 0;
|
|
|
+// HMI_WRITE("sysTest.switchPhoto.val=0");
|
|
|
+// HMI_WRITE("sysTest.switchFill.val=0");
|
|
|
+// }
|
|
|
}
|
|
|
/*对焦拍照*/
|
|
|
if(device_status.autotakepic==1)
|
|
|
@@ -1799,6 +1861,8 @@ int Hmi_Fresh(void)
|
|
|
{
|
|
|
ret = RT_ERROR;
|
|
|
}
|
|
|
+ //定时器,串口通信超时监测20S
|
|
|
+ timer_uart2 = rt_timer_create("t_uart2",t_uart2_callback,RT_NULL, 20000, RT_TIMER_FLAG_ONE_SHOT);
|
|
|
return ret;
|
|
|
}
|
|
|
void Check_ParamConfig(void)
|
|
|
@@ -2320,6 +2384,7 @@ void Debug_log_OFF(void)
|
|
|
{
|
|
|
rt_thread_startup(hmi1);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
MSH_CMD_EXPORT(Debug_log_ON,Debug_log_ON);
|
|
|
MSH_CMD_EXPORT(Debug_log_OFF,Debug_log_OFF);
|