Ignore less acurate updates
This commit is contained in:
parent
93f4ae4beb
commit
73041e6581
|
@ -31,6 +31,16 @@ func mqtt_recv(id string, loc Location) {
|
|||
if !loc.IsPlausible() { // Ignore stupid locations
|
||||
return
|
||||
}
|
||||
if old, ok := devices[id]; ok { // if we already have a location
|
||||
if loc.Acc > old.Acc {
|
||||
// Ignore, if the new location is less precise, and the old one lies within it's accuracy
|
||||
// This might happen, if there is a provider switch on the phone (e.g. GPX -> coarse location)
|
||||
distance := old.Distance(loc)
|
||||
if distance <= loc.Acc {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
devices[id] = loc
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue