mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 10:42:49 +00:00
Add LOG_HEAP log type, and more heap debug messages (#7937)
This commit is contained in:
@@ -193,8 +193,12 @@ void MeshService::handleToRadio(meshtastic_MeshPacket &p)
|
||||
// (so we update our nodedb for the local node)
|
||||
|
||||
// Send the packet into the mesh
|
||||
auto heapBefore = memGet.getFreeHeap();
|
||||
auto a = packetPool.allocCopy(p);
|
||||
auto heapAfter = memGet.getFreeHeap();
|
||||
LOG_HEAP("Alloc in MeshService::handleToRadio() pointer 0x%x, size: %u, free: %u", a, heapBefore - heapAfter, heapAfter);
|
||||
|
||||
sendToMesh(packetPool.allocCopy(p), RX_SRC_USER);
|
||||
sendToMesh(a, RX_SRC_USER);
|
||||
|
||||
bool loopback = false; // if true send any packet the phone sends back itself (for testing)
|
||||
if (loopback) {
|
||||
@@ -250,7 +254,12 @@ void MeshService::sendToMesh(meshtastic_MeshPacket *p, RxSource src, bool ccToPh
|
||||
}
|
||||
|
||||
if ((res == ERRNO_OK || res == ERRNO_SHOULD_RELEASE) && ccToPhone) { // Check if p is not released in case it couldn't be sent
|
||||
sendToPhone(packetPool.allocCopy(*p));
|
||||
auto heapBefore = memGet.getFreeHeap();
|
||||
auto a = packetPool.allocCopy(*p);
|
||||
auto heapAfter = memGet.getFreeHeap();
|
||||
LOG_HEAP("Alloc in MeshService::sendToMesh() pointer 0x%x, size: %u, free: %u", a, heapBefore - heapAfter, heapAfter);
|
||||
|
||||
sendToPhone(a);
|
||||
}
|
||||
|
||||
// Router may ask us to release the packet if it wasn't sent
|
||||
|
||||
Reference in New Issue
Block a user