This commit is contained in:
parent
fad648f428
commit
a413837f76
|
@ -293,7 +293,7 @@ int main(void)
|
||||||
// 定义超时时间,单位为毫秒
|
// 定义超时时间,单位为毫秒
|
||||||
#define TIMEOUT_MS (3 * 60 * 1000)
|
#define TIMEOUT_MS (3 * 60 * 1000)
|
||||||
#define WORK_TIMER_CNT (1000 * 60 * 60)//按照小时算
|
#define WORK_TIMER_CNT (1000 * 60 * 60)//按照小时算
|
||||||
|
rt_thread_mdelay(200);
|
||||||
if (Get_VIN_VoltageInt1000x() > 10000)
|
if (Get_VIN_VoltageInt1000x() > 10000)
|
||||||
{
|
{
|
||||||
SYS_EventInit();
|
SYS_EventInit();
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
// (4.7/19.7) * 13V = 3.1V, 3.1/3.3*4096 = 3723
|
// (4.7/19.7) * 13V = 3.1V, 3.1/3.3*4096 = 3723
|
||||||
#define VIN_ADC_HIGH_THRESHOLD (uint16_t)3847 // 13V
|
#define VIN_ADC_HIGH_THRESHOLD (uint16_t)3847 // 13V
|
||||||
// (4.7/19.7) * 10V = 2.39V, 2.39/3.3*4096 = 2966
|
// (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);
|
float Get_VIN_Voltage(void);
|
||||||
|
|
|
@ -959,11 +959,6 @@ static void ml307_init_thread_entry (void *parameter)
|
||||||
result = -RT_ERROR;
|
result = -RT_ERROR;
|
||||||
goto __exit;
|
goto __exit;
|
||||||
}
|
}
|
||||||
if (at_obj_exec_cmd (device->client, resp, "AT+CEREG=1") != RT_EOK)
|
|
||||||
{
|
|
||||||
result = -RT_ERROR;
|
|
||||||
goto __exit;
|
|
||||||
}
|
|
||||||
/* Define PDP Context */
|
/* Define PDP Context */
|
||||||
for (i = 0; i < COMMON_RETRY; i++)
|
for (i = 0; i < COMMON_RETRY; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
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)
|
if (device->class->device_ops->control (device, AT_DEVICE_CTRL_POWER_ON, RT_NULL) == RT_EOK)
|
||||||
{
|
{
|
||||||
LOG_D ("AT device power on success");
|
LOG_D ("AT device power on success");
|
||||||
|
@ -2020,7 +2020,7 @@ static void Ml307_Life_Thread_Entry (void *parameter)
|
||||||
result = -RT_ERROR;
|
result = -RT_ERROR;
|
||||||
goto __exit;
|
goto __exit;
|
||||||
}
|
}
|
||||||
/* check SIM card */
|
/* check SIM card */
|
||||||
for (i = 0; i < 60; i++)
|
for (i = 0; i < 60; i++)
|
||||||
{
|
{
|
||||||
if (at_obj_exec_cmd (device->client, resp, "AT+CPIN?") == RT_EOK)
|
if (at_obj_exec_cmd (device->client, resp, "AT+CPIN?") == RT_EOK)
|
||||||
|
@ -2049,47 +2049,7 @@ static void Ml307_Life_Thread_Entry (void *parameter)
|
||||||
result = -RT_ERROR;
|
result = -RT_ERROR;
|
||||||
goto __exit;
|
goto __exit;
|
||||||
}
|
}
|
||||||
/* Define PDP Context */
|
if (at_obj_exec_cmd (device->client, resp, "AT+CEREG=1") != RT_EOK)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
result = -RT_ERROR;
|
result = -RT_ERROR;
|
||||||
goto __exit;
|
goto __exit;
|
||||||
|
@ -2118,6 +2078,47 @@ static void Ml307_Life_Thread_Entry (void *parameter)
|
||||||
result = -RT_ERROR;
|
result = -RT_ERROR;
|
||||||
goto __exit;
|
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)
|
if (at_obj_exec_cmd (device->client, resp, "AT+MIPCALL=1,1") != RT_EOK)
|
||||||
{
|
{
|
||||||
result = -RT_ERROR;
|
result = -RT_ERROR;
|
||||||
|
|
Loading…
Reference in New Issue