Repository navigation
rak4631: cut the serial GPS power with WB_IO2 (opt-in, NMEA path only) - #2
Merged
fdlamotte merged 1 commit intoNov 8, 2026
Merged
Conversation
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. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@fdlamotte, as asked on meshcore-dev#3753.
On a RAK19007 base, the RAK12501's power comes from 3V3_S, which
WB_IO2switches. This passesWB_IO2to the serialdriver as
peripheralPower, sogps off, periodic mode andshutdowncut it. It's opt-in, through a newRAK_4631_repeater_gps_powerenv that setsGPS_RAIL_POWER_CONTROL, because the same rail powers every other slot module.variants/rak4631/target.cpp: underGPS_RAIL_POWER_CONTROL, aRefCountedDigitalPinonWB_IO2goes toRakLocationProvider.Builds with
ETHERNET_ENABLEDstop with an error, since the RAK13800 is powered the same way.RakLocationProvider: an optionalserialPowerargument, passed toNmeaGpsDriver. I2C: the RAK12500 driver already switchesits own power pin, so this is used on the NMEA path only. If the RAK12500 is found, the serial driver's claim from
detect()stays, so the rail behaves as it does without the flag.
RefCountedDigitalPin:claim()andrelease()now also set the pin as an output. Measured on this board:WB_IO2left as aninput keeps 3V3_S in its last state, and
probeRak12500()leaves it as an input after a failed probe. Without this, the releasewrites the output latch only and the rail stays on.
variants/rak4631/platformio.ini: the new env.Tested
RAK WisMesh Repeater Mini v2 (RAK4631, RAK19007, RAK12501 serial L76K, no other slot modules),
RAK_4631_repeater_gps_powerbuilton
2ed19734. ChargerLAB KM003C in line on USB at about 5.11 to 5.13 V, battery and panel disconnected, medians over 20 s ormeans over 3 to 15 s between radio peaks.
gps_refactorat0388403bgps offsavedgps ongps off, 4 togglesgps period 60, whilewaitingttf:7s/1m ok:7 miss:0shutdownAlso: a fix about 1 min after
gps onthat set the clock,gps oncefromgps off(fix, then back tooff), and a rebootwith
gps offsaved (11.9 mA once booted).Not tested: a RAK12500 (I2C), which I don't have. The stock
RAK_4631_repeaterandRAK_4631_repeater_ethernetenvs still build.Who did what: I worked on this with Claude Code. I set the requirements, ran the bench and flashed the builds. Claude wrote the
patch, ran the commands and meter readings, and drafted this text, which I reviewed before posting.
🤖 Generated with Claude Code