work with old devices that still use 8 bit addresses

This commit is contained in:
geeksville
2020-06-07 22:15:47 -07:00
parent 6a71e6c414
commit f16d0d8cf5

View File

@@ -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
}
/**