From d11e20b2e873a3d22c81b6f58538efb7eeca38c1 Mon Sep 17 00:00:00 2001 From: stark1898y <1658608470@qq.com> Date: Thu, 23 Jan 2025 17:09:24 +0800 Subject: [PATCH] ok --- applications/main.c | 7 ++++++- bsp/src/bsp_vin_detection.c | 2 +- rt-thread/rtconfig.h | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/applications/main.c b/applications/main.c index 94ea7bc..ede30e5 100644 --- a/applications/main.c +++ b/applications/main.c @@ -191,7 +191,10 @@ int main(void) rt_err_t result = RT_EINVAL; rt_uint32_t received_event; + // 等待系统初始化完成 BSP_ADC_Init(); + rt_thread_mdelay(500); + // 等一下再读电压 if (Get_VIN_VoltageInt1000x() > 10000) { @@ -238,10 +241,11 @@ int main(void) } else { - LOG_D("欠压复位\r\n"); + rt_kprintf("欠压复位\r\n"); RCC_ClearFlag(); NVIC_SystemReset(); // 直接重启系统 } +#if 1 BSP_VIN_Detection_Init(); // IWDG_Feed(); @@ -486,6 +490,7 @@ int main(void) // IWDG_Feed(); } } +#endif } #ifdef TEST_ENABLE diff --git a/bsp/src/bsp_vin_detection.c b/bsp/src/bsp_vin_detection.c index b3902b2..620ba76 100644 --- a/bsp/src/bsp_vin_detection.c +++ b/bsp/src/bsp_vin_detection.c @@ -48,7 +48,7 @@ uint16_t Get_VIN_VoltageInt1000x(void) { uint16_t voltage = (Get_ADC_Average(kVinAdc) * 3.3 / 4096) * VIN_VOLTAGE_RATIO * 1000; - // LOG_D("Get_VIN_VoltageInt1000x = %04d", voltage); + LOG_D("Get_VIN_VoltageInt1000x = %04d", voltage); return voltage; } #ifdef FINSH_USING_MSH diff --git a/rt-thread/rtconfig.h b/rt-thread/rtconfig.h index 54fac1c..c0740bd 100644 --- a/rt-thread/rtconfig.h +++ b/rt-thread/rtconfig.h @@ -2,7 +2,7 @@ * @Author : stark1898y 1658608470@qq.com * @Date : 2024-07-19 13:49:43 * @LastEditors : stark1898y 1658608470@qq.com - * @LastEditTime : 2025-01-23 16:34:01 + * @LastEditTime : 2025-01-23 16:55:55 * @FilePath : \JT-DT-YD4N02A_4G_RTT_MRS\rt-thread\rtconfig.h * @Description : * @@ -16,7 +16,7 @@ /*使用动态日志及密码功能时,需开启宏 FINSH_USING_AUTH ULOG_USING_FILTER ENABLE_LOG_ALL ULOG_OUTPUT_LVL = 7 以及设置ulog.c 1522行 输出等级为0*/ /**/ #define FINSH_USING_AUTH //开启终端密码登录功能 -// #define ULOG_USING_FILTER //开启动态修改日志等级 默认修改在ulog.c 1522行 +#define ULOG_USING_FILTER //开启动态修改日志等级 默认修改在ulog.c 1522行 #define ENABLE_LOG_ALL #define TEST_ENABLE //打开所有的终端测试程序