优化了掉电重启机制
This commit is contained in:
parent
5a3d63c5a0
commit
e8d6cdc068
|
@ -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,27 +421,21 @@ 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);
|
||||
LOG_D("cnt2 = %d", cnt);
|
||||
cnt++;
|
||||
}
|
||||
while(1)
|
||||
{
|
||||
if (Get_VIN_VoltageInt1000x() > 10000)
|
||||
{
|
||||
NVIC_SystemReset(); // 直接重启系统
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_thread_mdelay(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (received_event & Get_Sys_Event_Flag (kSelfCheckEvent)) // 自检
|
||||
{
|
||||
LOG_D ("自检模式");
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue