mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: add fixed position admin messages
This commit is contained in:
parent
2c916f88ca
commit
6e3e173096
4 changed files with 33 additions and 15 deletions
|
|
@ -1864,13 +1864,24 @@ class MeshService : Service(), Logging {
|
|||
}
|
||||
|
||||
override fun requestPosition(destNum: Int, position: Position) = toRemoteExceptions {
|
||||
if (position == Position(0.0, 0.0, 0)) {
|
||||
if (destNum != myNodeNum) {
|
||||
// request position
|
||||
sendPosition(destNum = destNum, wantResponse = true)
|
||||
} else {
|
||||
// send fixed position (local only/no remote method, so we force destNum to null)
|
||||
val (lat, lon, alt) = position
|
||||
sendPosition(destNum = null, lat = lat, lon = lon, alt = alt)
|
||||
sendToRadio(newMeshPacketTo(destNum).buildAdminPacket {
|
||||
if (position != Position(0.0, 0.0, 0)) {
|
||||
setFixedPosition = position {
|
||||
longitudeI = Position.degI(lon)
|
||||
latitudeI = Position.degI(lat)
|
||||
altitude = alt
|
||||
}
|
||||
} else {
|
||||
removeFixedPosition = true
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue