This commit is contained in:
小马_666 2025-06-13 11:51:20 +08:00
commit 349e217407
4 changed files with 46 additions and 50 deletions

View File

@ -293,7 +293,7 @@ int main(void)
// 定义超时时间,单位为毫秒
#define TIMEOUT_MS (3 * 60 * 1000)
#define WORK_TIMER_CNT (1000 * 60 * 60)//按照小时算
rt_thread_mdelay(200);
if (Get_VIN_VoltageInt1000x() > 10000)
{
SYS_EventInit();

View File

@ -25,7 +25,7 @@
// (4.7/19.7) * 13V = 3.1V, 3.1/3.3*4096 = 3723
#define VIN_ADC_HIGH_THRESHOLD (uint16_t)3847 // 13V
// (4.7/19.7) * 10V = 2.39V, 2.39/3.3*4096 = 2966
#define VIN_ADC_LOW_THRESHOLD (uint16_t)2665 // 9V
#define VIN_ADC_LOW_THRESHOLD (uint16_t)2369 // 8V
float Get_VIN_Voltage(void);

View File

@ -961,11 +961,6 @@ static void ml307_init_thread_entry (void *parameter)
result = -RT_ERROR;
goto __exit;
}
if (at_obj_exec_cmd (device->client, resp, "AT+CEREG=1") != RT_EOK)
{
result = -RT_ERROR;
goto __exit;
}
/* Define PDP Context */
for (i = 0; i < COMMON_RETRY; i++)
{

View File

@ -1977,7 +1977,7 @@ static void Ml307_Life_Thread_Entry (void *parameter)
}
if (device->class->device_ops->control (device, AT_DEVICE_CTRL_POWER_OFF, RT_NULL) == RT_EOK)
{
rt_thread_mdelay (RT_TICK_PER_SECOND);
rt_thread_mdelay ((RT_TICK_PER_SECOND*2));
if (device->class->device_ops->control (device, AT_DEVICE_CTRL_POWER_ON, RT_NULL) == RT_EOK)
{
LOG_D ("AT device power on success");
@ -2048,46 +2048,6 @@ static void Ml307_Life_Thread_Entry (void *parameter)
LOG_E ("%s device SIM card detection failed.", device->name);
result = -RT_ERROR;
goto __exit;
}
/* Define PDP Context */
for (i = 0; i < 60; i++)
{
if (at_obj_exec_cmd (device->client, resp, "AT+CGACT=1") == RT_EOK)
{
LOG_D ("pdp激活成功");
break;
}
else
{
// AT+CGACT=0,1 //去激活 PDP
if (at_obj_exec_cmd (device->client, resp, "AT+CGACT=0") == RT_EOK)
{
LOG_D ("pdp去激活成功");
}
}
rt_thread_mdelay (5000);
}
if (i == 60)
{
result = -RT_ERROR;
goto __exit;
}
for (i = 0; i < 5; i++)
{
if (at_obj_exec_cmd (device->client, resp, "AT+CGDCONT=1,\"IPV4V6\",\"cmnet\"") == RT_EOK)
{
LOG_D ("%s device Define PDP Context Success.", device->name);
break;
}
rt_thread_mdelay (1000);
}
if (i == 5)
{
LOG_E ("%s device Define PDP Context failed.", device->name);
result = -RT_ERROR;
goto __exit;
}
if (at_obj_exec_cmd (device->client, resp, "AT+CEREG=1") != RT_EOK)
{
@ -2118,6 +2078,47 @@ static void Ml307_Life_Thread_Entry (void *parameter)
result = -RT_ERROR;
goto __exit;
}
for (i = 0; i < 5; i++)
{
if (at_obj_exec_cmd (device->client, resp, "AT+CGDCONT=1,\"IPV4V6\",\"cmnet\"") == RT_EOK)
{
LOG_D ("%s device Define PDP Context Success.", device->name);
break;
}
rt_thread_mdelay (1000);
}
if (i == 5)
{
LOG_E ("%s device Define PDP Context failed.", device->name);
result = -RT_ERROR;
goto __exit;
}
// /* Define PDP Context */
// for (i = 0; i < 60; i++)
// {
// if (at_obj_exec_cmd (device->client, resp, "AT+CGACT=1") == RT_EOK)
// {
// LOG_D ("pdp激活成功");
// break;
// }
// else
// {
// // AT+CGACT=0,1 //去激活 PDP
// if (at_obj_exec_cmd (device->client, resp, "AT+CGACT=0") == RT_EOK)
// {
// LOG_D ("pdp去激活成功");
// }
// }
// rt_thread_mdelay (1000);
// }
// if (i == 60)
// {
// result = -RT_ERROR;
// goto __exit;
// }
if (at_obj_exec_cmd (device->client, resp, "AT+MIPCALL=1,1") != RT_EOK)
{
result = -RT_ERROR;