diff --git a/applications/main.c b/applications/main.c index ef37a15..f1db9cc 100644 --- a/applications/main.c +++ b/applications/main.c @@ -2,7 +2,7 @@ * @Author: mbw * @Date: 2024-10-23 17:14:16 * @LastEditors: mbw && 1600520629@qq.com - * @LastEditTime: 2025-01-18 11:21:57 + * @LastEditTime: 2025-01-18 12:05:52 * @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\applications\main.c * @Descrt_thread_ * @@ -421,26 +421,20 @@ int main (void) Nt26k_Send_Event (kNt26kPowerDownEvent); #endif rt_uint8_t cnt = 0; - while ((device_power_down_flag == 0)&&(cnt < 60))//等待接收到掉电事件响应 + while ((device_power_down_flag == 0)&&(cnt < 10))//等待接收到掉电事件响应 { rt_thread_mdelay(500); + LOG_D("cnt1 = %d", cnt); + cnt++; } cnt = 0; - while ((nt26k_power_down_flag == 0)&&(cnt < 60))//等待接收到物联网模组关机完成 + while ((nt26k_power_down_flag == 0)&&(cnt < 10))//等待接收到物联网模组关机完成 { - rt_thread_mdelay(500); - } - while(1) - { - if (Get_VIN_VoltageInt1000x() > 10000) - { - NVIC_SystemReset(); // 直接重启系统 - } - else - { - rt_thread_mdelay(500); - } + rt_thread_mdelay(500); + LOG_D("cnt2 = %d", cnt); + cnt++; } + NVIC_SystemReset(); // 直接重启系统 } else if (received_event & Get_Sys_Event_Flag (kSelfCheckEvent)) // 自检 { diff --git a/applications/user_sys.c b/applications/user_sys.c index 97dbd2a..690d3cc 100644 --- a/applications/user_sys.c +++ b/applications/user_sys.c @@ -253,9 +253,9 @@ rt_uint32_t IMEI_Delay(void) int BSP_SYS_Init(void) { + BSP_WDG_Init(); BSP_RTC_Init(); BSP_Rng_Init(); - BSP_WDG_Init(); BSP_LED_Init(); BSP_RELAY_Init(); BSP_BEEP_Init(); diff --git a/bsp/src/bsp_nt26k.c b/bsp/src/bsp_nt26k.c index 2d901f1..8725039 100644 --- a/bsp/src/bsp_nt26k.c +++ b/bsp/src/bsp_nt26k.c @@ -2,7 +2,7 @@ * @Author: mbw * @Date: 2024-10-09 08:42:14 * @LastEditors: mbw && 1600520629@qq.com - * @LastEditTime: 2025-01-18 11:29:56 + * @LastEditTime: 2025-01-18 12:07:08 * @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\bsp\src\bsp_nt26k.c * @Description: * @@ -906,7 +906,7 @@ void Handle_Server_Reply(struct Nt26k_Ops *ops) { LOG_D("nt26k send data success\n"); } - else if (ops->recv->recv_data.event_type == EVENT_TYPE_DEVICE_FAILURE)//是掉电事件回应 + else if (ops->recv->recv_data.event_type == EVENT_TYPE_POWER_OFF)//是掉电事件回应 { device_power_down_flag = 1; } diff --git a/bsp/src/bsp_wdg.c b/bsp/src/bsp_wdg.c index d8966db..03ac3d0 100644 --- a/bsp/src/bsp_wdg.c +++ b/bsp/src/bsp_wdg.c @@ -149,6 +149,7 @@ int BSP_WDG_Init(void) // WWDG counter clock = (PCLK1 / 4096) / 8 = (SystemCoreClock(96MHz) / 2) / 4096 / 8 ~= 1464 Hz WWDG_Init(WWDG_Prescaler_8, 80, WWDG_CNT); #endif + IWDG_Feed(); // /* 设置空闲线程钩子函数 */ // return rt_thread_idle_sethook(BSP_WDG_Loop); if (RT_EOK == rt_thread_init(&wdg_thread,