Add per-message TX power penalty (whisper)#10417
Open
adrianpanicek wants to merge 4 commits into
Open
Conversation
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.
Summary
Adds a per-packet TX power penalty so the originating device can drop its TX power for a single message. Lets a sender talk to nearby nodes without raising the noise floor for the wider mesh. Local-only; relays and rebroadcasts ignore it.
Depends on
meshtastic/protobufs#912 — adds the
MeshPacket.tx_power_penalty_dbfield. The submodule pointer in this PR references the commit on that branch; please merge the proto PR first, then I'll bump the submodule SHA before this can merge.Change
setTransmitPower(int)virtual onRadioInterface, with overrides for SX126x, SX128x, LR11x0, RF95. Each clamps to the configuredpoweras the upper bound and the chip's documented minimum as the lower bound, logging a warning when either clamp fires.RadioInterface::applyTxPowerPenalty()runs in the send path: iftx_power_penalty_db > 0and the local node originated the packet, the chip is set topower - penaltybefore TX. Restored to configured power inRadioLibInterface::completeSending()once the chip is back in standby.uint8_tviamesh.options int_size:8.test/test_radiocover the penalty math, the originator gate, the upper-bound clamp, and underflow safety on negative configured power.Hardware validation
Tested on two SX1262 + nRF52840 boards: LilyGo T-Echo and RAK WisBlock 4631. Same behavior on both.
A regular
sendTextproduces noWhisper:log and TX uses configured power. A secondsendTextwithtx_power_penalty_db = 10(injected via raw protobuf field 22) produces:Configured power on each device was 22 dBm, so 22 - 10 = 12 dBm matches the expected target.
Checks
pio run -e heltec-v3(SX1262 + SX128x + LR11x0 templates)pio run -e heltec-v1(RF95)pio run -e t-echo-inkhud -t uploadthen on-device verification (above)pio test -e native -f test_radio(18/18 passing, 6 new whisper tests)🤝 Attestations
Reasoning
The functionality is prerequisite for my advanced routing technique. The target is to get a multiple "no-retransmit" nodes to talk to a leader node with minimal TX power. This leader node would be responsible for retransmitting all it's child nodes positions, therefore reducing congestion and allowing large number of nodes in this quasi-tree structure.
It's a first step to allow me to implement a mesh network for large search parties or large open field cleaning jobs.