加了断网检测1min一次,
This commit is contained in:
parent
a7bbacbe48
commit
5c917b6ebb
|
@ -19,7 +19,7 @@
|
|||
|
||||
|
||||
#define SYS_HW_VERSION (0X13U)
|
||||
#define SYS_SW_VERSION (0X20U)
|
||||
#define SYS_SW_VERSION (0X21U)
|
||||
#define SYS_IOT_UPLOAD_CYCLE_MIN (0X003CU) // 高位在后,低位在前
|
||||
#define SYS_IOT_RETRY (0X03U)
|
||||
#define SYS_TEMP_ALARM_THRESHOLD (0X32U)
|
||||
|
|
|
@ -413,36 +413,37 @@ static int ml307_check_link_status(struct at_device *device)
|
|||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
// if(at_obj_exec_cmd(device->client, resp, "AT+MIPCALL?") < 0)
|
||||
if (at_obj_exec_cmd (device->client, resp, "AT+CEREG?") == RT_EOK)
|
||||
{
|
||||
|
||||
if (at_resp_parse_line_args_by_kw (resp, "+CEREG:", "+CEREG: %*d,%d", &link_stat) > 0)
|
||||
{
|
||||
if ((link_stat != 1) && (link_stat != 5))
|
||||
{
|
||||
ml307_conncet_tcp_flag = 0;
|
||||
ml307_connect_sever_flag = 0;
|
||||
rt_sem_release(ml307_disconnect_sem);
|
||||
}
|
||||
}
|
||||
}
|
||||
// link_stat = 0;
|
||||
|
||||
// if(at_obj_exec_cmd(device->client, resp, "AT+CGACT?") < 0)
|
||||
// {
|
||||
// result = -RT_ERROR;
|
||||
// goto __exit;
|
||||
// }
|
||||
|
||||
// if (at_resp_parse_line_args_by_kw(resp, "+MIPCALL:", "+MIPCALL: %d,%*d,%*s", &link_stat) > 0)
|
||||
// //+CGACT: 1,1
|
||||
// if (at_resp_parse_line_args_by_kw(resp, "+CGACT:", "+CGACT: %d,%*d", &link_stat) > 0)
|
||||
// {
|
||||
// if (link_stat == 1)
|
||||
// {
|
||||
// result = RT_EOK;
|
||||
// }
|
||||
// result = link_stat;
|
||||
// }
|
||||
// __exit:
|
||||
|
||||
if(at_obj_exec_cmd(device->client, resp, "AT+CGACT?") < 0)
|
||||
{
|
||||
result = -RT_ERROR;
|
||||
goto __exit;
|
||||
}
|
||||
//+CGACT: 1,1
|
||||
if (at_resp_parse_line_args_by_kw(resp, "+CGACT:", "+CGACT: %d,%*d", &link_stat) > 0)
|
||||
{
|
||||
result = link_stat;
|
||||
}
|
||||
__exit:
|
||||
|
||||
if(resp)
|
||||
{
|
||||
// if(resp)
|
||||
// {
|
||||
at_delete_resp(resp);
|
||||
}
|
||||
// }
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
@ -537,7 +538,7 @@ static void ml307_check_link_status_entry(void *parameter)
|
|||
#define ML307_LINK_DELAY_TIME (60 * RT_TICK_PER_SECOND)
|
||||
|
||||
at_response_t resp = RT_NULL;
|
||||
int link_status;
|
||||
// int link_status;
|
||||
struct at_device *device = RT_NULL;
|
||||
struct netdev *netdev = (struct netdev *)parameter;
|
||||
|
||||
|
@ -556,17 +557,17 @@ static void ml307_check_link_status_entry(void *parameter)
|
|||
}
|
||||
while(1)
|
||||
{
|
||||
link_status = ml307_check_link_status(device);//固定时间检查连接状态
|
||||
if(link_status < 0)
|
||||
{
|
||||
rt_thread_mdelay(ML307_LINK_DELAY_TIME);
|
||||
continue;
|
||||
}
|
||||
/* check the network interface device link status */
|
||||
if ((ML307_LINK_STATUS_OK == link_status) != netdev_is_link_up(netdev))
|
||||
{
|
||||
netdev_low_level_set_link_status(netdev, (ML307_LINK_STATUS_OK == link_status));
|
||||
}
|
||||
ml307_check_link_status(device);//固定时间检查连接状态
|
||||
// if(link_status < 0)
|
||||
// {
|
||||
// rt_thread_mdelay(ML307_LINK_DELAY_TIME);
|
||||
// continue;
|
||||
// }
|
||||
// /* check the network interface device link status */
|
||||
// if ((ML307_LINK_STATUS_OK == link_status) != netdev_is_link_up(netdev))
|
||||
// {
|
||||
// netdev_low_level_set_link_status(netdev, (ML307_LINK_STATUS_OK == link_status));
|
||||
// }
|
||||
|
||||
rt_thread_mdelay(ML307_LINK_DELAY_TIME);
|
||||
}
|
||||
|
|
|
@ -915,7 +915,7 @@ int BSP_Flash_Init (void)
|
|||
LOG_D ("Flash_Set_Sever_Data error!");
|
||||
}
|
||||
|
||||
Flash_SetProductTimeLimit (2025, 6, 11, 11, 50, 20, kFactoryTimeId);
|
||||
Flash_SetProductTimeLimit (2025, 6, 25, 11, 50, 20, kFactoryTimeId);
|
||||
Set_ExpirationTime (MAX_EXPIRATION_DAYS);
|
||||
// TODO:标定标志
|
||||
Flash_Set_Calibration_State(kNotCalibrated); // 标定状态
|
||||
|
|
|
@ -1954,7 +1954,7 @@ static void Ml307_Life_Thread_Entry (void *parameter)
|
|||
rt_err_t result = RT_ETIMEOUT;
|
||||
rt_uint32_t delay_n = 0;
|
||||
at_response_t resp = RT_NULL;
|
||||
|
||||
|
||||
LOG_D ("ml307_life_thread entry\n");
|
||||
|
||||
while (1)
|
||||
|
@ -2140,6 +2140,7 @@ static void Ml307_Life_Thread_Entry (void *parameter)
|
|||
delay_n = 0;
|
||||
ml307_disconnect_retry_flag = 0;
|
||||
at_delete_resp (resp);
|
||||
rt_sem_control (ml307_disconnect_sem, RT_IPC_CMD_RESET, 0);
|
||||
retry_delay = 8000; // 重置重连延迟时间
|
||||
rt_thread_mdelay (100);
|
||||
Ml307_Send_Event (kMl307HeartbeatEvent);
|
||||
|
|
Loading…
Reference in New Issue