From 48db6523fb3980fa6606174109eeeafbba957380 Mon Sep 17 00:00:00 2001 From: zouhaitao Date: Wed, 29 Jul 2026 10:04:00 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E5=A2=9E=E5=8A=A0=20KEY=5FSOS=20?= =?UTF-8?q?=E7=89=A9=E7=90=86=E6=8C=89=E9=94=AE=E5=BC=80=E6=9C=BA=E8=87=AA?= =?UTF-8?q?=E6=A3=80=E4=B8=8E=E8=BF=90=E8=A1=8C=E6=9C=9F=E7=94=B5=E5=B9=B3?= =?UTF-8?q?=E8=B7=B3=E5=8F=98=E4=B8=B2=E5=8F=A3=E8=B0=83=E8=AF=95=E6=89=93?= =?UTF-8?q?=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/event.c | 13 +++++++++++++ App/system.c | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/App/event.c b/App/event.c index ba37f39..2247f5f 100644 --- a/App/event.c +++ b/App/event.c @@ -196,6 +196,19 @@ void Event_KeyScan_Poll(void) u8 raw_sos = !KEY_SOS; // 恢复 SOS 物理按键电平检测 key_scan_timer = 0; // 重置扫描分频计数器 + // 【SOS 按键电平实时诊断】 + { + static u8 last_raw_sos = 99; + if (raw_sos != last_raw_sos) { + last_raw_sos = raw_sos; + Uart_SendString("[KEY-DIAG] KEY_SOS (P2.6) logic raw: "); + Uart_SendByte(raw_sos ? '1' : '0'); + Uart_SendString(", Physical GPIO Pin: "); + Uart_SendByte(KEY_SOS ? '1' : '0'); + Uart_SendString("\r\n"); + } + } + // 按键调试诊断:若按键 ADC 值有变化或处于高电平,串口输出真实 ADC 值 { u16 down_val = ADC_ReadFiltered(ADC_CHANNEL_KEY_DOWN); diff --git a/App/system.c b/App/system.c index 492e4ed..3b2abbf 100644 --- a/App/system.c +++ b/App/system.c @@ -212,6 +212,11 @@ void Self_Test(void) Uart_SendByte((u8)('0' + (key_down_adc % 10))); Uart_SendString(" [OK]\r\n"); + // 2.2 检测 KEY_SOS (P2.6) 物理电平常态 + Uart_SendString("[SELF-TEST] KEY_SOS (P2.6) Pin Level: "); + Uart_SendByte((u8)(KEY_SOS ? '1' : '0')); + Uart_SendString("\r\n"); + // 3. 检查 P1.3 电池电压检测与百分比 vbat_mv = ADC_GetBatteryVoltage_mV(); percent = ADC_GetBatteryPercent();