Skip to content
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

Add REGULATORY_GAIN configuration to remain within regulatory ERP limit #3836

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ndoo
Copy link
Contributor

@ndoo ndoo commented May 8, 2024

REGULATORY_GAIN_LORA is the total LoRa gain in dBm to subtract from the configured Tx power, to remain within regulatory ERP limit for non-licensed operators.

This value should be set at build-time in variant.h and is PA gain + antenna gain (if the Meshtastic device is built with a fixed antenna, e.g. PCB trace antenna or non-removable whip).

This is similar to antenna_gain/NL80211_ATTR_WIPHY_ANTENNA_GAIN/NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN setting in Linux Regulatory/OpenWrt/mac80211/nl80211/iw.

The final transmit power is (myRegion->powerLimit - REGULATORY_GAIN) or the user's configured loraConfig.tx_power, whichever is lower.

This is implemented in DIY XIAO BLE EBYTE E22-900M30S variant as an example.

@ndoo ndoo force-pushed the regulatory-gain branch 9 times, most recently from 75479d2 to 2afb70c Compare May 15, 2024 04:07
@ndoo ndoo force-pushed the regulatory-gain branch 6 times, most recently from 635b82a to 4b96d4a Compare May 22, 2024 10:09
@ndoo ndoo force-pushed the regulatory-gain branch 4 times, most recently from 7211faf to 9db514f Compare May 29, 2024 08:44
@ndoo ndoo force-pushed the regulatory-gain branch 2 times, most recently from 634edcf to b988ef8 Compare June 3, 2024 18:03
@ndoo
Copy link
Contributor Author

ndoo commented Jun 4, 2024

Hi there, is there any reason to wait on this PR? If myself or Unit Engineering continue to build and ship boards with built in PAs in front of the SX1262/other LoRa ICs, we need to introduce controls for non-licensed-hams to not be able to transmit at several watts above ISM regulatory limits.

@ndoo ndoo force-pushed the regulatory-gain branch 2 times, most recently from 9ef6f4b to b620d2c Compare June 4, 2024 23:59
ndoo added 5 commits June 6, 2024 14:42
Add REGULATORY_ prefix to LORA_REGIONCODE to prepare for more regulatory configuration options, and update comment block accordingly too.

Signed-off-by: Andrew Yong <me@ndoo.sg>
REGULATORY_GAIN is the total system gain in dBm to subtract from the configured Tx power, to remain within regulatory ERP limit for non-licensed operators.

This value should be set in variant.h and is PA gain + antenna gain (if system ships with an antenna).

This is similar to antenna_gain/NL80211_ATTR_WIPHY_ANTENNA_GAIN/NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN setting in Linux Regulatory/OpenWrt/mac80211/nl80211/iw.

Signed-off-by: Andrew Yong <me@ndoo.sg>
Specify REGULATORY_GAIN and SX126X_MAX_POWER to prevent exceeding regulatory and hardware limits (i.e. overloading the PA input) respectively.

Also update the build flag to define EBYTE_E22_900M30S instead of just EBYTE_E22, since all the builds on the Discourse topic [New 1W DIY variant: Xiao nRF52840 + Ebyte E22-900M30S](https://meshtastic.discourse.group/t/new-1w-diy-variant-xiao-nrf52840-ebyte-e22-900m30s/7904) are using this module.

That should make it clearer as well that the variant header file should be tweaked if DIY builds are using stronger (E22-900M33S, not commonly available at this time) or weaker (E22-900M22S, not popular for DIY builds due to lack of differentiation from ordinary SX1262 modules).

Retain EBYTE_E22 flag alongside EBYTE_E22_900M30S build flag to prevent possible regressions in code paths generally intended for EBYTE E22 modules.

Signed-off-by: Andrew Yong <me@ndoo.sg>
Signed-off-by: Andrew Yong <me@ndoo.sg>
…gain controls

For example, Wi-Fi or BLE gain control (meshtastic#3962)

Signed-off-by: Andrew Yong <me@ndoo.sg>
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.

None yet

1 participant