diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index 1e4e6698..e1c9764e 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -3,6 +3,7 @@ SX126x::SX126x(Module* mod) : PhysicalLayer(RADIOLIB_SX126X_FREQUENCY_STEP_SIZE, RADIOLIB_SX126X_MAX_PACKET_LENGTH) { _mod = mod; + this->XTAL = false; } Module* SX126x::getMod() { @@ -57,7 +58,7 @@ int16_t SX126x::begin(uint8_t cr, uint8_t syncWord, uint16_t preambleLength, flo RADIOLIB_ASSERT(state); // set TCXO control, if requested - if(tcxoVoltage > 0.0) { + if(!this->XTAL && tcxoVoltage > 0.0) { state = setTCXO(tcxoVoltage); RADIOLIB_ASSERT(state); } @@ -131,7 +132,7 @@ int16_t SX126x::beginFSK(float br, float freqDev, float rxBw, uint16_t preambleL RADIOLIB_ASSERT(state); // set TCXO control, if requested - if(tcxoVoltage > 0.0) { + if(!this->XTAL && tcxoVoltage > 0.0) { state = setTCXO(tcxoVoltage); RADIOLIB_ASSERT(state); } diff --git a/src/modules/SX126x/SX126x.h b/src/modules/SX126x/SX126x.h index 05e22601..afe12d1e 100644 --- a/src/modules/SX126x/SX126x.h +++ b/src/modules/SX126x/SX126x.h @@ -439,6 +439,11 @@ class SX126x: public PhysicalLayer { Module* getMod(); + /*! + \brief Whether the module has an XTAL (true) or TCXO (false). Defaults to false. + */ + bool XTAL; + // basic methods /*!