mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-21 02:02:23 +00:00
Put guards in place around debug heap operations (#7955)
* Put guards in place around debug heap operations * Add macros to clean up code * Add pointer as well
This commit is contained in:
@@ -193,11 +193,9 @@ 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();
|
||||
DEBUG_HEAP_BEFORE;
|
||||
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);
|
||||
|
||||
DEBUG_HEAP_AFTER("MeshService::handleToRadio", a);
|
||||
sendToMesh(a, RX_SRC_USER);
|
||||
|
||||
bool loopback = false; // if true send any packet the phone sends back itself (for testing)
|
||||
@@ -254,10 +252,9 @@ 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
|
||||
auto heapBefore = memGet.getFreeHeap();
|
||||
DEBUG_HEAP_BEFORE;
|
||||
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);
|
||||
DEBUG_HEAP_AFTER("MeshService::sendToMesh", a);
|
||||
|
||||
sendToPhone(a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user