diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index 203133eb..e01d0b81 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -1203,6 +1203,11 @@ int16_t SX126x::setTCXO(float voltage, uint32_t delay) { clearDeviceErrors(); } + // check 0 V disable + if(abs(voltage - 0.0) <= 0.001) { + return(reset(true)); + } + // check alowed voltage values uint8_t data[4]; if(abs(voltage - 1.6) <= 0.001) { diff --git a/src/modules/SX126x/SX126x.h b/src/modules/SX126x/SX126x.h index 0778ea6e..46b510f8 100644 --- a/src/modules/SX126x/SX126x.h +++ b/src/modules/SX126x/SX126x.h @@ -733,9 +733,12 @@ class SX126x: public PhysicalLayer { /*! \brief Sets TCXO (Temperature Compensated Crystal Oscillator) configuration. - \param TCXO reference voltage in volts. Allowed values are 1.6, 1.7, 1.8, 2.2. 2.4, 2.7, 3.0 and 3.3 V + \param TCXO reference voltage in volts. Allowed values are 1.6, 1.7, 1.8, 2.2. 2.4, 2.7, 3.0 and 3.3 V. Set to 0 to disable TCXO. + NOTE: After setting this parameter to 0, the module will be reset (since there's no other way to disable TCXO). \param TCXO timeout in us. Defaults to 5000 us. + + \returns \ref status_codes */ int16_t setTCXO(float voltage, uint32_t delay = 5000);