Update cursors on each lqm iteration. (#1067)

If we dont, and other apps change values in the config files, old
cursors dont see the new values.
This commit is contained in:
Tim Wilkinson 2024-01-17 11:43:52 -08:00 committed by GitHub
parent e08e0feae5
commit fb0f9a4b56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -194,11 +194,8 @@ function canonical_hostname(hostname)
return hostname
end
local cursor = uci.cursor()
local cursorm = uci.cursor("/etc/config.mesh")
local myhostname = canonical_hostname(info.get_nvram("node") or "localnode")
local myip = cursor:get("network", "wifi", "ipaddr")
local myip = uci.cursor():get("network", "wifi", "ipaddr")
-- Clear old data
local f = io.open("/tmp/lqm.info", "w")
@ -222,7 +219,7 @@ end
function lqm()
if cursor:get("aredn", "@lqm[0]", "enable") ~= "1" then
if uci.cursor():get("aredn", "@lqm[0]", "enable") ~= "1" then
exit_app()
return
end
@ -275,6 +272,9 @@ function lqm()
local config = get_config()
local cursor = uci.cursor()
local cursorm = uci.cursor("/etc/config.mesh")
local lat = cursor:get("aredn", "@location[0]", "lat")
local lon = cursor:get("aredn", "@location[0]", "lon")
lat = tonumber(lat)