mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-02-03 04:12:41 -05:00
refactor: simplify position requests
This commit is contained in:
@@ -1894,7 +1894,13 @@ class MeshService : Service(), Logging {
|
||||
override fun requestPosition(destNum: Int, position: Position) = toRemoteExceptions {
|
||||
if (destNum != myNodeNum) {
|
||||
// request position
|
||||
sendPosition(destNum = destNum, wantResponse = true)
|
||||
sendToRadio(newMeshPacketTo(destNum).buildMeshPacket(
|
||||
channel = nodeDBbyNodeNum[destNum]?.channel ?: 0,
|
||||
priority = MeshPacket.Priority.BACKGROUND,
|
||||
) {
|
||||
portnumValue = Portnums.PortNum.POSITION_APP_VALUE
|
||||
wantResponse = true
|
||||
})
|
||||
} else {
|
||||
// send fixed position (local only/no remote method, so we force destNum to null)
|
||||
val (lat, lon, alt) = position
|
||||
@@ -1924,7 +1930,6 @@ class MeshService : Service(), Logging {
|
||||
channel = nodeDBbyNodeNum[destNum]?.channel ?: 0,
|
||||
) {
|
||||
portnumValue = Portnums.PortNum.TRACEROUTE_APP_VALUE
|
||||
payload = routeDiscovery {}.toByteString()
|
||||
wantResponse = true
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user