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,15 +511,17 @@ 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)
local rdistance = nil if rtrack.ip then
if tonumber(rtrack.lat) and tonumber(rtrack.lon) and lat and lon then local rdistance = nil
rdistance = calc_distance(lat, lon, tonumber(rtrack.lat), tonumber(rtrack.lon)) if tonumber(rtrack.lat) and tonumber(rtrack.lon) and lat and lon then
rdistance = calc_distance(lat, lon, tonumber(rtrack.lat), tonumber(rtrack.lon))
end
rflinks[track.mac][rtrack.ip] = {
ip = rtrack.ip,
hostname = rhostname,
distance = rdistance
}
end end
rflinks[track.mac][rtrack.ip] = {
ip = rtrack.ip,
hostname = rhostname,
distance = rdistance
}
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,12 +647,15 @@ 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
break
end
end end
-- When unblocked link signal becomes too low, block -- When unblocked link signal becomes too low, block