Handle missing ip and more general RF/DTD identification

This commit is contained in:
Tim Wilkinson 2023-01-13 10:19:57 -08:00 committed by Joe AE6XE
parent a22493c7d1
commit e0498ca856
1 changed files with 19 additions and 14 deletions

View File

@ -511,6 +511,7 @@ function lqm()
do
if not rtrack.type or rtrack.type == "RF" then
local rhostname = canonical_hostname(rtrack.hostname)
if rtrack.ip then
local rdistance = nil
if tonumber(rtrack.lat) and tonumber(rtrack.lon) and lat and lon then
rdistance = calc_distance(lat, lon, tonumber(rtrack.lat), tonumber(rtrack.lon))
@ -520,6 +521,7 @@ function lqm()
hostname = rhostname,
distance = rdistance
}
end
if myhostname == rhostname then
if not old_rev_snr or not rtrack.snr then
track.rev_snr = rtrack.snr
@ -645,13 +647,16 @@ function lqm()
if track.type == "RF" then
-- If we have a direct dtd connection to this device, make sure we use that
local a, b, c = track.mac:match("^(..:..:..:)(..)(:..:..)$")
local dtd = tracker[string.format("%s%02X%s", a, tonumber(b, 16) + 1, c)]
if dtd and dtd.type == "DtD" and dtd.distance and dtd.distance < dtd_distance then
for _, dtd in pairs(tracker) do
if dtd.type == "DtD" and dtd.hostname == track.hostname then
if dtd.distance and dtd.distance < dtd_distance then
track.blocks.dtd = true
else
track.blocks.dtd = false
end
break
end
end
-- When unblocked link signal becomes too low, block
if not track.blocks.signal then