Fix LQM reporting and toggle (#1483)

This commit is contained in:
Tim Wilkinson 2024-09-10 10:18:58 -07:00 committed by GitHub
parent 21dccaaeb1
commit 4a8cd83217
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 19 deletions

View File

@ -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") {
<input hx-put="{{request.env.REQUEST_URI}}" name="{{prefix}}ssid" type="text" size="10" maxlength="32" pattern="[^!#;+\]\/"\t][^+\]\/"\t]{0,30}[^ !#;+\]\/"\t]$|^[^ !#;+\]\/"\t]" value="{{wlan[w].modes[1].ssid}}"><span style="color:var(--ctrl-modal-fg-color)">-{{wlan[w].modes[1].bandwidth}}-v3</span>
</div>
</div>
{% if (uciMesh.get("aredn", "@lqm[0]", "lqm_enable") !== "0") { %}
{% if (uciMesh.get("aredn", "@lqm[0]", "enable") !== "0") { %}
<div class="cols">
<div>
<div class="o">Minimum SNR</div>
@ -479,7 +479,7 @@ if (request.env.REQUEST_METHOD === "DELETE") {
<div class="m">Enable Link Quality Management</div>
</div>
<div style="flex:0">
{{_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" })}}
</div>
</div>
{{_H("Link Quality Management (LQM) is an automatic management system which monitors the efficiency of each neighbor link

View File

@ -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