From fcea931aebdfe96ca30c0e0c1d6bd586fe1efa79 Mon Sep 17 00:00:00 2001 From: Andrew Yong Date: Thu, 9 Jul 2026 00:10:23 +0800 Subject: [PATCH] fix(nrf52): enable USB/charge detection on Seeed Wio Tracker L1 (#10941) isCharging()/getHasUSB() were hard-compiled to always return false on this board: the nrfx_power_usbstatus_get() block in Power.cpp that derives them is gated behind #ifdef NRF_APM, and this board's variant.h never defined it - unlike tracker-t1000-e and wio-tracker-wm1110, which do. Confirmed on hardware: before this change, `Battery: usbPower=0, isCharging=0` regardless of actual USB/charge state; after, `usbPower=1, isCharging=1` while genuinely on USB power with a battery attached. Same underlying gap as #4367, fixed for tracker-t1000-e and wio-tracker-wm1110 in #4376 (which also fixed a deeper bug where PowerStatus notifications were gated behind a battery-level null check - that part is already fixed generically in Power.cpp today, so this board only needed the define). Looks like a simple oversight from when this board was added, since it's newer than the two boards #4376 touched. Assisted-by: Claude Sonnet 5 Signed-off-by: Andrew Yong --- variants/nrf52840/seeed_wio_tracker_L1/variant.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/nrf52840/seeed_wio_tracker_L1/variant.h b/variants/nrf52840/seeed_wio_tracker_L1/variant.h index eee4c2333..9e1df0fa3 100644 --- a/variants/nrf52840/seeed_wio_tracker_L1/variant.h +++ b/variants/nrf52840/seeed_wio_tracker_L1/variant.h @@ -112,6 +112,8 @@ static const uint8_t SCL = PIN_WIRE_SCL; #define ADC_MULTIPLIER 2.0 #define BATTERY_PIN PIN_VBAT // PIN_A7 #define AREF_VOLTAGE 3.6 +// We rely on the nrf52840 USB controller to tell us if we are hooked to a power supply +#define NRF_APM // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // GPS L76KB // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━