From 532a63e5416cca2ba6a3f29df403d3ddff2cea11 Mon Sep 17 00:00:00 2001 From: Wessel Date: Thu, 19 Mar 2026 14:11:10 +0100 Subject: [PATCH] Enable LNA by default for Heltec v4.3 (#9906) It should only be disabled by users that have problems with it. --- src/mesh/LoRaFEMInterface.cpp | 4 ++-- src/mesh/LoRaFEMInterface.h | 2 +- src/mesh/NodeDB.cpp | 2 +- src/mesh/SX126xInterface.cpp | 2 +- src/modules/AdminModule.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mesh/LoRaFEMInterface.cpp b/src/mesh/LoRaFEMInterface.cpp index bad795c3a..b05bb65ed 100644 --- a/src/mesh/LoRaFEMInterface.cpp +++ b/src/mesh/LoRaFEMInterface.cpp @@ -25,7 +25,7 @@ void LoRaFEMInterface::init(void) pinMode(LORA_KCT8103L_PA_CSD, OUTPUT); digitalWrite(LORA_KCT8103L_PA_CSD, HIGH); pinMode(LORA_KCT8103L_PA_CTX, OUTPUT); - digitalWrite(LORA_KCT8103L_PA_CTX, HIGH); + digitalWrite(LORA_KCT8103L_PA_CTX, LOW); // LNA enabled by default setLnaCanControl(true); } else if (digitalRead(LORA_KCT8103L_PA_CSD) == LOW) { // FEM is GC1109 @@ -66,7 +66,7 @@ void LoRaFEMInterface::init(void) pinMode(LORA_KCT8103L_PA_CSD, OUTPUT); digitalWrite(LORA_KCT8103L_PA_CSD, HIGH); pinMode(LORA_KCT8103L_PA_CTX, OUTPUT); - digitalWrite(LORA_KCT8103L_PA_CTX, HIGH); + digitalWrite(LORA_KCT8103L_PA_CTX, LOW); // LNA enabled by default setLnaCanControl(true); #endif } diff --git a/src/mesh/LoRaFEMInterface.h b/src/mesh/LoRaFEMInterface.h index 9024abd3a..14220c6e3 100644 --- a/src/mesh/LoRaFEMInterface.h +++ b/src/mesh/LoRaFEMInterface.h @@ -22,7 +22,7 @@ class LoRaFEMInterface private: LoRaFEMType fem_type; - bool lna_enabled = false; + bool lna_enabled = true; bool lna_can_control = false; }; extern LoRaFEMInterface loraFEMInterface; diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 90bcd4890..8cd3172f6 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -569,7 +569,7 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) config.lora.override_duty_cycle = false; config.lora.config_ok_to_mqtt = false; #if HAS_LORA_FEM - config.lora.fem_lna_mode = meshtastic_Config_LoRaConfig_FEM_LNA_Mode_DISABLED; + config.lora.fem_lna_mode = meshtastic_Config_LoRaConfig_FEM_LNA_Mode_ENABLED; #else config.lora.fem_lna_mode = meshtastic_Config_LoRaConfig_FEM_LNA_Mode_NOT_PRESENT; #endif diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index 4dd90b6e6..2e9a3250d 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -60,7 +60,7 @@ template bool SX126xInterface::init() loraFEMInterface.init(); // Apply saved FEM LNA mode from config if (loraFEMInterface.isLnaCanControl()) { - loraFEMInterface.setLNAEnable(config.lora.fem_lna_mode == meshtastic_Config_LoRaConfig_FEM_LNA_Mode_ENABLED); + loraFEMInterface.setLNAEnable(config.lora.fem_lna_mode != meshtastic_Config_LoRaConfig_FEM_LNA_Mode_DISABLED); } #endif diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 8f0296227..5f0f1f176 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -800,7 +800,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c) #if HAS_LORA_FEM // Apply FEM LNA mode from config (only meaningful on hardware that supports it) if (loraFEMInterface.isLnaCanControl()) { - loraFEMInterface.setLNAEnable(config.lora.fem_lna_mode == meshtastic_Config_LoRaConfig_FEM_LNA_Mode_ENABLED); + loraFEMInterface.setLNAEnable(config.lora.fem_lna_mode != meshtastic_Config_LoRaConfig_FEM_LNA_Mode_DISABLED); } else if (config.lora.fem_lna_mode != meshtastic_Config_LoRaConfig_FEM_LNA_Mode_NOT_PRESENT) { // Hardware FEM does not support LNA control; normalize stored config to match actual capability LOG_WARN("FEM LNA mode configured but current FEM does not support LNA control; normalizing to NOT_PRESENT");