File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -568,6 +568,11 @@ void NodeDB::installDefaultConfig(bool preserveKey = false)
568568 true ; // FIXME: maybe false in the future, and setting region to enable it. (unset region forces it off)
569569 config.lora .override_duty_cycle = false ;
570570 config.lora .config_ok_to_mqtt = false ;
571+ #if HAS_LORA_FEM
572+ config.lora .fem_lna_mode = meshtastic_Config_LoRaConfig_FEM_LNA_Mode_DISABLED;
573+ #else
574+ config.lora .fem_lna_mode = meshtastic_Config_LoRaConfig_FEM_LNA_Mode_NOT_PRESENT;
575+ #endif
571576
572577#if HAS_TFT // For the devices that support MUI, default to that
573578 config.display .displaymode = meshtastic_Config_DisplayConfig_DisplayMode_COLOR;
Original file line number Diff line number Diff line change @@ -58,6 +58,10 @@ template <typename T> bool SX126xInterface<T>::init()
5858
5959#if HAS_LORA_FEM
6060 loraFEMInterface.init ();
61+ // Apply saved FEM LNA mode from config
62+ if (loraFEMInterface.isLnaCanControl ()) {
63+ loraFEMInterface.setLNAEnable (config.lora .fem_lna_mode == meshtastic_Config_LoRaConfig_FEM_LNA_Mode_ENABLED);
64+ }
6165#endif
6266
6367#ifdef RF95_FAN_EN
Original file line number Diff line number Diff line change @@ -795,6 +795,17 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
795795 }
796796#endif
797797 config.lora = validatedLora;
798+
799+ #if HAS_LORA_FEM
800+ // Apply FEM LNA mode from config (only meaningful on hardware that supports it)
801+ if (loraFEMInterface.isLnaCanControl ()) {
802+ loraFEMInterface.setLNAEnable (config.lora .fem_lna_mode == meshtastic_Config_LoRaConfig_FEM_LNA_Mode_ENABLED);
803+ } else if (config.lora .fem_lna_mode != meshtastic_Config_LoRaConfig_FEM_LNA_Mode_NOT_PRESENT) {
804+ // Hardware FEM does not support LNA control; normalize stored config to match actual capability
805+ LOG_WARN (" FEM LNA mode configured but current FEM does not support LNA control; normalizing to NOT_PRESENT" );
806+ config.lora .fem_lna_mode = meshtastic_Config_LoRaConfig_FEM_LNA_Mode_NOT_PRESENT;
807+ }
808+ #endif
798809 // If we're setting region for the first time, init the region and regenerate the keys
799810 if (isRegionUnset && config.lora .region > meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
800811#if !(MESHTASTIC_EXCLUDE_PKI_KEYGEN || MESHTASTIC_EXCLUDE_PKI)
You can’t perform that action at this time.
0 commit comments