From 7c4c63883e0ea30de527dba16b099c13642ef208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=90=83=E6=B2=B9=E7=82=B8=E9=B8=A1?= <1425962791@qq.com> Date: Thu, 19 Feb 2026 12:48:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=AF=B9=E7=94=B5=E5=8E=8B?= =?UTF-8?q?=E9=87=87=E6=A0=B7=E7=94=B5=E9=98=BB=E6=89=80=E5=B8=A6=E6=9D=A5?= =?UTF-8?q?=E7=94=B5=E6=B5=81=E8=AF=AF=E5=B7=AE=E7=9A=84=E6=A0=A1=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Power_Pico/Core/Src/adc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Power_Pico/Core/Src/adc.c b/Power_Pico/Core/Src/adc.c index 1f7599c..60994e1 100644 --- a/Power_Pico/Core/Src/adc.c +++ b/Power_Pico/Core/Src/adc.c @@ -240,9 +240,16 @@ static void Data_Monitor_Update(uint16_t vol_adc, uint16_t cur_adc, uint16_t ref break; } - // 3. 累加数据 (此函数在中断上下文中被调用,Data_Monitor_Get_Values会处理中断保护) + // 3. 计算电压引入的误差电流 (单位: 10nA) + float error_current_10na = voltage_mv / 11.0f; + + // 4. 计算最终校正后的电流 + // 注意:误差电流是正的,所以要从测量值中减去 + float final_current_10na = current_10na - error_current_10na; + + // 5. 累加数据 (此函数在中断上下文中被调用,Data_Monitor_Get_Values会处理中断保护) g_data_monitor.sum_vol_mv += (uint64_t)voltage_mv; - g_data_monitor.sum_cur_resolution_10na += current_10na; + g_data_monitor.sum_cur_resolution_10na += final_current_10na; g_data_monitor.count++; }