Improve rss_monitor startup (#346) 04/27/2022

And shut down if we hae no wifi to monitor
This commit is contained in:
Tim Wilkinson 2022-04-27 08:38:54 -07:00 committed by GitHub
parent 3f2adcc002
commit 7aff95711e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -35,14 +35,17 @@
--]] --]]
function rssi_monitor() function rssi_monitor()
if string.match(get_ifname("wifi"), "^eth.") then
exit_app()
else
wait_for_ticks(math.max(1, 120 - nixio.sysinfo().uptime))
while true while true
do do
if not string.match(get_ifname("wifi"), "^eth.") and nixio.sysinfo().uptime > 119 then
run_monitor() run_monitor()
end
wait_for_ticks(60) -- 1 minute wait_for_ticks(60) -- 1 minute
end end
end end
end
local datfile = "/tmp/rssi.dat" local datfile = "/tmp/rssi.dat"
local logfile = "/tmp/rssi.log" local logfile = "/tmp/rssi.log"