Description
CommonRadioPrefs::getTxPower() and setTxPower() use uint8_t, although valid radio TX power values can be negative.
For example, a configured value of -9 dBm is converted to 247. This can produce incorrect CLI output and break preference serialization or round-tripping on radios that support negative TX power.
Root cause
The TX power interface is unsigned while the underlying configuration represents dBm as a signed value.
The issue was introduced in upstream commit b4f7e941, “CommonRadioPrefs refactors done”, on August 23.
That commit added these unsigned interfaces:
virtual uint8_t getTxPower() const = 0;
virtual void setTxPower(uint8_t dbm) = 0;
It also added matching unsigned implementations in CommonCLI and NodePrefs.
Proposed fix
Change the TX power getter, setter, and corresponding overrides from uint8_t to int8_t.
Description
CommonRadioPrefs::getTxPower()andsetTxPower()useuint8_t, although valid radio TX power values can be negative.For example, a configured value of
-9 dBmis converted to247. This can produce incorrect CLI output and break preference serialization or round-tripping on radios that support negative TX power.Root cause
The TX power interface is unsigned while the underlying configuration represents dBm as a signed value.
The issue was introduced in upstream commit b4f7e941, “CommonRadioPrefs refactors done”, on August 23.
That commit added these unsigned interfaces:
It also added matching unsigned implementations in CommonCLI and NodePrefs.
Proposed fix
Change the TX power getter, setter, and corresponding overrides from
uint8_ttoint8_t.