暂存一下

This commit is contained in:
小马_666 2025-01-09 15:29:36 +08:00
parent d74da25a2c
commit 0ef073439e
10 changed files with 1411 additions and 1244 deletions

View File

@ -5,7 +5,7 @@
"type": "mrs-debugger", "type": "mrs-debugger",
"request": "launch", "request": "launch",
"name": "JT-DT-YD4N02A_RTT_MRS-4G", "name": "JT-DT-YD4N02A_RTT_MRS-4G",
"cwd": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-4G", "cwd": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-NT26K",
"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": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-4G\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf", "executableFile": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-NT26K\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf",
"symbolFile": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-4G\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf", "symbolFile": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-NT26K\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf",
"executableFileOffset": 0, "executableFileOffset": 0,
"symbolFileOffset": 0 "symbolFileOffset": 0
}, },

View File

@ -773,7 +773,7 @@
"address": "0x08000000", "address": "0x08000000",
"target_path": "obj\\JT-DT-YD4N02A_RTT_MRS-4G.hex", "target_path": "obj\\JT-DT-YD4N02A_RTT_MRS-4G.hex",
"clkSpeed": "High", "clkSpeed": "High",
"debug_interface_mode": "1-wire serial", "debug_interface_mode": "",
"erase": true, "erase": true,
"program": true, "program": true,
"verify": true, "verify": true,

View File

