From 639c07a414cc750c35953559d925c65e487d137f Mon Sep 17 00:00:00 2001 From: agessaman Date: Thu, 16 Jul 2026 18:35:21 -0700 Subject: [PATCH] feat(webconfig): enhance web configuration with flood and loop settings Add new configuration options for flood traffic management and loop detection in the web interface. This includes parameters for maximum flood hops, maximum advert hops, and loop detection modes, improving the control over mesh network behavior. --- src/helpers/esp32/WebConfigServer.cpp | 9 ++++- webui/index.html | 50 ++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/helpers/esp32/WebConfigServer.cpp b/src/helpers/esp32/WebConfigServer.cpp index 41e06307e..60578df11 100644 --- a/src/helpers/esp32/WebConfigServer.cpp +++ b/src/helpers/esp32/WebConfigServer.cpp @@ -26,7 +26,8 @@ static const char SECRET_SENTINEL[] = "********"; static const char* const ALLOWED_SET_KEYS[] = { // NodePrefs (radio / node) "name", "lat", "lon", "radio", "tx", "af", "rxdelay", "txdelay", - "cad", "radio.rxgain", "advert.interval", "flood.advert.interval", + "cad", "radio.rxgain", "repeat", "advert.interval", "flood.advert.interval", + "flood.max", "flood.max.advert", "flood.max.unscoped", "loop.detect", // MQTTPrefs (WiFi / MQTT / misc observer) "wifi.ssid", "wifi.pwd", "wifi.powersave", "mqtt.origin", "mqtt.iata", "mqtt.status", "mqtt.packets", "mqtt.raw", @@ -471,6 +472,12 @@ void WebConfigServer::handleConfigGet(AsyncWebServerRequest* req) { radio["txdelay"] = _prefs->tx_delay_factor; radio["cad"] = (bool)_prefs->cad_enabled; radio["rxgain"] = (bool)_prefs->rx_boosted_gain; + radio["repeat"] = !(bool)_prefs->disable_fwd; // CLI `repeat on` == disable_fwd 0 + radio["flood_max"] = _prefs->flood_max; + radio["flood_max_advert"] = _prefs->flood_max_advert; + radio["flood_max_unscoped"] = _prefs->flood_max_unscoped; + static const char* const LOOP_MODES[] = { "off", "minimal", "moderate", "strict" }; + radio["loop_detect"] = LOOP_MODES[_prefs->loop_detect <= LOOP_DETECT_STRICT ? _prefs->loop_detect : 0]; radio["name"] = (const char*)_prefs->node_name; radio["lat"] = _prefs->node_lat; radio["lon"] = _prefs->node_lon; diff --git a/webui/index.html b/webui/index.html index a9024350c..4be749714 100644 --- a/webui/index.html +++ b/webui/index.html @@ -255,7 +255,8 @@ canvas{width:100%;height:56px;display:block}

Advanced

-
+
+
@@ -263,6 +264,8 @@ canvas{width:100%;height:56px;display:block}
RX boosted gainSX126x receivers only
+
RepeatForward mesh traffic. Off = listen-only (still observes and publishes). +
0 = off
@@ -270,6 +273,21 @@ canvas{width:100%;height:56px;display:block}
0 = off, else 3–168
+
+

Flooding & loops

+
Hop limits for flood traffic this node forwards. Lower values contain noisy neighbours; too low takes parts of the mesh out of reach.
+
+
+
0–64. Default 64.
+
+
0–64. Default 8.
+
+
+
Applies to packets with no region scope. 0–64.
+
+ +
Drops flood packets that already carry this node's hash. Stricter = fewer repeats tolerated before dropping.
+
@@ -284,17 +302,19 @@ canvas{width:100%;height:56px;display:block}

Publishing

-
Status messagesPeriodic node status +
This node only ever uploads to MQTT — nothing from a broker is injected into the mesh.
+
Node statusPeriodic health/stats to the status topic
-
Packet metadataDecoded packet summaries +
Publish packetsMaster switch for all packet traffic below
-
Raw packetsFull undecoded frames +
Add raw framesAlso send the full hex frame to the raw topic
-
RX from MQTTAccept downlink packets +
Received packetsReport packets heard over the air
-
-
+
+ +
Report packets this node sends.
@@ -469,6 +489,11 @@ function cfgVal(k){ // map a `set` key to its current value string, from st.cfg case"tx":return String(r.tx);case"af":return String(r.af); case"rxdelay":return String(r.rxdelay);case"txdelay":return String(r.txdelay); case"cad":return r.cad?"on":"off";case"radio.rxgain":return r.rxgain?"on":"off"; + case"repeat":return r.repeat?"on":"off"; + case"flood.max":return String(r.flood_max); + case"flood.max.advert":return String(r.flood_max_advert); + case"flood.max.unscoped":return String(r.flood_max_unscoped); + case"loop.detect":return r.loop_detect; case"advert.interval":return String(r.advert_interval); case"flood.advert.interval":return String(r.flood_advert_interval); case"wifi.ssid":return w.ssid;case"wifi.pwd":return w.pwd;case"wifi.powersave":return w.powersave; @@ -504,7 +529,7 @@ function loadConfig(){ var lab=el.closest(".f");var ch=lab&&lab.querySelector(".chip");if(ch)ch.remove(); }); $$("[data-rg]").forEach(function(el){el.value=String(c.radio[el.dataset.rg]);el.classList.remove("dirty")}); - st.orig.radio=radioCombo(); + st.orig.radio=radioCombo();afHint(); for(var i=1;i<=st.nslots;i++){refreshSlotFields($("#app-slots"),i);refreshSlotFields($("#wz-slots"),i)} updateSaveBar(); }); @@ -512,8 +537,17 @@ function loadConfig(){ function markDirty(k,v,el){ if(v===st.orig[k]){delete st.dirty[k]}else{st.dirty[k]=v} if(el)el.classList.toggle("dirty",k in st.dirty); + if(k==="af")afHint(); updateSaveBar(); } +// The CLI's `dutycycle` is not its own pref — it just writes airtime_factor as +// 100/(dc)-1. Showing the equivalent duty cycle beside `af` gives the number +// operators actually reason about without a second field fighting over one pref. +function afHint(){ + var e=$("#af-dc");if(!e)return; + var af=parseFloat($('[data-k="af"]').value); + e.textContent=isFinite(af)&&af>=0?"≈ "+(Math.round(1000/(af+1))/10)+"% duty cycle":""; +} document.addEventListener("input",function(ev){ var el=ev.target; if(el.dataset.k){