From fe6bf91343867fb52610d86aebdac823e9fb018f Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 5 Jul 2026 16:04:04 -0500 Subject: [PATCH] Add tx_power to userprefs (#10889) --- src/mesh/Channels.cpp | 3 +++ src/mesh/NodeDB.cpp | 4 ++++ userPrefs.jsonc | 1 + 3 files changed, 8 insertions(+) diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index 0471ad06b..f0b339df2 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -87,6 +87,9 @@ void Channels::initDefaultLoraConfig() loraConfig.tx_power = 0; // default loraConfig.channel_num = 0; +#ifdef USERPREFS_LORACONFIG_TX_POWER + loraConfig.tx_power = USERPREFS_LORACONFIG_TX_POWER; +#endif #ifdef USERPREFS_LORACONFIG_MODEM_PRESET loraConfig.modem_preset = USERPREFS_LORACONFIG_MODEM_PRESET; #endif diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 3e877a57c..f8e74b722 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -914,6 +914,10 @@ void NodeDB::installDefaultConfig(bool preserveKey = false) config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET; #endif +#ifdef USERPREFS_LORACONFIG_TX_POWER + config.lora.tx_power = USERPREFS_LORACONFIG_TX_POWER; +#endif + #ifdef USERPREFS_LORACONFIG_MODEM_PRESET config.lora.modem_preset = USERPREFS_LORACONFIG_MODEM_PRESET; #else diff --git a/userPrefs.jsonc b/userPrefs.jsonc index 100e1cb19..a132eb906 100644 --- a/userPrefs.jsonc +++ b/userPrefs.jsonc @@ -38,6 +38,7 @@ // "USERPREFS_CONFIG_ENV_TELEM_UPDATE_INTERVAL": "900", // Environment telemetry update interval in seconds // "USERPREFS_CONFIG_ENVIRONMENT_MEASUREMENT_ENABLED": "1", // Force BMP280/sensor reads + LoRa broadcast on first boot // "USERPREFS_LORACONFIG_CHANNEL_NUM": "31", + // "USERPREFS_LORACONFIG_TX_POWER": "0", // "USERPREFS_LORACONFIG_MODEM_PRESET": "meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST", // "USERPREFS_USE_ADMIN_KEY_0": "{ 0xcd, 0xc0, 0xb4, 0x3c, 0x53, 0x24, 0xdf, 0x13, 0xca, 0x5a, 0xa6, 0x0c, 0x0d, 0xec, 0x85, 0x5a, 0x4c, 0xf6, 0x1a, 0x96, 0x04, 0x1a, 0x3e, 0xfc, 0xbb, 0x8e, 0x33, 0x71, 0xe5, 0xfc, 0xff, 0x3c }", // "USERPREFS_USE_ADMIN_KEY_1": "{}",