-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix(radio): floor Tx power at the radio minimum in limitPower() #11634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wormuz
wants to merge
2
commits into
meshtastic:develop
Choose a base branch
from
wormuz:fix/tx-power-floor
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 50378
🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 39999
🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 16255
🌐 Web query:
RadioLib SX1278 setOutputPower RFO minimum output power -4 RADIOLIB_ERR_INVALID_OUTPUT_POWER source💡 Result:
In RadioLib, the minimum supported output power for the SX1278 module when using the RFO pin is -4 dBm [1][2]. If you attempt to set an output power value outside of the valid range (which is -4 to +15 dBm for the RFO pin, or +2 to +17 dBm for the PA_BOOST pin, with +20 dBm supported specifically on PA_BOOST), the library will return the error code RADIOLIB_ERR_INVALID_OUTPUT_POWER [1][2]. Key points regarding power configuration in RadioLib for the SX1278: - Automatic Pin Selection: By default, the
setOutputPower(int8_t power)method automatically switches between the RFO and PA_BOOST pins based on the requested power value [1][3]. Generally, requests for lower power levels (typically ≤ 1 dBm) are routed to the RFO pin, while higher power levels are routed to the PA_BOOST pin [2][3]. - Forcing RFO: You can manually force the use of the RFO pin by using thesetOutputPower(int8_t power, bool forceRfo)method and settingforceRfototrue[1][2]. - Error Handling: If the requested power cannot be achieved given the pin selection or hardware limits, the function returns RADIOLIB_ERR_INVALID_OUTPUT_POWER [2]. Always ensure that the power level requested is within the valid range for the specific pin configuration you are using [1][2].Citations:
🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 3696
🌐 Web query:
site:github.com/jgromes/RadioLib SX1278.cpp "setOutputPower" "forceRfo" "-4"💡 Result:
In the RadioLib library, the method setOutputPower(int8_t power, bool forceRfo) allows you to explicitly configure the transmission power for the SX1278 module [1][2]. When you call this method with forceRfo set to true, the library forces the use of the RFO pin for the RF output [1][2]. For the SX1278, the RFO pin supports output power values ranging from -4 dBm to +15 dBm [2]. If you pass -4 as the power argument while forceRfo is true: 1. The library validates the power level against the allowed range for the RFO pin (-4 to +15 dBm) [3][4]. 2. It then calculates the necessary register values to configure the chip for low-power RFO output [1][3]. 3. Specifically, for negative power values (like -4 dBm), the library uses the formula (power + 3) combined with the RADIOLIB_SX1278_LOW_POWER configuration flag in the PA_CONFIG register [1][3]. By setting forceRfo to true, you ensure the library bypasses its automatic selection logic (which typically defaults to PA_BOOST for power levels >= 2 dBm) and strictly uses the RFO path [1][5][3]. This is particularly useful if your specific hardware design connects the antenna specifically to the RFO pin [5].
Citations:
🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 50375
🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 3887
🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 10397
🏁 Script executed:
rg -n -C 5 'lora->begin|limitPower|setOutputPower' src/mesh/RF95Interface.cppRepository: meshtastic/firmware
Length of output: 1402
Use a radio-specific minimum transmit power.
limitPower()can setpowerto the shared-9 dBmfloor.RF95Interface::init()andreconfigure()then pass that value toRadioLibRF95. RadioLib selects the RFO path below 2 dBm, whereSX1278accepts only-4..15 dBmand returnsRADIOLIB_ERR_INVALID_OUTPUT_POWERfor-9 dBm. Define a-4 dBmminimum for RF95, or pass the driver-specific minimum tolimitPower().🤖 Prompt for AI Agents