This commit is contained in:
小马_666 2025-05-22 09:16:34 +08:00
parent 5005c126d8
commit ce60deecb3
2 changed files with 46 additions and 51 deletions

View File

@ -2,7 +2,7 @@
* @Author: mbw
* @Date: 2024-11-30 15:46:21
* @LastEditors: mbw && 1600520629@qq.com
* @LastEditTime: 2025-05-21 11:18:55
* @LastEditTime: 2025-05-22 09:08:58
* @FilePath: \ble_bjq_ch303rct6_ml307\bsp\src\at_device_ml307.c
* @Description:
*
@ -1094,42 +1094,43 @@ static void ml307_init_thread_entry(void *parameter)
result = -RT_ERROR;
goto __exit;
}
if (at_obj_exec_cmd(device->client, resp, "AT+MIPCALL=1,1") != RT_EOK)
// if (at_obj_exec_cmd(device->client, resp, "AT+MIPCALL=1,1") != RT_EOK)
if (at_obj_exec_cmd(device->client, resp, "AT+MIPCALL=0") != RT_EOK)
{
result = -RT_ERROR;
goto __exit;
}
#if defined(AT_DEBUG)
/* check the GPRS network IP address */
for (i = 0; i < IPADDR_RETRY; i++)
{
if (at_obj_exec_cmd(client, resp, "AT+MIPCALL?") == RT_EOK)
{
#define IP_ADDR_SIZE_MAX 16
char ipaddr_str[8 * IP_ADDR_SIZE_MAX] = {0};
char ipaddr_v4[IP_ADDR_SIZE_MAX] = {0};
char ipaddr_v6[4 * IP_ADDR_SIZE_MAX] = {0};
// #if defined(AT_DEBUG)
// /* check the GPRS network IP address */
// for (i = 0; i < IPADDR_RETRY; i++)
// {
// if (at_obj_exec_cmd(client, resp, "AT+MIPCALL?") == RT_EOK)
// {
// #define IP_ADDR_SIZE_MAX 16
// char ipaddr_str[8 * IP_ADDR_SIZE_MAX] = {0};
// char ipaddr_v4[IP_ADDR_SIZE_MAX] = {0};
// char ipaddr_v6[4 * IP_ADDR_SIZE_MAX] = {0};
/* parse response data "+CGPADDR: 1,<IP_address>" */
if (at_resp_parse_line_args_by_kw(resp, "+MIPCALL:", "+MIPCALL: %*d,%*d,%s", ipaddr_str) > 0)
{
const char *ipaddr_v4_str = strstr(ipaddr_str, "\"");
sscanf(ipaddr_v4_str, "\"%[^\"]", ipaddr_v4);
const char *ipaddr_v6_str = strstr(ipaddr_str, "\",\"");
sscanf(ipaddr_v6_str, "\",\"%[^\"]", ipaddr_v6);
// /* parse response data "+CGPADDR: 1,<IP_address>" */
// if (at_resp_parse_line_args_by_kw(resp, "+MIPCALL:", "+MIPCALL: %*d,%*d,%s", ipaddr_str) > 0)
// {
// const char *ipaddr_v4_str = strstr(ipaddr_str, "\"");
// sscanf(ipaddr_v4_str, "\"%[^\"]", ipaddr_v4);
// const char *ipaddr_v6_str = strstr(ipaddr_str, "\",\"");
// sscanf(ipaddr_v6_str, "\",\"%[^\"]", ipaddr_v6);
LOG_D("%s device IP address: %s - %s", device->name, ipaddr_v4, ipaddr_v6);
break;
}
}
rt_thread_mdelay(1000);
}
if (i == IPADDR_RETRY)
{
LOG_E("%s device GPRS is get IP address failed", device->name);
result = -RT_ERROR;
goto __exit;
}
// LOG_D("%s device IP address: %s - %s", device->name, ipaddr_v4, ipaddr_v6);
// break;
// }
// }
// rt_thread_mdelay(1000);
// }
// if (i == IPADDR_RETRY)
// {
// LOG_E("%s device GPRS is get IP address failed", device->name);
// result = -RT_ERROR;
// goto __exit;
// }
#endif
Time_Calibration(device);
/* initialize successfully */

View File

@ -2,7 +2,7 @@
* @Author: mbw
* @Date: 2024-11-30 15:46:21
* @LastEditors: mbw && 1600520629@qq.com
* @LastEditTime: 2025-05-21 11:37:02
* @LastEditTime: 2025-05-22 09:10:21
* @FilePath: \ble_bjq_ch303rct6_ml307\bsp\src\bsp_ml307.c
* @Description:
*
@ -1967,25 +1967,19 @@ static void Ml307_Life_Thread_Entry(void *parameter)
result = -RT_ERROR;
goto __exit;
}
if (at_obj_exec_cmd(device->client, resp, "AT+MIPCALL=1,1") != RT_EOK)
{
result = -RT_ERROR;
goto __exit;
}
int link_stat = 0;
if (at_resp_parse_line_args_by_kw(resp, "+MIPCALL:", "+MIPCALL: %d,%*d,%*s", &link_stat) > 0)
{
if (link_stat == 1)
{
result = RT_EOK;
}
}
else
{
LOG_E("AT+MIPCALL error.");
result = -RT_ERROR;
goto __exit;
}
// if (at_obj_exec_cmd(device->client, resp, "AT+MIPCALL=1,1") != RT_EOK)
// {
// result = -RT_ERROR;
// goto __exit;
// }
// int link_stat = 0;
// if (at_resp_parse_line_args_by_kw(resp, "+MIPCALL:", "+MIPCALL: %d,%*d,%*s", &link_stat) > 0)
// {
// if (link_stat == 1)
// {
// result = RT_EOK;
// }
// }
if (device->class->device_ops->control(device, AT_DEVICE_CTRL_NET_CONN, RT_NULL) == RT_EOK)
{
LOG_D("重连网络成功\n");