@ -2,8 +2,8 @@
* @Author: mbw * @Author: mbw
* @Date: 2024-10-23 17:14:16 * @Date: 2024-10-23 17:14:16
* @LastEditors: mbw && 1600520629@qq.com * @LastEditors: mbw && 1600520629@qq.com
* @LastEditTime: 2025-01-08 10:21:25 * @LastEditTime: 2025-01-09 14:50:14
* @FilePath: \JT-DT-YD4N02A_RTT_MRS-4G\applications\main.c * @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\applications\main.c
* @Descrt_thread_ * @Descrt_thread_
* *
* Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
@ -184,7 +184,6 @@ void Work_Cnt_Timer_Callback(void *parameter)
} }
int main(void) int main(void)
{ {
#define WORK_TIMER_CNT (1000 * 60 * 60 * 24) #define WORK_TIMER_CNT (1000 * 60 * 60 * 24)
rt_err_t result = RT_EINVAL; rt_err_t result = RT_EINVAL;
@ -201,6 +200,7 @@ int main(void)
Flash_GetTotalRecord(&TotalRecords); Flash_GetTotalRecord(&TotalRecords);
work_duration = Flash_Get_WorkDuration(); work_duration = Flash_Get_WorkDuration();
LOG_D("工作天数:%d", work_duration);
rt_timer_init(&work_cnt_timer, rt_timer_init(&work_cnt_timer,
"work_cnt_timer", "work_cnt_timer",
Work_Cnt_Timer_Callback, Work_Cnt_Timer_Callback,
@ -225,7 +225,6 @@ int main(void)
LOG_D("欠压复位\r\n"); LOG_D("欠压复位\r\n");
RCC_ClearFlag(); RCC_ClearFlag();
NVIC_SystemReset(); // 直接重启系统 NVIC_SystemReset(); // 直接重启系统
} }
while (1) while (1)
{ {
@ -291,10 +290,6 @@ int main(void)
rt_thread_mdelay(500); rt_thread_mdelay(500);
Send_Laser_Alarm_Event(kAlarmEvent); Send_Laser_Alarm_Event(kAlarmEvent);
} }
if (H308.end_of_life == 1)
{
Send_Laser_Alarm_Event(kSensorFailureEvent);
}
else if (H308.detection_flag == kH308Fault) else if (H308.detection_flag == kH308Fault)
{ {
LED_G_NORMAL; LED_G_NORMAL;
@ -344,7 +339,6 @@ int main(void)
relay_state_flag = 0; relay_state_flag = 0;
BEEP_STOP; BEEP_STOP;
#if (IOT_MODULE_SWITCH == 1) #if (IOT_MODULE_SWITCH == 1)
Nt26k_Send_Event(kNt26kAlarmRcyEvent); Nt26k_Send_Event(kNt26kAlarmRcyEvent);
#endif #endif

View File

@ -19,7 +19,7 @@
#define SYS_HW_VERSION 0X10 #define SYS_HW_VERSION 0X10
#define SYS_SW_VERSION 0X13 #define SYS_SW_VERSION 0X13
#define SYS_IOT_UPLOAD_CYCLE_MIN (0X0A00) // 高位在前,低位在后 #define SYS_IOT_UPLOAD_CYCLE_MIN (0X3C00) // 高位在前,低位在后
#define SYS_ALARM_VALVE 0X0A #define SYS_ALARM_VALVE 0X0A
#define SYS_IOT_URL "8.130.117.149" #define SYS_IOT_URL "8.130.117.149"
#define SYS_IOT_PORT "7137" #define SYS_IOT_PORT "7137"

View File

@ -204,6 +204,7 @@ extern struct Nt26k_Ops nt26k_ops;
extern rt_sem_t nt26k_recv_sem; extern rt_sem_t nt26k_recv_sem;
extern rt_sem_t nt26k_disconnect_sem; extern rt_sem_t nt26k_disconnect_sem;
extern rt_uint8_t nt26k_conncet_tcp_flag; extern rt_uint8_t nt26k_conncet_tcp_flag;
extern rt_uint8_t nt26k_disconnect_pdp_flag;
extern rt_uint8_t power_on_send_flag; extern rt_uint8_t power_on_send_flag;
int nt26k_device_register(void); int nt26k_device_register(void);
int BSP_Nt26k_Thread_Init(void); int BSP_Nt26k_Thread_Init(void);

File diff suppressed because it is too large Load Diff

View File

@ -277,19 +277,14 @@ int Flash_Set_WorkDuration(rt_uint16_t value)
Flash_ErasePage_ReadConfigInfo(page_buf); Flash_ErasePage_ReadConfigInfo(page_buf);
*(rt_uint16_t *)(page_buf + in_page_offset) = value; rt_memcpy(page_buf + in_page_offset, &value, FLASH_WORK_TIME_LEN);
return Flash_Write_ConfigInfo(page_buf); return Flash_Write_ConfigInfo(page_buf);
} }
int Flash_Get_Sever_Data(struct flash_sever_info *sever_info) int Flash_Get_Sever_Data(struct flash_sever_info *sever_info)
{ {
rt_uint8_t data[FLASH_SERVER_LEN]; rt_uint8_t data[FLASH_SERVER_LEN] = {0};
rt_memcpy(data, (rt_uint8_t *)FLASH_SERVER_ADDR_ADDR, FLASH_SERVER_LEN); rt_memcpy(data, (rt_uint8_t *)FLASH_SERVER_ADDR_ADDR, FLASH_SERVER_LEN);
if (data == RT_NULL)
{
LOG_E("Flash_Get_Sever_Data failed");
return -RT_ERROR;
}
LOG_D("data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x", 0, data[0], 1, data[1], 2, data[2], 3, data[3], 4, data[4], 5, data[5]); LOG_D("data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x data[%d] = %x", 0, data[0], 1, data[1], 2, data[2], 3, data[3], 4, data[4], 5, data[5]);
rt_snprintf(sever_info->server_url, sizeof(sever_info->server_url), "%d.%d.%d.%d", rt_snprintf(sever_info->server_url, sizeof(sever_info->server_url), "%d.%d.%d.%d",
data[3], data[2], data[1], data[0]); data[3], data[2], data[1], data[0]);
@ -584,8 +579,9 @@ void Flash_ErasePage_ConfigInfo(void)
void Flash_ErasePage_ReadConfigInfo(rt_uint8_t *page_buf) void Flash_ErasePage_ReadConfigInfo(rt_uint8_t *page_buf)
{ {
Flash_Read(FLASH_CONFIG_INFO_START_ADDR, page_buf, FLASH_PAGE_SIZE); Flash_Read(FLASH_CONFIG_INFO_START_ADDR, page_buf, FLASH_PAGE_SIZE);
rt_thread_mdelay(10);
Flash_ErasePage_ConfigInfo(); Flash_ErasePage_ConfigInfo();
rt_thread_mdelay(10);
} }
int Flash_Write_ConfigInfo(rt_uint8_t *page_buf) int Flash_Write_ConfigInfo(rt_uint8_t *page_buf)
@ -839,7 +835,7 @@ int BSP_Flash_Init(void)
sci.emagnetic_switch = sys_emagnetic_switch; sci.emagnetic_switch = sys_emagnetic_switch;
sci.relay_switch = sys_relay_switch; sci.relay_switch = sys_relay_switch;
Flash_Set_WorkDuration(work_duration); Flash_Set_WorkDuration(0);
LOG_D("work_duration:%d", Flash_Get_WorkDuration()); LOG_D("work_duration:%d", Flash_Get_WorkDuration());
Convert_To_Hex(&sever_info, sever_data); Convert_To_Hex(&sever_info, sever_data);

View File

@ -2,8 +2,8 @@
* @Author: mbw * @Author: mbw
* @Date: 2024-11-14 10:21:04 * @Date: 2024-11-14 10:21:04
* @LastEditors: mbw && 1600520629@qq.com * @LastEditors: mbw && 1600520629@qq.com
* @LastEditTime: 2025-01-08 11:27:49 * @LastEditTime: 2025-01-09 15:25:27
* @FilePath: \JT-DT-YD4N02A_RTT_MRS-4G\bsp\src\bsp_h308.c * @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\bsp\src\bsp_h308.c
* @Description: * @Description:
* *
* Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
@ -260,11 +260,11 @@ static void h308_thread_entry(void *param)
if (Flash_GetNum_Records(kRecordSensoEndOfLife) == 1) if (Flash_GetNum_Records(kRecordSensoEndOfLife) == 1)
{ {
H308.end_of_life = 1;
LOG_W("寿命已到期"); LOG_W("寿命已到期");
TotalRecords.sensor_failure++; H308.end_of_life = 1;
} }
//这里应该等下iot模组更新网络不然可能不准确但如果从未更新时截至日期小于1天才会有影响所以可不等待
rt_thread_mdelay(5000);//这里等的原因是等待4G更新网络其二是传感器需要10s的启动时间
// 寿命到期检测 // 寿命到期检测
if (IS_H308_EndOfLife()) if (IS_H308_EndOfLife())
{ {
@ -272,6 +272,7 @@ static void h308_thread_entry(void *param)
{ {
Flash_Write_Record(kRecordSensoEndOfLife); Flash_Write_Record(kRecordSensoEndOfLife);
} }
Send_Laser_Alarm_Event(kSensorFailureEvent);
} }
while (1) while (1)
{ {
@ -285,7 +286,7 @@ static void h308_thread_entry(void *param)
if (len >= 44) if (len >= 44)
{ {
ret = H308_GetFrameData(str, len, &H308.Data); ret = H308_GetFrameData(str, len, &H308.Data);
// LOG_I("str:[%s]", str); LOG_I("str:[%s]", str);
if (ret == 0) if (ret == 0)
{ {
H308_CheckData(); H308_CheckData();
@ -301,7 +302,6 @@ static void h308_thread_entry(void *param)
LOG_E("(len = %d) < 44, error data:[%s]", len, str); LOG_E("(len = %d) < 44, error data:[%s]", len, str);
if (h308_err_cnt >= 5) if (h308_err_cnt >= 5)
{ {
// LOG_E("h308_err_cnt:%d", h308_err_cnt);
H308_RST_ON; H308_RST_ON;
rt_thread_mdelay(100); rt_thread_mdelay(100);
H308_RST_OFF; H308_RST_OFF;
@ -309,7 +309,7 @@ static void h308_thread_entry(void *param)
h308_err_cnt = 0; h308_err_cnt = 0;
} }
} }
memset(str, 0, len); rt_memset(str, 0, len);
if (h308_rx_timout_cnt) if (h308_rx_timout_cnt)
{ {
@ -386,7 +386,7 @@ int BSP_H308_Init(void)
rt_pin_mode(H308_RST_PIN, PIN_MODE_OUTPUT); rt_pin_mode(H308_RST_PIN, PIN_MODE_OUTPUT);
H308_PWR_OFF; H308_PWR_OFF;
H308_RST_OFF; H308_RST_OFF;
// h308_mutex = rt_mutex_create("h308_mutex", RT_IPC_FLAG_PRIO);
uart4_rx_ok_sem = rt_sem_create("uart4_rx", 0, RT_IPC_FLAG_FIFO); uart4_rx_ok_sem = rt_sem_create("uart4_rx", 0, RT_IPC_FLAG_FIFO);
if (uart4_rx_ok_sem == RT_NULL) if (uart4_rx_ok_sem == RT_NULL)
{ {

View File

@ -2,7 +2,7 @@
* @Author: mbw * @Author: mbw
* @Date: 2024-10-09 08:42:14 * @Date: 2024-10-09 08:42:14
* @LastEditors: mbw && 1600520629@qq.com * @LastEditors: mbw && 1600520629@qq.com
* @LastEditTime: 2025-01-08 11:31:58 * @LastEditTime: 2025-01-09 09:39:59
* @FilePath: \JT-DT-YD4N02A_RTT_MRS-4G\bsp\src\bsp_nt26k.c * @FilePath: \JT-DT-YD4N02A_RTT_MRS-4G\bsp\src\bsp_nt26k.c
* @Description: * @Description:
* *
@ -36,7 +36,7 @@
#if IOT_MODULE_SWITCH == 1 #if IOT_MODULE_SWITCH == 1
#define NT26K_THREAD_STACK_SIZE (4096) #define NT26K_THREAD_STACK_SIZE (4096)
#define NT26K_RECV_THREAD_STACK_SIZE (4096) #define NT26K_RECV_THREAD_STACK_SIZE (4096)
#define NT26K_LIFE_THREAD_STACK_SIZE (1024) #define NT26K_LIFE_THREAD_STACK_SIZE (2048)
#define NT26K_THREAD_PRIORITY 25 #define NT26K_THREAD_PRIORITY 25
#define NT26K_THREAD_TICKS 50 #define NT26K_THREAD_TICKS 50
#define NT26K_RECV_THREAD_PRIORITY 24 #define NT26K_RECV_THREAD_PRIORITY 24
@ -66,6 +66,8 @@ static rt_timer_t nt26k_upload_timer; // 更新本地时间定时器
static rt_timer_t nt26k_power_error_timer; // 上电失败情况下启动定时器 static rt_timer_t nt26k_power_error_timer; // 上电失败情况下启动定时器
rt_uint8_t nt26k_conncet_tcp_flag; rt_uint8_t nt26k_conncet_tcp_flag;
rt_uint8_t nt26k_disconnect_pdp_flag; // PDP断开连接标志
Nt26kEventIndex nt26k_event_index; Nt26kEventIndex nt26k_event_index;
rt_uint8_t power_on_send_flag = 0; rt_uint8_t power_on_send_flag = 0;
@ -178,7 +180,6 @@ static void Nt26k_Ht_Timer_Cb(void *parameter)
Nt26k_Send_Event (kNt26kHeartbeatEvent); Nt26k_Send_Event (kNt26kHeartbeatEvent);
} }
// 定时器回调函数,当1分钟内没有数据交互时关闭tcp连接 // 定时器回调函数,当1分钟内没有数据交互时关闭tcp连接
static void Nt26k_Error_Timer_Cb (void *parameter) static void Nt26k_Error_Timer_Cb (void *parameter)
{ {
@ -292,6 +293,7 @@ int BSP_Nt26k_Init(struct Nt26k_Ops *ops, rt_uint8_t version)
return RT_EOK; return RT_EOK;
} }
// 更新函数 // 更新函数
int BSP_Nt26k_Update (struct Nt26k_Ops *ops, rt_uint8_t device_type, rt_uint8_t event_type) int BSP_Nt26k_Update (struct Nt26k_Ops *ops, rt_uint8_t device_type, rt_uint8_t event_type)
{ {
@ -730,6 +732,7 @@ int Nt26k_Send_Device_Failure(struct at_device *device, void *param)
} }
return RT_EOK; return RT_EOK;
} }
/*这个【4、优先级最低当同时触发后相同服务直接合并】暂时还没想好怎么做 /*这个【4、优先级最低当同时触发后相同服务直接合并】暂时还没想好怎么做
线 线
线 线
@ -749,7 +752,8 @@ const Nt26kEventInfo nt26k_event_info[] = {
{kNt26kExceptionEvent, NT26K_PRIORITY_LOWEST, "异常事件", Nt26k_Send_Exception }, {kNt26kExceptionEvent, NT26K_PRIORITY_LOWEST, "异常事件", Nt26k_Send_Exception },
{kNt26kValveStatusEvent, NT26K_PRIORITY_LOWEST, "电磁阀状态改变事件", Nt26k_Send_Valve_Status }, {kNt26kValveStatusEvent, NT26K_PRIORITY_LOWEST, "电磁阀状态改变事件", Nt26k_Send_Valve_Status },
{kNt26kFanStatusEvent, NT26K_PRIORITY_LOWEST, "风机状态改变事件", Nt26k_Send_Fan_Status }, {kNt26kFanStatusEvent, NT26K_PRIORITY_LOWEST, "风机状态改变事件", Nt26k_Send_Fan_Status },
{kNt26kDeviceFailureEvent, NT26K_PRIORITY_LOWEST, "设备失效事件", Nt26k_Send_Device_Failure}}; {kNt26kDeviceFailureEvent, NT26K_PRIORITY_LOWEST, "设备失效事件", Nt26k_Send_Device_Failure }
};
/** /**
* NT26K设备的事件 * NT26K设备的事件
@ -1201,8 +1205,6 @@ static void Nt26k_Send_Thread_Entry(void *param)
{ {
LOG_D ("nt26k init success\n"); LOG_D ("nt26k init success\n");
rt_completion_wait (&nt26k_init_complate, RT_WAITING_FOREVER); // wait for nt26k init finish rt_completion_wait (&nt26k_init_complate, RT_WAITING_FOREVER); // wait for nt26k init finish
Nt26k_Send_Event(kNt26kTimeCalibrationEvent); // 上电网络连接成功时,更新下时间
rt_timer_start(nt26k_upload_timer);
Nt26k_Send_Event (kNt26kPowerOnEvent); Nt26k_Send_Event (kNt26kPowerOnEvent);
} }
while (1) while (1)
@ -1228,20 +1230,6 @@ static void Nt26k_Send_Thread_Entry(void *param)
RT_WAITING_FOREVER, &nt26k_recv_event); // 这个事件一般是设备端发生了变化,发送到服务器时调用 RT_WAITING_FOREVER, &nt26k_recv_event); // 这个事件一般是设备端发生了变化,发送到服务器时调用
if (result == RT_EOK) if (result == RT_EOK)
{
LOG_D("nt26k recv event OK\n");
if (nt26k_conncet_tcp_flag != 1)
{
if (device->class->device_ops->control(device, AT_DEVICE_CTRL_NET_CONN, RT_NULL) == RT_EOK) // 打开连接
{
LOG_D("nt26k connect tcp success\n");
}
else
{
LOG_E("nt26k connect tcp failed\n");
}
}
if (nt26k_conncet_tcp_flag)
{ {
if (nt26k_recv_event & Nt26k_Get_Event_Flag (kNt26kPowerOnEvent)) if (nt26k_recv_event & Nt26k_Get_Event_Flag (kNt26kPowerOnEvent))
{ {
@ -1255,6 +1243,8 @@ static void Nt26k_Send_Thread_Entry(void *param)
else else
{ {
rt_timer_start (nt26k_timer); // 当上电心跳包发送成功时, 开始心跳包周期发送 rt_timer_start (nt26k_timer); // 当上电心跳包发送成功时, 开始心跳包周期发送
rt_timer_start (nt26k_upload_timer); // 周期修改时间更新
power_on_send_flag = 1; power_on_send_flag = 1;
} }
} }
@ -1357,12 +1347,12 @@ static void Nt26k_Send_Thread_Entry(void *param)
} }
else if (nt26k_recv_event & Nt26k_Get_Event_Flag (kNt26kPowerDownEvent)) else if (nt26k_recv_event & Nt26k_Get_Event_Flag (kNt26kPowerDownEvent))
{ {
nt26k_event_initialized = RT_FALSE; // 当接收到掉电事件时,发送完成后删除事件,不再接收其他事件
result = Nt26k_Process_Events (kNt26kPowerDownEvent, device, ops); result = Nt26k_Process_Events (kNt26kPowerDownEvent, device, ops);
if (result) if (result)
{ {
LOG_E ("nt26k send data failed result = [%d]\n", result); LOG_E ("nt26k send data failed result = [%d]\n", result);
} }
nt26k_event_initialized = RT_FALSE; // 当接收到掉电事件时,发送完成后删除事件,不再接收其他事件
} }
else if (nt26k_recv_event & Nt26k_Get_Event_Flag (kNt26kDeviceFailureEvent)) else if (nt26k_recv_event & Nt26k_Get_Event_Flag (kNt26kDeviceFailureEvent))
{ {
@ -1373,8 +1363,6 @@ static void Nt26k_Send_Thread_Entry(void *param)
} }
} }
} }
rt_thread_mdelay(1); // 释放下线程
}
} }
} }
} }
@ -1414,7 +1402,45 @@ static void Nt26k_Life_Thread_Entry(void *parameter)
if (!nt26k_conncet_tcp_flag) if (!nt26k_conncet_tcp_flag)
{ {
LOG_D ("重连网络中...\n"); LOG_D ("重连网络中...\n");
device->class->device_ops->control(device, AT_DEVICE_CTRL_NET_DISCONN, RT_NULL);//先关闭,再处理 at_response_t resp = at_create_resp (64, 0, 5000);
if (resp == RT_NULL)
{
LOG_E ("No memory for response structure!");
at_delete_resp (resp);
}
if (device->class->device_ops->control (device, AT_DEVICE_CTRL_POWER_OFF, RT_NULL) == RT_EOK)
{
LOG_D("AT device power off success");
rt_thread_mdelay(1000);
if (device->class->device_ops->control (device, AT_DEVICE_CTRL_POWER_ON, RT_NULL) == RT_EOK)
{
LOG_D("AT device power on success");
rt_thread_mdelay(1000);
/* disable echo */
at_obj_exec_cmd(device->client, resp, "ATE0");
/*AT+QICFG="dataformat" 设置收发模式*/
if (at_obj_exec_cmd (device->client, resp, "AT+QICFG=\"dataformat\",%d,%d", AT_NSONMI_MODE_DEFAULT, AT_NSONMI_MODE_DEFAULT) != RT_EOK)
{
LOG_E ("AT+QICFG=\"dataformat\" error\n");
}
/*设置显示模式*/
if (at_obj_exec_cmd (device->client, resp, "AT+QICFG=\"viewmode\",1") != RT_EOK)
{
LOG_E ("AT+QICFG=\"viewmode\" error\n");
}
/*设置保活信息*/
if (at_obj_exec_cmd (device->client, resp, "AT+QICFG=\"tcp/keepalive\",1,1800,100,3") != RT_EOK)
{
LOG_E ("AT+QICFG=\"tcp/keepalive\" error\n");
}
if (at_obj_exec_cmd (device->client, resp, "AT+QICFG=\"passiveclosed\",1") != RT_EOK)
{
LOG_E ("AT+QICFG=\"passiveclosed\" error\n");
}
if (at_obj_exec_cmd (device->client, resp, "AT+CGACT=1,1") != RT_EOK)
{
LOG_E ("AT+CGACT=1,1 error\n");
}
if (device->class->device_ops->control (device, AT_DEVICE_CTRL_NET_CONN, RT_NULL) == RT_EOK) if (device->class->device_ops->control (device, AT_DEVICE_CTRL_NET_CONN, RT_NULL) == RT_EOK)
{ {
LOG_D ("重连网络成功\n"); LOG_D ("重连网络成功\n");
@ -1426,6 +1452,9 @@ static void Nt26k_Life_Thread_Entry(void *parameter)
rt_thread_mdelay (10000); rt_thread_mdelay (10000);
rt_sem_release (nt26k_disconnect_sem); rt_sem_release (nt26k_disconnect_sem);
} }
at_delete_resp (resp);
}
}
} }
} }
} }
@ -1516,6 +1545,7 @@ int BSP_Nt26k_Thread_Init(void)
return ret; return ret;
} }
// INIT_APP_EXPORT(BSP_Nt26k_Thread_Init); // INIT_APP_EXPORT(BSP_Nt26k_Thread_Init);
int nt26k_device_register (void) int nt26k_device_register (void)
@ -1528,6 +1558,7 @@ int nt26k_device_register(void)
AT_DEVICE_CLASS_NT26K, AT_DEVICE_CLASS_NT26K,
(void *)nt26k); (void *)nt26k);
} }
// INIT_COMPONENT_EXPORT(nt26k_device_register); // INIT_COMPONENT_EXPORT(nt26k_device_register);
#endif // IOT_MODULE_SWITCH #endif // IOT_MODULE_SWITCH

