Fix erroneous limiting of power in Ham Mode (#8322)

Ham Mode ignores region regulatory limits, so regardless of whether
we set a single TX_GAIN_LORA or an array with a non-linear PA,
we shouldn't limit the power.

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Tom Fifield 2025-10-13 23:50:57 +11:00 committed by GitHub
parent fe6509a0f2
commit 130833b5be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -647,11 +647,12 @@ void RadioInterface::limitPower(int8_t loraMaxPower)
} }
#ifndef NUM_PA_POINTS #ifndef NUM_PA_POINTS
if (TX_GAIN_LORA > 0) { if (TX_GAIN_LORA > 0 && !devicestate.owner.is_licensed) {
LOG_INFO("Requested Tx power: %d dBm; Device LoRa Tx gain: %d dB", power, TX_GAIN_LORA); LOG_INFO("Requested Tx power: %d dBm; Device LoRa Tx gain: %d dB", power, TX_GAIN_LORA);
power -= TX_GAIN_LORA; power -= TX_GAIN_LORA;
} }
#else #else
if (!devicestate.owner.is_licensed) {
// we have an array of PA gain values. Find the highest power setting that works. // we have an array of PA gain values. Find the highest power setting that works.
const uint16_t tx_gain[NUM_PA_POINTS] = {TX_GAIN_LORA}; const uint16_t tx_gain[NUM_PA_POINTS] = {TX_GAIN_LORA};
for (int radio_dbm = 0; radio_dbm < NUM_PA_POINTS; radio_dbm++) { for (int radio_dbm = 0; radio_dbm < NUM_PA_POINTS; radio_dbm++) {
@ -663,7 +664,7 @@ void RadioInterface::limitPower(int8_t loraMaxPower)
break; break;
} }
} }
}
#endif #endif
if (power > loraMaxPower) // Clamp power to maximum defined level if (power > loraMaxPower) // Clamp power to maximum defined level
power = loraMaxPower; power = loraMaxPower;