From 1bfe7a85b2744122bd6ff5fc180ec5eeab1246b7 Mon Sep 17 00:00:00 2001 From: Aleksandr Linkevich <49792082+AlexandrZloy@users.noreply.github.com> Date: Wed, 8 Jul 2026 21:03:16 +0200 Subject: [PATCH 1/2] Fixed pin state setup when SX126X_ANT_SW is defined Fixed the order of pinMode and digitalWrite calls if SX126X_ANT_SW is defined. --- src/mesh/SX126xInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index ae4c485ddc5..f3a81e4c8c8 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -46,8 +46,8 @@ template bool SX126xInterface::init() // means this workaround is not necessary. #ifdef SX126X_ANT_SW // Perhaps add RADIOLIB_NC check, and beforehand define as such if it is undefined, but it is not commonly // used and not part of the 'default' set of pin definitions. - digitalWrite(SX126X_ANT_SW, HIGH); pinMode(SX126X_ANT_SW, OUTPUT); + digitalWrite(SX126X_ANT_SW, HIGH); #endif #ifdef SX126X_POWER_EN // Perhaps add RADIOLIB_NC check, and beforehand define as such if it is undefined, but it is not commonly @@ -548,4 +548,4 @@ template void SX126xInterface::setTransmitEnable(bool txon) #endif } -#endif \ No newline at end of file +#endif From c7489cccb2848e7898800710116ba57ba940993a Mon Sep 17 00:00:00 2001 From: Aleksandr Linkevich <49792082+AlexandrZloy@users.noreply.github.com> Date: Sat, 11 Jul 2026 14:10:21 +0200 Subject: [PATCH 2/2] Fix portduino_config.lora_sx126x_ant_sw_pin.pin case --- src/mesh/SX126xInterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index f3a81e4c8c8..2a5ffd189b5 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -72,8 +72,8 @@ template bool SX126xInterface::init() #if ARCH_PORTDUINO tcxoVoltage = (float)portduino_config.dio3_tcxo_voltage / 1000; if (portduino_config.lora_sx126x_ant_sw_pin.pin != RADIOLIB_NC) { - digitalWrite(portduino_config.lora_sx126x_ant_sw_pin.pin, HIGH); pinMode(portduino_config.lora_sx126x_ant_sw_pin.pin, OUTPUT); + digitalWrite(portduino_config.lora_sx126x_ant_sw_pin.pin, HIGH); } #endif if (tcxoVoltage == 0.0)