mirror of https://github.com/aredn/aredn.git
Better handling of missing lat/lon when GPS is starting up (#1323)
This commit is contained in:
parent
b2d0b2980b
commit
4ce3a6c554
|
@ -583,10 +583,8 @@ function hardware.gps_read_llt(gps, maxlines)
|
|||
local j = gps_read(s)
|
||||
if j.class == "TPV" then
|
||||
info.time = j.time:gsub("T", " "):gsub(".000Z", "")
|
||||
if j.lat then
|
||||
if j.lat and j.lon then
|
||||
info.lat = tonumber(string.format("%.5f", j.lat))
|
||||
end
|
||||
if j.lon then
|
||||
info.lon = tonumber(string.format("%.5f", j.lon))
|
||||
end
|
||||
break
|
||||
|
|
|
@ -81,7 +81,7 @@ function app.run()
|
|||
end
|
||||
|
||||
-- Set location if significantly changed
|
||||
if c:get("aredn", "@location[0]", "gps_enable") == "1" then
|
||||
if c:get("aredn", "@location[0]", "gps_enable") == "1" and j.lat and j.lon then
|
||||
local clat = tonumber(c:get("aredn", "@location[0]", "lat") or 0)
|
||||
local clon = tonumber(c:get("aredn", "@location[0]", "lon") or 0)
|
||||
if math.abs(clat - j.lat) > CHANGEMARGIN or math.abs(clon - j.lon) > CHANGEMARGIN then
|
||||
|
|
Loading…
Reference in New Issue