Closed mawdegroot closed 10 months ago
For context, this PR fixes a bug in the packet forwarder where it accidentally transmits a packet at a higher power than requested when it ought to have returned an error condition instead. This is a bug in the power LUT table processing and how it handles the condition of falling off of the edge of the table.
Fixed a final bug where it also made TX_POWER
an error when there was a lower value available. The following was obtained using a global_conf with values between 16 and 10 dBm.
(miner@127.0.0.1)41> gen_server:call(miner_lora_light, {send, <<"...">>, immediate, fun(_) -> 867.9 end, "SF11BW125", 20, false, undefined}, 11000).
{warning,{tx_power_corrected,16}}
(miner@127.0.0.1)42> gen_server:call(miner_lora_light, {send, <<"...">>, immediate, fun(_) -> 867.9 end, "SF11BW125", 6, false, undefined}, 11000).
{error,bad_tx_power}
(miner@127.0.0.1)43> gen_server:call(miner_lora_light, {send, <<"...">>, immediate, fun(_) -> 867.9 end, "SF11BW125", 16, false, undefined}, 11000).
ok
Rebased and retested.
TX_POWER is an error when there is no lower or equal power level available. TX_POWER is a warning when there is a lower or equal power level available.