refactor(mqtt): update default TX packet settings and documentation

Changed the default setting for TX packets from disabled to 'advert' across multiple files, including documentation and example implementations. This aligns the behavior of the MQTT bridge with the new default preferences, ensuring that only the node's own advert packets are uplinked by default. Updated relevant comments and documentation to reflect these changes.
This commit is contained in:
agessaman committed 2026-04-25 09:32:23 -07:00
1 parent 0a4f002fef
commit bfcf017625
5 files changed
+6 -8

No files matched your search

+1 -1
View File
@@ -195,7 +195,7 @@ The MQTT bridge comes with the following defaults for fresh installs:
- **Packet Messages**: Enabled
- **Raw Messages**: Disabled
- **RX Packets**: Enabled (uplink received packets)
- **TX Packets**: Disabled (`off` — set to `on` or `advert` to enable)
- **TX Packets**: `advert` by default (uplink this node's own adverts; set to `on` for all TX or `off` to disable)
- **Status Interval**: 5 minutes (300000 ms)
- **Slot 1**: `analyzer-us`
- **Slot 2**: `analyzer-eu`
+1 -1
View File
@@ -1020,7 +1020,7 @@ region save
- `advert`: uplink only this node's own advert packets (self-originated advertisements only — forwarded adverts from other nodes are filtered out)
- `off`: disable TX packet uplinking
**Default:** `off`
**Default:** `advert`
> **Note:** `mqtt.rx` and `mqtt.tx` take effect immediately — no restart required. Both can be enabled simultaneously.
+1 -1
View File
@@ -971,7 +971,7 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
_prefs.mqtt_status_enabled = 1; // enabled
_prefs.mqtt_packets_enabled = 1; // enabled
_prefs.mqtt_raw_enabled = 0; // disabled
_prefs.mqtt_tx_enabled = 0; // disabled (RX only for now)
_prefs.mqtt_tx_enabled = 2; // advert: own adverts only (matches MQTTPrefs default)
_prefs.mqtt_rx_enabled = 1; // RX packets enabled by default
_prefs.mqtt_status_interval = 300000; // 5 minutes
+1 -1
View File
@@ -688,7 +688,7 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
_prefs.mqtt_status_enabled = 1; // enabled
_prefs.mqtt_packets_enabled = 1; // enabled
_prefs.mqtt_raw_enabled = 0; // disabled
_prefs.mqtt_tx_enabled = 0; // disabled (RX only for now)
_prefs.mqtt_tx_enabled = 2; // advert: own adverts only (matches MQTTPrefs default)
_prefs.mqtt_rx_enabled = 1; // RX packets enabled by default
_prefs.mqtt_status_interval = 300000; // 5 minutes
+2 -4
View File
@@ -125,9 +125,7 @@ void CommonCLI::loadPrefs(FILESYSTEM* fs) {
syncMQTTPrefsToNodePrefs();
// For MQTT bridge, migrate bridge.source to RX (logRx) only on fresh installs or upgrades
// This ensures new users get the correct default, but respects existing user choices
// MQTT bridge with TX requires mqtt.tx to be enabled (disabled by default),
// so RX is the sensible default for MQTT bridge installations
// so legacy "tx" is not the default. mqtt.rx / mqtt.tx are separate (fresh default: advert for TX)
if ((is_fresh_install || is_upgrade) && _prefs->bridge_pkt_src == 0) {
MESH_DEBUG_PRINTLN("MQTT Bridge: Migrating bridge.source from tx to rx (MQTT bridge default)");
_prefs->bridge_pkt_src = 1; // Set to RX (logRx)
@@ -364,7 +362,7 @@ static void setMQTTPrefsDefaults(MQTTPrefs* prefs) {
prefs->mqtt_status_enabled = 1; // enabled by default
prefs->mqtt_packets_enabled = 1; // enabled by default
prefs->mqtt_raw_enabled = 0; // disabled by default
prefs->mqtt_tx_enabled = 0; // disabled by default
prefs->mqtt_tx_enabled = 2; // advert: own adverts only, by default
prefs->mqtt_rx_enabled = 1; // RX packets enabled by default
prefs->mqtt_status_interval = 300000; // 5 minutes default
// Slot presets: analyzer-us and analyzer-eu enabled by default, rest = none