View File

@ -287,8 +287,8 @@ static uint8_t RTC_FirstInit(void)
RTC_SetPrescaler(32767); RTC_SetPrescaler(32767);
RTC_WaitForLastTask(); RTC_WaitForLastTask();
// RTC_SetTime(2024, 9, 5, 0, 0, 0); //设置出厂日期 RTC_SetTime(2025, 1, 8, 12, 0, 0); //设置出厂日期
// RTC_WaitForLastTask(); RTC_WaitForLastTask();
// //
// RTC_SetAlarm(20 + RTC_GetCounter()); //闹钟值设定为当前时间的10秒后 // RTC_SetAlarm(20 + RTC_GetCounter()); //闹钟值设定为当前时间的10秒后
// RTC_WaitForLastTask(); // RTC_WaitForLastTask();
@ -324,7 +324,6 @@ int BSP_RTC_Init(void)
/* Is it the first configuration */ /* Is it the first configuration */
if (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET || BKP_ReadBackupRegister(BKP_DR1) != RTC_FIRST_INIT_VALUE) if (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET || BKP_ReadBackupRegister(BKP_DR1) != RTC_FIRST_INIT_VALUE)
{ {
LOG_W("RTC hasn't been configured, please use [RTC_Cfg_Time] to config.");
RTC_FirstInit(); RTC_FirstInit();
} }
else else