|
|
@@ -326,36 +326,14 @@ static void Hmi_thread_entry(void *parameter)
|
|
|
}
|
|
|
}
|
|
|
/*******************************************************************************************/
|
|
|
-static void t_uart2_callback(void *parameter)
|
|
|
-{
|
|
|
- HMI_WRITE("sysSet.va0.txt=\"指令超时,请重试...\"");
|
|
|
- LOG_E("t_uart2_callback");
|
|
|
- uart2_timeout_flag = RT_TRUE;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
void Start_timer_Uart2(void)
|
|
|
{
|
|
|
- if(timer_uart2!=RT_NULL)
|
|
|
- {
|
|
|
- rt_timer_start(timer_uart2);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LOG_E("timer_uart2 start Failed!");
|
|
|
- }
|
|
|
+ device_status.mock_uart2_timer_flag = 1;
|
|
|
}
|
|
|
|
|
|
void Stop_timer_Uart2(void)
|
|
|
{
|
|
|
- if(timer_uart2!=RT_NULL)
|
|
|
- {
|
|
|
- rt_timer_stop(timer_uart2);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LOG_E("timer_uart2 stop Failed!");
|
|
|
- }
|
|
|
+ device_status.mock_uart2_timer_flag = 0;
|
|
|
}
|
|
|
|
|
|
static void refresh_hmi_Component(struct tm tm)
|
|
|
@@ -889,7 +867,6 @@ static void HMI_Decode(void)
|
|
|
return;
|
|
|
}
|
|
|
// ======================================================================
|
|
|
-
|
|
|
// 格式正确才赋值
|
|
|
LOG_I("设置闹钟时间:%s",var);
|
|
|
rt_sprintf(device_status.alarm_tg, "%s", var);
|
|
|
@@ -1564,7 +1541,8 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
rt_uint16_t num_down_open = 200; // 下仓门打开时间
|
|
|
rt_uint16_t num_down_close = 200; // 下仓门关闭时间
|
|
|
rt_int16_t photo_led_sec = 900; //55S
|
|
|
-
|
|
|
+ static rt_uint16_t rtu_isboot_cnt = 0;
|
|
|
+ static rt_uint16_t mock_uart2_timer_cnt = 0;
|
|
|
static rt_uint16_t route_off_t = 0;
|
|
|
device_status.route_off_t = 0;
|
|
|
|
|
|
@@ -1580,7 +1558,7 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
{
|
|
|
char *rep = makeJsonRpc2_0("reboot",NULL, 1);
|
|
|
if(rep){
|
|
|
- device_status.C01 = 100;
|
|
|
+ device_status.rtu_isboot = 1;
|
|
|
DTU_Write(rep);
|
|
|
//启动超时定时器
|
|
|
Start_timer_Uart2();
|
|
|
@@ -1588,11 +1566,25 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
}
|
|
|
rt_thread_delay(1000);
|
|
|
}
|
|
|
- if(uart2_timeout_flag == RT_TRUE){
|
|
|
- uart2_timeout_flag = RT_FALSE;
|
|
|
- ctr_RTU_DTU(OFF);
|
|
|
- rt_thread_delay(1000*30);
|
|
|
- ctr_RTU_DTU(ON);
|
|
|
+ if(device_status.rtu_isboot == 1){
|
|
|
+ rtu_isboot_cnt++;
|
|
|
+ if(rtu_isboot_cnt>=200)
|
|
|
+ {
|
|
|
+ device_status.rtu_isboot = 0;
|
|
|
+ rtu_isboot_cnt = 0;
|
|
|
+ ctr_RTU_DTU(OFF);
|
|
|
+ rt_thread_delay(1000*31);
|
|
|
+ ctr_RTU_DTU(ON);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ rtu_isboot_cnt = 0;
|
|
|
+ }
|
|
|
+ if(device_status.mock_uart2_timer_flag==1){
|
|
|
+ mock_uart2_timer_cnt++;
|
|
|
+ if(mock_uart2_timer_cnt>=200){
|
|
|
+ mock_uart2_timer_cnt = 0;
|
|
|
+ device_status.mock_uart2_timer_flag = 0;
|
|
|
+ }
|
|
|
}
|
|
|
#endif
|
|
|
if(device_status.ctr_up_motor==1)
|
|
|
@@ -1767,12 +1759,6 @@ 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);
|
|
|
- if(timer_uart2==RT_NULL)
|
|
|
- {
|
|
|
- LOG_E("rt_timer_create timer_uart2 failed!");
|
|
|
- }
|
|
|
return ret;
|
|
|
}
|
|
|
void Check_ParamConfig(void)
|
|
|
@@ -2029,26 +2015,19 @@ void Check_ParamConfig(void)
|
|
|
rt_sprintf(device_status.csq,"0");
|
|
|
rt_sprintf(device_status.sim,"1");
|
|
|
Sys_Motor_Task();
|
|
|
-
|
|
|
ctr_router(ON);
|
|
|
-
|
|
|
Hmi_Fresh();
|
|
|
-
|
|
|
Control_clear();
|
|
|
Control_Check(); //自检
|
|
|
-
|
|
|
dtu_data_play();
|
|
|
sht30_collect();
|
|
|
#if SENSOR_EN==1
|
|
|
mb_master_samlpe();
|
|
|
#endif
|
|
|
-
|
|
|
uint16_t connect_num=0;
|
|
|
//等待联网,
|
|
|
while(atoi(device_status.net)==1)
|
|
|
{
|
|
|
- if(Read_Real_Voltage()/100>5&&device_status.power_status==0)
|
|
|
- ctr_RTU_DTU(ON);
|
|
|
char *readinfo = makeJson_ReadInfo();
|
|
|
DTU_Write("%s",readinfo);
|
|
|
rt_free(readinfo);
|