Skip to content

Commit 30a978a

Browse files
Kimmo Vaisanenadbridge
authored andcommitted
Lora: Fix max tx power check
In LoRa TX power value 0 means the maximum allowed TX power and values >0 are limiting the allowed TX power to lower. tx_config was incorrectly checking the power level and causing the maximum TX power to be always used. Lora gateway can request node to use lower TX power with LinkAdrReq MAC command.
1 parent c5fa459 commit 30a978a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

features/lorawan/lorastack/phy/LoRaPHY.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -888,9 +888,7 @@ bool LoRaPHY::tx_config(tx_config_params_t* tx_conf, int8_t* tx_power,
888888
band_t *bands = (band_t *)phy_params.bands.table;
889889

890890
// limit TX power if set to too much
891-
if (tx_conf->tx_power > bands[band_idx].max_tx_pwr) {
892-
tx_conf->tx_power = bands[band_idx].max_tx_pwr;
893-
}
891+
tx_conf->tx_power = MAX(tx_conf->tx_power, bands[band_idx].max_tx_pwr);
894892

895893
uint8_t bandwidth = get_bandwidth(tx_conf->datarate);
896894
int8_t phy_tx_power = 0;

0 commit comments

Comments
 (0)