From f316920babb8a4dda4e2b13392e4406a15cbad72 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sun, 26 Jan 2020 15:19:08 +0100 Subject: [PATCH] [SX126x] Removed setOptimalHiPowerPaConfig --- src/modules/SX126x/SX1262.cpp | 6 ------ src/modules/SX126x/SX1268.cpp | 4 ---- src/modules/SX126x/SX126x.cpp | 24 ------------------------ src/modules/SX126x/SX126x.h | 1 - 4 files changed, 35 deletions(-) diff --git a/src/modules/SX126x/SX1262.cpp b/src/modules/SX126x/SX1262.cpp index 6078817b..06b2c12b 100644 --- a/src/modules/SX126x/SX1262.cpp +++ b/src/modules/SX126x/SX1262.cpp @@ -84,12 +84,6 @@ int16_t SX1262::setOutputPower(int8_t power) { int16_t state = readRegister(SX126X_REG_OCP_CONFIGURATION, &ocp, 1); RADIOLIB_ASSERT(state); - // this function sets the optimal PA settings - // and adjusts power based on the PA settings chosen - // so that output power matches requested power. - state = SX126x::setOptimalHiPowerPaConfig(&power); - RADIOLIB_ASSERT(state); - // set output power // TODO power ramp time configuration state = SX126x::setTxParams(power); diff --git a/src/modules/SX126x/SX1268.cpp b/src/modules/SX126x/SX1268.cpp index c58651a5..fa449682 100644 --- a/src/modules/SX126x/SX1268.cpp +++ b/src/modules/SX126x/SX1268.cpp @@ -77,10 +77,6 @@ int16_t SX1268::setOutputPower(int8_t power) { int16_t state = readRegister(SX126X_REG_OCP_CONFIGURATION, &ocp, 1); RADIOLIB_ASSERT(state); - // enable optimal PA - this changes the value of power. - state = SX126x::setOptimalHiPowerPaConfig(&power); - RADIOLIB_ASSERT(state); - // set output power // TODO power ramp time configuration state = SX126x::setTxParams(power); diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index 0b6c832c..96712ac4 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -1229,30 +1229,6 @@ int16_t SX126x::setTxParams(uint8_t power, uint8_t rampTime) { return(SPIwriteCommand(SX126X_CMD_SET_TX_PARAMS, data, 2)); } -int16_t SX126x::setOptimalHiPowerPaConfig(int8_t * inOutPower) { - // set PA config for optimal consumption as described in section 13-21 of SX1268 datasheet v1.1 - // the final column of Table 13-21 suggests that the value passed in SetTxParams - // is actually scaled depending on the parameters of setPaConfig - int16_t state; - if (*inOutPower >= 21) { - state = SX126x::setPaConfig(0x04, SX126X_PA_CONFIG_SX1262_8, SX126X_PA_CONFIG_HP_MAX/*0x07*/); - } - else if (*inOutPower >= 18) { - state = SX126x::setPaConfig(0x03, SX126X_PA_CONFIG_SX1262_8, 0x05); - // datasheet instructs request 22 dBm for 20 dBm actual output power - *inOutPower += 2; - } else if (*inOutPower >= 15) { - state = SX126x::setPaConfig(0x02, SX126X_PA_CONFIG_SX1262_8, 0x03); - // datasheet instructs request 22 dBm for 17 dBm actual output power - *inOutPower += 5; - } else { - state = SX126x::setPaConfig(0x02, SX126X_PA_CONFIG_SX1262_8, 0x02); - // datasheet instructs request 22 dBm for 14 dBm actual output power. - *inOutPower += 8; - } - return state; -} - int16_t SX126x::setPacketMode(uint8_t mode, uint8_t len) { // check active modem if(getPacketType() != SX126X_PACKET_TYPE_GFSK) { diff --git a/src/modules/SX126x/SX126x.h b/src/modules/SX126x/SX126x.h index 44504926..9d7c4719 100644 --- a/src/modules/SX126x/SX126x.h +++ b/src/modules/SX126x/SX126x.h @@ -853,7 +853,6 @@ class SX126x: public PhysicalLayer { int16_t startReceiveCommon(); int16_t setFrequencyRaw(float freq); - int16_t setOptimalHiPowerPaConfig(int8_t* inOutPower); int16_t setPacketMode(uint8_t mode, uint8_t len); int16_t setHeaderType(uint8_t headerType, size_t len = 0xFF);