From 56e2e76954257e34f66f8ab68268bae3b3299245 Mon Sep 17 00:00:00 2001 From: Torrie Fischer Date: Sat, 18 Feb 2023 15:43:15 +0100 Subject: [PATCH] platform: provide free ram metrics --- src/Platform.cpp | 8 ++++++++ src/Platform.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/Platform.cpp b/src/Platform.cpp index 5af4b42..b8f389e 100644 --- a/src/Platform.cpp +++ b/src/Platform.cpp @@ -68,6 +68,14 @@ Platform::version() #endif } +int +Platform::freeRam() +{ +#ifdef BOARD_ESP8266 + return ESP.getFreeHeap(); +#endif +} + void Platform::preSetup() { diff --git a/src/Platform.h b/src/Platform.h index c07ee15..3989270 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -32,6 +32,7 @@ class Platform : public Task { void loop() override; static bool getLocalTime(struct tm* timedata); static const char* deviceID(); + static int freeRam(); struct TaskRegistration { Task* task = 0;