Skip to content

Commit b170b9d

Browse files
committed
Update example
1 parent c543912 commit b170b9d

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

examples/Json/Json.ino

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ void setup() {
5656
JsonDocument doc;
5757
JsonObject root = doc.to<JsonObject>();
5858
root["foo"] = "bar";
59-
serializeJson(root, *response);
60-
Serial.println();
59+
// serializeJson(root, Serial);
60+
// Serial.println();
6161
request->send(response);
6262
});
6363

@@ -105,7 +105,19 @@ void setup() {
105105
server.begin();
106106
}
107107

108-
// not needed
108+
static uint32_t lastHeapTime = 0;
109+
static uint32_t lastHeap = 0;
110+
109111
void loop() {
110-
delay(100);
112+
#ifdef ESP32
113+
uint32_t now = millis();
114+
if (now - lastHeapTime >= 500) {
115+
uint32_t heap = ESP.getFreeHeap();
116+
if (heap != lastHeap) {
117+
lastHeap = heap;
118+
async_ws_log_w("Free heap: %" PRIu32, heap);
119+
}
120+
lastHeapTime = now;
121+
}
122+
#endif
111123
}

0 commit comments

Comments
 (0)