-
Notifications
You must be signed in to change notification settings - Fork 964
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
Conversation
75479d2
to
2afb70c
Compare
635b82a
to
4b96d4a
Compare
7211faf
to
9db514f
Compare
634edcf
to
b988ef8
Compare
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. |
9ef6f4b
to
b620d2c
Compare
Add REGULATORY_ prefix to LORA_REGIONCODE to prepare for more regulatory configuration options, and update comment block accordingly too. Signed-off-by: Andrew Yong <[email protected]>
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 <[email protected]>
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 <[email protected]>
Signed-off-by: Andrew Yong <[email protected]>
…gain controls For example, Wi-Fi or BLE gain control (meshtastic#3962) Signed-off-by: Andrew Yong <[email protected]>
Sorry this fell by the wayside. I get your reasoning, but have several questions
|
Hello there, this is aimed at 2 sets of devices:
Regarding licensed hams, the
It would make retailing devices easier in countries like mine (Singapore) where devices can get regulatory labels based on the device in retail state (i.e. user replacing the firmware is a personal violation and not the retailer/manufacturer).
It would be important bring devices with PA into compliance once those variants' The current behavior for Station G2, taking region setting SG_923 as an example:
The current behavior for XIAO BLE + E22-900M30S:
Edit: In either case, there is no visual indication in the GUI or serial logs on what the actual transmitted power is, since the firmware is not aware of the PA gain. Unless the user looks at the product datasheet and works backward, it's not obvious to the user they have broken the regulatory limit. The complexity is not much, it's just a quick subtraction when calculating I'm not sure this is a "use case" from the POV of Meshtastic users, but it's more to prevent inadvertently breaking the law because the user bought a fancy device with built-in PA and then set 20dBm thinking it's the device's output power setting when it's just the Semtech chip's output setting (or the SX126X_MAX_POWER limit); it seems reasonable that the firmware should guard the user against that. |
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.