mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-10-08 11:31:24 -04:00
work with old devices that still use 8 bit addresses
This commit is contained in:
1 parent
6a71e6c414
commit
f16d0d8cf5
1 file changed
+5
-1
@@ -687,11 +687,15 @@ class MeshService : Service(), Logging {
|
||||
|
||||
/// Generate a new mesh packet builder with our node as the sender, and the specified node num
|
||||
private fun newMeshPacketTo(idNum: Int) = MeshPacket.newBuilder().apply {
|
||||
val useShortAddresses = (myNodeInfo?.nodeNumBits ?: 8) != 32
|
||||
|
||||
if (myNodeInfo == null)
|
||||
throw RadioNotConnectedException()
|
||||
|
||||
from = myNodeNum
|
||||
to = idNum
|
||||
|
||||
// We might need to change broadcast addresses to work with old device loads
|
||||
to = if (useShortAddresses && idNum == NODENUM_BROADCAST) 255 else idNum
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user