This commit is contained in:
stark1898y 2025-01-23 17:09:24 +08:00
parent 6be71e0733
commit d11e20b2e8
3 changed files with 9 additions and 4 deletions

View File

@ -191,7 +191,10 @@ int main(void)
rt_err_t result = RT_EINVAL; rt_err_t result = RT_EINVAL;
rt_uint32_t received_event; rt_uint32_t received_event;
// 等待系统初始化完成
BSP_ADC_Init(); BSP_ADC_Init();
rt_thread_mdelay(500);
// 等一下再读电压
if (Get_VIN_VoltageInt1000x() > 10000) if (Get_VIN_VoltageInt1000x() > 10000)
{ {
@ -238,10 +241,11 @@ int main(void)
} }
else else
{ {
LOG_D("欠压复位\r\n"); rt_kprintf("欠压复位\r\n");
RCC_ClearFlag(); RCC_ClearFlag();
NVIC_SystemReset(); // 直接重启系统 NVIC_SystemReset(); // 直接重启系统
} }
#if 1
BSP_VIN_Detection_Init(); BSP_VIN_Detection_Init();
// IWDG_Feed(); // IWDG_Feed();
@ -486,6 +490,7 @@ int main(void)
// IWDG_Feed(); // IWDG_Feed();
} }
} }
#endif
} }
#ifdef TEST_ENABLE #ifdef TEST_ENABLE

View File

@ -48,7 +48,7 @@ uint16_t Get_VIN_VoltageInt1000x(void)
{ {
uint16_t voltage = (Get_ADC_Average(kVinAdc) * 3.3 / 4096) * VIN_VOLTAGE_RATIO * 1000; 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; return voltage;
} }
#ifdef FINSH_USING_MSH #ifdef FINSH_USING_MSH

View File

@ -2,7 +2,7 @@
* @Author : stark1898y 1658608470@qq.com * @Author : stark1898y 1658608470@qq.com
* @Date : 2024-07-19 13:49:43 * @Date : 2024-07-19 13:49:43
* @LastEditors : stark1898y 1658608470@qq.com * @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 * @FilePath : \JT-DT-YD4N02A_4G_RTT_MRS\rt-thread\rtconfig.h
* @Description : * @Description :
* *
@ -16,7 +16,7 @@
/*使用动态日志及密码功能时,需开启宏 FINSH_USING_AUTH ULOG_USING_FILTER ENABLE_LOG_ALL ULOG_OUTPUT_LVL = 7 以及设置ulog.c 1522行 输出等级为0*/ /*使用动态日志及密码功能时,需开启宏 FINSH_USING_AUTH ULOG_USING_FILTER ENABLE_LOG_ALL ULOG_OUTPUT_LVL = 7 以及设置ulog.c 1522行 输出等级为0*/
/**/ /**/
#define FINSH_USING_AUTH //开启终端密码登录功能 #define FINSH_USING_AUTH //开启终端密码登录功能
// #define ULOG_USING_FILTER //开启动态修改日志等级 默认修改在ulog.c 1522行 #define ULOG_USING_FILTER //开启动态修改日志等级 默认修改在ulog.c 1522行
#define ENABLE_LOG_ALL #define ENABLE_LOG_ALL
#define TEST_ENABLE //打开所有的终端测试程序 #define TEST_ENABLE //打开所有的终端测试程序