fix restrictions to provide location to mesh

1.2-legacy
Andre Kirchhoff 2022-01-14 18:49:08 -03:00 zatwierdzone przez GitHub
rodzic 01657fc0ef
commit 12f864bae3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 13 dodań i 11 usunięć

Wyświetl plik

@ -183,12 +183,14 @@ class MeshService : Service(), Logging {
// if android called us too soon, just ignore
val myInfo = localNodeInfo
val lastLat = (myInfo?.position?.latitude ?: 0.0)
val lastLon = (myInfo?.position?.longitude ?: 0.0)
val lastSendMsec = (myInfo?.position?.time ?: 0) * 1000L
val now = System.currentTimeMillis()
if (now - lastSendMsec < locationIntervalMsec)
debug("Not sending position - the local node has sent one recently...")
else {
if ((lastLat == 0.0 && lastLon == 0.0) || (now - lastSendMsec > locationIntervalMsec)) // && minBroadcastPeriod ?
sendPosition(lat, lon, alt, destNum, wantResponse)
else {
debug("Not sending position - local node sent ${(now - lastSendMsec) / 1000L}s ago ${myInfo?.position?.toPIIString()}")
}
}
}
@ -1026,15 +1028,15 @@ class MeshService : Service(), Logging {
else
broadcastSecs * 1000L
if (prefs.locationShare == RadioConfigProtos.LocationSharing.LocDisabled) {
info("GPS location sharing is disabled")
desiredInterval = 0
}
// if (prefs.locationShare == RadioConfigProtos.LocationSharing.LocDisabled) {
// info("GPS location sharing is disabled")
// desiredInterval = 0
// }
if (prefs.fixedPosition) {
info("Node has fixed position, therefore not overriding position")
desiredInterval = 0
}
// if (prefs.fixedPosition) {
// info("Node has fixed position, therefore not overriding position")
// desiredInterval = 0
// }
if (desiredInterval != 0L) {
info("desired GPS assistance interval $desiredInterval")