dynamic nodenum assignment now works

This commit is contained in:
geeksville
2020-02-08 12:42:54 -08:00
parent b262492c75
commit 422e213d2a
7 changed files with 148 additions and 130 deletions

View File

@@ -95,6 +95,8 @@ ErrorCode MeshRadio::send(MeshPacket *p)
ErrorCode MeshRadio::sendTo(NodeNum dest, const uint8_t *buf, size_t len)
{
// We must do this before each send, because we might have just changed our nodenum
manager.setThisAddress(nodeDB.getNodeNum()); // Note: we must do this here, because the nodenum isn't inited at constructor time.
assert(len <= 251); // Make sure we don't overflow the tiny max packet size
@@ -109,7 +111,7 @@ ErrorCode MeshRadio::sendTo(NodeNum dest, const uint8_t *buf, size_t len)
if(res == ERRNO_OK)
manager.waitPacketSent();
DEBUG_MSG("mesh sendTo %d bytes to 0x%x (%u msecs)\n", len, dest, millis() - start);
DEBUG_MSG("mesh sendTo %d bytes to 0x%x (%lu msecs)\n", len, dest, millis() - start);
return res;
}