diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index a6a4e9dc..5305adfe 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -60,6 +60,15 @@ template bool SX126xInterface::init() LOG_DEBUG("Current limit set to %f\n", currentLimit); LOG_DEBUG("Current limit set result %d\n", res); +#if defined(SX126X_E22) + // E22 Emulation explicitly requires DIO2 as RF switch, so set it to TRUE again for good measure. In case somebody defines + // SX126X_TX for an E22 Module + if (res == RADIOLIB_ERR_NONE) { + LOG_DEBUG("SX126X_E22 mode enabled. Setting DIO2 as RF Switch\n"); + res = lora.setDio2AsRfSwitch(true); + } +#endif + #if defined(SX126X_TXEN) && (SX126X_TXEN != RADIOLIB_NC) // lora.begin sets Dio2 as RF switch control, which is not true if we are manually controlling RX and TX if (res == RADIOLIB_ERR_NONE) { @@ -67,13 +76,6 @@ template bool SX126xInterface::init() res = lora.setDio2AsRfSwitch(false); lora.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN); } -#elif defined(SX126X_E22) - // E22 Emulation explicitly requires DIO2 as RF switch, so set it to TRUE again for good measure. In case somebody defines - // SX126X_TX for an E22 Module - if (res == RADIOLIB_ERR_NONE) { - LOG_DEBUG("SX126X_E22 mode enabled. Setting DIO2 as RF Switch\n"); - res = lora.setDio2AsRfSwitch(true); - } #endif if (config.lora.sx126x_rx_boosted_gain) {