From ae079c1fc5d990ba55714d4b3a51b19f96edaec4 Mon Sep 17 00:00:00 2001
From: WXK <287788329@qq.com>
Date: 星期四, 24 四月 2025 16:01:43 +0800
Subject: [PATCH] 改为中断来低电平触发发送当前扫描数据,3s内扫描不到的会退出,串口来55 AA 75 70 64 61 74 65,进入升级模式

---
 01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/src/pan_adc.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/src/pan_adc.c b/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/src/pan_adc.c
index 73eafc7..d79ceb5 100644
--- a/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/src/pan_adc.c
+++ b/01_SDK/modules/hal/panchip/panplat/pan1070/bsp/peripheral/src/pan_adc.c
@@ -304,7 +304,7 @@
     uint32_t u32TempReg = 0;
     float temp_param_k = (m_adc_opt.chip_info >= 0x20) ? (m_adc_opt.ft_version >= 6 ? m_adc_opt.adc_temp_k : 0.35) : -0.69; // t = k * (v - vFT) + tFT
     float voltage = 0;
-    float temp_voltage_arr[128];
+    float temp_voltage_arr[32];
 
     // Enable ADC channel 9
     ADC_Open(ADCx, ADC_CHEN_CH9_TMP_Msk);
@@ -328,7 +328,7 @@
     }
 
     // Start sampling
-    for (int i = 0; i < 128; i++) {
+    for (int i = 0; i < 32; i++) {
         ADC_StartConvert(ADCx);
         // Wait for sampling done
         while (!ADC_IsDataValid(ADCx)) {
@@ -342,11 +342,11 @@
     ADC_PowerDown(ADCx);
 
     // Filter out largest 8 and smallest 8 data and calculate average value
-    bubble_sort_float(temp_voltage_arr, 128);
-    for (int i = 8; i < 120; i++) {
+    bubble_sort_float(temp_voltage_arr, 32);
+    for (int i = 4; i < 28; i++) {
         voltage += temp_voltage_arr[i];
     }
-    voltage /= 112;
+    voltage /= 24;
 
     // Calculate and return current temp by formula: t = k * (v - vFT) + tFT - tDelta
     return temp_param_k * (voltage - (double)m_adc_opt.adc_temp_volt / 10.0) + (double)m_adc_opt.current_temp_value / 100.0

--
Gitblit v1.9.3