mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-21 02:02:23 +00:00
Log TX power after limits applyng and store it in config (#7065)
* Log and save in config lora tx_power after limits applyng * Log and save in config lora tx_power after limits applyng * Trunk fmt * Remove duplicate logic --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -611,7 +611,7 @@ uint32_t RadioInterface::computeSlotTimeMsec()
|
||||
* Some regulatory regions limit xmit power.
|
||||
* This function should be called by subclasses after setting their desired power. It might lower it
|
||||
*/
|
||||
void RadioInterface::limitPower()
|
||||
void RadioInterface::limitPower(int8_t loraMaxPower)
|
||||
{
|
||||
uint8_t maxPower = 255; // No limit
|
||||
|
||||
@@ -628,6 +628,13 @@ void RadioInterface::limitPower()
|
||||
power -= TX_GAIN_LORA;
|
||||
}
|
||||
|
||||
if (power > loraMaxPower) // Clamp power to maximum defined level
|
||||
power = loraMaxPower;
|
||||
|
||||
if (TX_GAIN_LORA == 0) { // Setting power in config with defined TX_GAIN_LORA will cause decreasing power on each reboot
|
||||
config.lora.tx_power = power; // Set limited power in config
|
||||
}
|
||||
|
||||
LOG_INFO("Final Tx power: %d dBm", power);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user