Closed
Description
This code looks wrong.
Lines 426 to 435 in 896fb80
- If
pw
is 16, it will pass through unchanged, but then the mask with 0xF will cause bits 3..0 of RegPaConfig to be set to zero instead of the desired 0xF. - if
pw
is 2..15, it will be written to RegPaConfig, but since bit 7 is also set, the output power is interpreted as 17-(15-OutputPower) [or OutputPower + 2]. Sopw
== 2 sets output power = 4 dBm;pw
== 15 or >= 17 sets 17 dBm; andpw
== 16 sets 0 dBm.
It would be best to revise this code along with the fixes for #46 so that we can handle PaSelect == 0; in that case MaxPower should be set based on the region's maximum output power, allowing finest control and then OutputPower would be adjusted within the resulting range. (We could get as low as -4.2 dBm.)