Skip to content

feat(RadioInterface): Tx power gain calculation rework #6796

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
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ndoo
Copy link
Contributor

@ndoo ndoo commented May 12, 2025

  • Rename REGULATORY_GAIN_LORA to TX_GAIN_LORA
  • Move gain-based Tx power clamping from RadioInterface::applyModemConfig() to RadioInterface::limitPower()
    • User-configured Tx power now matches the Tx power out of the device connector
  • Re-order [LoRa Chip]Interface.cpp limitPower() to take place before the final Tx power clamping so we clamp based on the pre-PA Tx power rather than user-configured Tx power

Tested on XIAO BLE variant.

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)
      • XIAO BLE

image

> meshtastic --get lora.tx_power
Connected to radio
lora.tx_power: 27
Completed getting preferences
INFO  | ??:??:?? 0 Start meshradio init
INFO  | ??:??:?? 0 Radio freq=922.875, config.lora.frequency_offset=0.000
INFO  | ??:??:?? 0 Set radio: region=MY_919, name=LongFast, config=0, ch=15, power=27
INFO  | ??:??:?? 0 myRegion->freqStart -> myRegion->freqEnd: 919.000000 -> 924.000000 (5.000000 MHz)
INFO  | ??:??:?? 0 numChannels: 20 x 250.000kHz
INFO  | ??:??:?? 0 channel_num: 16
INFO  | ??:??:?? 0 frequency: 922.875000
INFO  | ??:??:?? 0 Slot time: 28 msec
INFO  | ??:??:?? 0 Requested Tx power: 27 dBm; Device LoRa Tx gain: 7 dB
INFO  | ??:??:?? 0 Final Tx power: 20 dBm
INFO  | ??:??:?? 0 SX126x init result 0
INFO  | ??:??:?? 0 Frequency set to 922.875000
INFO  | ??:??:?? 0 Bandwidth set to 250.000000
INFO  | ??:??:?? 0 Power output set to 20

@ndoo
Copy link
Contributor Author

ndoo commented May 12, 2025

Just did a test to confirm that trying to set higher than supported Tx power (either by the PA or by SX1262 etc.) doesn't break, it just sets the maximum the variant allows.

INFO  | ??:??:?? 3 Requested Tx power: 30 dBm; Device LoRa Tx gain: 7 dB
INFO  | ??:??:?? 3 Final Tx power: 23 dBm
INFO  | ??:??:?? 3 SX126x init result 0
INFO  | ??:??:?? 3 Frequency set to 922.875000
INFO  | ??:??:?? 3 Bandwidth set to 250.000000
INFO  | ??:??:?? 3 Power output set to 22

@ndoo ndoo force-pushed the txpower-gain branch 4 times, most recently from 4759a7a to 42d719a Compare May 15, 2025 14:01
@ndoo ndoo force-pushed the txpower-gain branch 4 times, most recently from 4fbb005 to 5e86c21 Compare May 20, 2025 00:46
- Rename REGULATORY_GAIN_LORA to TX_GAIN_LORA
- Move gain-based Tx power clamping from RadioInterface::applyModemConfig() to RadioInterface::limitPower()
  - User-configured Tx power now matches the Tx power out of the device connector
- Re-order [LoRa Chip]Interface.cpp limitPower() to take place before the final Tx power clamping so we clamp based on the pre-PA Tx power rather than user-configured Tx power

Tested on XIAO BLE variant.

Signed-off-by: Andrew Yong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants