This commit is contained in:
小马_666 2025-05-27 17:32:19 +08:00
parent 85ee671d27
commit 714c2aa255
3 changed files with 792 additions and 789 deletions

View File

@ -5,7 +5,7 @@
"type": "mrs-debugger", "type": "mrs-debugger",
"request": "launch", "request": "launch",
"name": "ble_bjq_ch303rct6_ml307", "name": "ble_bjq_ch303rct6_ml307",
"cwd": "c:\\Users\\1\\Desktop\\yhq\\ble_-tyq_-bjq_-ch32-v303", "cwd": "d:\\SXDT\\Project\\CH32\\ble_bjq_ch303rct6_ml307",
"openOCDCfg": { "openOCDCfg": {
"useLocalOpenOCD": true, "useLocalOpenOCD": true,
"executable": "c:/MounRiver/MounRiver_Studio2/resources/app/resources/win32/components/WCH/OpenOCD/OpenOCD/bin/openocd.exe", "executable": "c:/MounRiver/MounRiver_Studio2/resources/app/resources/win32/components/WCH/OpenOCD/OpenOCD/bin/openocd.exe",
@ -39,8 +39,8 @@
"additionalCommands": [] "additionalCommands": []
}, },
"loadedFiles": { "loadedFiles": {
"executableFile": "c:\\Users\\1\\Desktop\\yhq\\ble_-tyq_-bjq_-ch32-v303\\obj\\ble_bjq_ch303rct6_ml307.elf", "executableFile": "d:\\SXDT\\Project\\CH32\\ble_bjq_ch303rct6_ml307\\obj\\ble_bjq_ch303rct6_ml307.elf",
"symbolFile": "c:\\Users\\1\\Desktop\\yhq\\ble_-tyq_-bjq_-ch32-v303\\obj\\ble_bjq_ch303rct6_ml307.elf", "symbolFile": "d:\\SXDT\\Project\\CH32\\ble_bjq_ch303rct6_ml307\\obj\\ble_bjq_ch303rct6_ml307.elf",
"executableFileOffset": 0, "executableFileOffset": 0,
"symbolFileOffset": 0 "symbolFileOffset": 0
}, },

View File

@ -933,7 +933,7 @@ static void ml307_init_thread_entry(void *parameter)
goto __exit; goto __exit;
} }
/*设置心跳包*/ /*设置心跳包*/
if (at_obj_exec_cmd(device->client, resp, "AT+MIPTKA=0,1,120,60,1") != RT_EOK) if (at_obj_exec_cmd(device->client, resp, "AT+MIPTKA=0,1,120,60,3") != RT_EOK)
{ {
result = -RT_ERROR; result = -RT_ERROR;
goto __exit; goto __exit;

View File

@ -836,7 +836,8 @@ const Ml307EventInfo ml307_event_info[] = {
// {kMl307ExceptionEvent, kMl307PriorityLowest, "异常事件", Ml307_Send_Exception}, // {kMl307ExceptionEvent, kMl307PriorityLowest, "异常事件", Ml307_Send_Exception},
{kMl307ValveStatusEvent, kMl307PriorityLowest, "电磁阀状态改变事件", Ml307_Send_Valve_Status }, {kMl307ValveStatusEvent, kMl307PriorityLowest, "电磁阀状态改变事件", Ml307_Send_Valve_Status },
{kMl307FanStatusEvent, kMl307PriorityLowest, "风机状态改变事件", Ml307_Send_Fan_Status }, {kMl307FanStatusEvent, kMl307PriorityLowest, "风机状态改变事件", Ml307_Send_Fan_Status },
{kMl307DeviceFailureEvent, kMl307PriorityLowest, "设备失效事件", Ml307_Send_Device_Failure}}; {kMl307DeviceFailureEvent, kMl307PriorityLowest, "设备失效事件", Ml307_Send_Device_Failure }
};
Ml307Priority Get_Event_Priority (Ml307Event event_type) Ml307Priority Get_Event_Priority (Ml307Event event_type)
{ {
@ -1894,23 +1895,7 @@ static void Ml307_Life_Thread_Entry(void *parameter)
result = -RT_ERROR; result = -RT_ERROR;
goto __exit; goto __exit;
} }
/* Define PDP Context */
rt_uint8_t i = 0; rt_uint8_t i = 0;
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;
}
/* check SIM card */ /* check SIM card */
for (i = 0; i < 60; i++) for (i = 0; i < 60; i++)
{ {
@ -1940,6 +1925,24 @@ static void Ml307_Life_Thread_Entry(void *parameter)
result = -RT_ERROR; result = -RT_ERROR;
goto __exit; goto __exit;
} }
/* Define PDP Context */
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;
}
/* check the GPRS network is registered */ /* check the GPRS network is registered */
for (i = 0; i < 60; i++) for (i = 0; i < 60; i++)
{ {