Commit 65ce6ee8 authored by Eric Duminil's avatar Eric Duminil
Browse files

More heap info

parent dc43e04e
Pipeline #3213 passed with stage
in 1 minute and 38 seconds
......@@ -52,8 +52,14 @@ namespace ntp {
void Ampel::showFreeSpace() {
Serial.print(F("Free heap space : "));
Serial.print(get_free_heap_size());
Serial.print(ESP.getFreeHeap());
Serial.println(F(" bytes."));
Serial.print(F("Max free block size : "));
Serial.print(esp_get_max_free_block_size());
Serial.println(F(" bytes."));
Serial.print(F("Heap fragmentation : "));
Serial.print(esp_get_heap_fragmentation());
Serial.println(F(" %"));
}
char sensorId[10]; // e.g "ESPxxxxxx\0"
......
......@@ -9,10 +9,12 @@
#if defined(ESP8266)
# include <ESP8266WiFi.h> // required to get MAC address
# define get_free_heap_size() system_get_free_heap_size()
# define esp_get_max_free_block_size() ESP.getMaxFreeBlockSize()
# define esp_get_heap_fragmentation() ESP.getHeapFragmentation()
#elif defined(ESP32)
# include <WiFi.h> // required to get MAC address
# define get_free_heap_size() esp_get_free_heap_size()
# define esp_get_max_free_block_size() ESP.getMaxAllocHeap() //largest block of heap that can be allocated.
# define esp_get_heap_fragmentation() "?" // apparently not available for ESP32
#endif
namespace ntp {
......
......@@ -112,6 +112,7 @@ namespace web_server {
"<tr><td>Local address</td><td><a href='http://%s.local/'>%s.local</a></td></tr>\n"
"<tr><td>Local IP</td><td><a href='http://%s'>%s</a></td></tr>\n"
"<tr><td>Free heap space</td><td>%6d bytes</td></tr>\n"
"<tr><td>Largest heap block</td><td>%6d bytes</td></tr>\n"
"<tr><td>Max loop duration</td><td>%5d ms</td></tr>\n"
"<tr><td>Board</td><td>%s</td></tr>\n"
"<tr><td>Uptime</td><td>%2d d %4d h %02d min %02d s</td></tr>\n"
......@@ -237,7 +238,8 @@ namespace web_server {
config::lorawan_sending_interval,
#endif
config::temperature_offset, config::auto_calibrate_sensor ? "Yes" : "No", ampel.sensorId, ampel.sensorId,
wifi::local_ip, wifi::local_ip, get_free_heap_size(), ampel.max_loop_duration, ampel.board, dd, hh, mm, ss);
wifi::local_ip, wifi::local_ip, ESP.getFreeHeap(), esp_get_max_free_block_size(), ampel.max_loop_duration,
ampel.board, dd, hh, mm, ss);
Serial.print(F(" - Body size : "));
http.sendContent(content);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment