Skip to content

Commit

Permalink
Debugging on ESP32
Browse files Browse the repository at this point in the history
  • Loading branch information
willmmiles committed Feb 14, 2024
1 parent 2e7a84f commit 09a4797
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/WebResponses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
#define DEBUG_PRINTFP(...)
#endif

#ifdef ESP8266
#define GET_MAX_BLOCK_SIZE getMaxFreeBlockSize
#else
#define GET_MAX_BLOCK_SIZE getMaxAllocHeap
#endif

// Since ESP8266 does not link memchr by default, here's its implementation.
void* memchr(void* ptr, int ch, size_t count)
{
Expand Down Expand Up @@ -406,7 +412,7 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u
_packet.erase(_packet.begin(), _packet.begin() + acceptedLen);
if (acceptedLen < outLen) {
// Save the unsent block in cache
DEBUG_PRINTFP("(%d) Incomplete write, %d/%d\nHeap: %d/%d\nSpace:%d\n", (intptr_t) this, acceptedLen, outLen, ESP.getMaxFreeBlockSize(), ESP.getFreeHeap(), request->client()->space());
DEBUG_PRINTFP("(%d) Incomplete write, %d/%d\nHeap: %d/%d\nSpace:%d\n", (intptr_t) this, acceptedLen, outLen, ESP.GET_MAX_BLOCK_SIZE(), ESP.getFreeHeap(), request->client()->space());
// Try again, with less
acceptedLen = request->client()->write((const char*)_packet.data(), _packet.size()/2);
_writtenLength += acceptedLen;
Expand Down

0 comments on commit 09a4797

Please sign in to comment.