From 4a8cd83217b2ce10d8ebd3689e15c0748261d7c0 Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Tue, 10 Sep 2024 10:18:58 -0700 Subject: [PATCH] Fix LQM reporting and toggle (#1483) --- files/app/main/status/e/radio-and-antenna.ut | 6 ++-- files/www/cgi-bin/sysinfo.json | 32 ++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/files/app/main/status/e/radio-and-antenna.ut b/files/app/main/status/e/radio-and-antenna.ut index 123e74aa..0d7bdb49 100755 --- a/files/app/main/status/e/radio-and-antenna.ut +++ b/files/app/main/status/e/radio-and-antenna.ut @@ -152,7 +152,7 @@ if (request.env.REQUEST_METHOD === "PUT") { uciMesh.set("aredn", "@location[0]", "elevation", request.args.radio_elevation); } if ("radio_lqm_enable" in request.args) { - uciMesh.set("aredn", "@lqm[0]", "lqm_enable", request.args.radio_lqm_enable === "on" ? 1 : 0); + uciMesh.set("aredn", "@lqm[0]", "enable", request.args.radio_lqm_enable === "on" ? 1 : 0); } if ("radio_mindistance" in request.args) { uciMesh.set("aredn", "@lqm[0]", "min_distance", request.args.radio_mindistance); @@ -278,7 +278,7 @@ if (request.env.REQUEST_METHOD === "DELETE") { -{{wlan[w].modes[1].bandwidth}}-v3 - {% if (uciMesh.get("aredn", "@lqm[0]", "lqm_enable") !== "0") { %} + {% if (uciMesh.get("aredn", "@lqm[0]", "enable") !== "0") { %}
Minimum SNR
@@ -479,7 +479,7 @@ if (request.env.REQUEST_METHOD === "DELETE") {
Enable Link Quality Management
- {{_R("switch", { name: "radio_lqm_enable", value: uciMesh.get("aredn", "@lqm[0]", "lqm_enable") !== "0" })}} + {{_R("switch", { name: "radio_lqm_enable", value: uciMesh.get("aredn", "@lqm[0]", "enable") !== "0" })}}
{{_H("Link Quality Management (LQM) is an automatic management system which monitors the efficiency of each neighbor link diff --git a/files/www/cgi-bin/sysinfo.json b/files/www/cgi-bin/sysinfo.json index ea50b887..27f30c6d 100755 --- a/files/www/cgi-bin/sysinfo.json +++ b/files/www/cgi-bin/sysinfo.json @@ -183,22 +183,22 @@ if string.find(nixio.getenv("QUERY_STRING"):lower(),"lqm=1") then local lqm = { enabled = false } if ctx:get("aredn", "@lqm[0]", "enable") == "1" then lqm.enabled = true - lqm.config = { - min_snr = tonumber(ctx:get("aredn", "@lqm[0]", "min_snr")), - margin_snr = tonumber(ctx:get("aredn", "@lqm[0]", "margin_snr")), - min_distance = tonumber(ctx:get("aredn", "@lqm[0]", "min_distance")), - max_distance = tonumber(ctx:get("aredn", "@lqm[0]", "max_distance")), - auto_distance = tonumber(ctx:get("aredn", "@lqm[0]", "auto_distance") or "0"), - min_quality = tonumber(ctx:get("aredn", "@lqm[0]", "min_quality")), - margin_quality = tonumber(ctx:get("aredn", "@lqm[0]", "margin_quality")), - ping_penalty = tonumber(ctx:get("aredn", "@lqm[0]", "ping_penalty")), - user_blocks = ctx:get("aredn", "@lqm[0]", "user_blocks"), - user_allows = ctx:get("aredn", "@lqm[0]", "user_allows") - } - lqm.info = {} - if nixio.fs.stat("/tmp/lqm.info") then - lqm.info = json.parse(io.open("/tmp/lqm.info", "r"):read("*a")) - end + end + lqm.config = { + min_snr = tonumber(ctx:get("aredn", "@lqm[0]", "min_snr")), + margin_snr = tonumber(ctx:get("aredn", "@lqm[0]", "margin_snr")), + min_distance = tonumber(ctx:get("aredn", "@lqm[0]", "min_distance")), + max_distance = tonumber(ctx:get("aredn", "@lqm[0]", "max_distance")), + auto_distance = tonumber(ctx:get("aredn", "@lqm[0]", "auto_distance") or "0"), + min_quality = tonumber(ctx:get("aredn", "@lqm[0]", "min_quality")), + margin_quality = tonumber(ctx:get("aredn", "@lqm[0]", "margin_quality")), + ping_penalty = tonumber(ctx:get("aredn", "@lqm[0]", "ping_penalty")), + user_blocks = ctx:get("aredn", "@lqm[0]", "user_blocks"), + user_allows = ctx:get("aredn", "@lqm[0]", "user_allows") + } + lqm.info = {} + if nixio.fs.stat("/tmp/lqm.info") then + lqm.info = json.parse(io.open("/tmp/lqm.info", "r"):read("*a")) end info['lqm']=lqm end