From f9a7514dbb14628b5caba76be951db2b55b1050b Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期四, 29 二月 2024 14:19:35 +0800 Subject: [PATCH] 去掉UWB功率写死0,和增加UWB读取回复的delay时间 --- Src/OnChipDevices/ADC.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Src/OnChipDevices/ADC.c b/Src/OnChipDevices/ADC.c index 26863f4..cfdf1c0 100644 --- a/Src/OnChipDevices/ADC.c +++ b/Src/OnChipDevices/ADC.c @@ -40,15 +40,16 @@ { static float last_value = 100; static uint8_t first=1; static uint16_t bat_count = 0; - if(bat_count++%600==0) - { +// if(bat_count++%600==0) +// { READC_Init(); - HAL_Delay(30); + Delay_Ms(10); + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_SET); adc_val = Get_ADC_Value(); MX_ADC_DeInit(); - //temp_voltage = (float)Get_ADC_Value()/621; //(value/4096*3.3*2-3.5)/0.7 + //temp_voltage = (float)Get_ADC_Value()/621; //(value/4096*3.3*2-3.5)/0.7 verfint_cal = *(__IO uint16_t *)(0X1FF80078); - bat_volt = 3*(float)verfint_cal/adc_val-0.329; + bat_volt = 3*(float)verfint_cal/adc_val-0.28; if(bat_volt>=3.0) { if(first) @@ -64,6 +65,8 @@ }else{ last_value=0; } -} + printf("VCC:%.2f\r\n",bat_volt); + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET); +//} return last_value; } \ No newline at end of file -- Gitblit v1.9.3