]> git.tnoah.ca Git - lora-radio.git/commitdiff
Revert to SX127X TX power value being read directly with an offset #39
authorjacob.eva <x00010@disroot.org>
Fri, 6 Dec 2024 10:58:55 +0000 (10:58 +0000)
committerjacob.eva <x00010@disroot.org>
Fri, 6 Dec 2024 10:58:55 +0000 (10:58 +0000)
Radio.cpp

index 5693b52452849b4e9ead055cae6525f6a204bf13..8d4c79f5f18122e27a1360431cf082eabf782694 100644 (file)
--- a/Radio.cpp
+++ b/Radio.cpp
@@ -1385,10 +1385,9 @@ void sx127x::setTxPower(int level, int outputPin) {
     writeRegister(REG_PA_DAC_7X, 0x84);
     writeRegister(REG_PA_CONFIG_7X, PA_BOOST_7X | (level - 2));
   }
-  _txp = level;
 }
 
-int8_t sx127x::getTxPower() { return _txp; }
+int8_t sx127x::getTxPower() { byte txp = readRegister(REG_PA_CONFIG_7X); return ((int8_t)txp) - 126; } // temporary fix for SX127X power weirdness
 
 void sx127x::setFrequency(uint32_t frequency) {
   _frequency = frequency;