rak4631: let the serial GPS switch the WB_IO2 rail (opt-in)

On a RAK19007 the RAK12501's supply is 3V3_S, switched by WB_IO2, so
gps off, periodic mode and shutdown left it powered. Pass WB_IO2 to the
NMEA driver as peripheralPower under GPS_RAIL_POWER_CONTROL, set by the
new RAK_4631_repeater_gps_power env. It is opt-in because the rail feeds
every slot module, and refused with ETHERNET_ENABLED (RAK13800).

The RAK12500 (I2C) driver keeps switching its own power pin, so this
only applies on the NMEA path.

RefCountedDigitalPin now sets OUTPUT on claim and release: WB_IO2 left
as an input (as probeRak12500() leaves it after a failed probe) keeps
3V3_S in its last state, so writing the latch alone did not cut it.

Measured with a KM003C, battery and panel out: gps off 40.5 -> 12.4 mA,
shutdown 29.7 -> 1.30 mA.
This commit is contained in:
Martin Boissonneault authored and Florent committed 2026-11-08 08:47:35 -04:00
1 parent b2e46335e5
commit 017005d1cf
4 files changed
+27 -2

No files matched your search

+8
View File
@@ -55,6 +55,14 @@ build_src_filter = ${rak4631.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<../examples/simple_repeater>
; Lets `gps off`, periodic mode and shutdown cut the power to a serial GPS (RAK12501).
; WB_IO2 switches the shared 3V3_S slot rail, so this also powers down any other slot module.
[env:RAK_4631_repeater_gps_power]
extends = env:RAK_4631_repeater
build_flags =
${env:RAK_4631_repeater.build_flags}
-D GPS_RAIL_POWER_CONTROL
[env:RAK_4631_repeater_ethernet]
extends = rak4631
build_flags =
+9
View File
@@ -27,7 +27,16 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
#if ENV_INCLUDE_GPS
#include <helpers/sensors/RakLocationProvider.h>
RakI2cGpsDriver gps_driver;
#ifdef GPS_RAIL_POWER_CONTROL
#ifdef ETHERNET_ENABLED
#error "GPS_RAIL_POWER_CONTROL would cut the RAK13800's power, which also comes from WB_IO2"
#endif
// WB_IO2 switches 3V3_S, which powers the serial GPS and every other slot module.
RefCountedDigitalPin gps_rail(WB_IO2);
RakLocationProvider location(gps_driver, &rtc_clock, Serial1, &gps_rail);
#else
RakLocationProvider location(gps_driver, &rtc_clock);
#endif
EnvironmentSensorManager sensors(location);
#else
EnvironmentSensorManager sensors;