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