From 4aa3e27880522dfda8e8eb3763298785c9e8b670 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Mon, 20 Feb 2023 17:27:51 +0100 Subject: [PATCH] fix appfree display for asymmetric partitions. --- src/system.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/system.cpp b/src/system.cpp index 0f99ab9c1..207adeaae 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -18,6 +18,8 @@ #include "system.h" #include "emsesp.h" // for send_raw_telegram() command +#include "esp_ota_ops.h" + #include @@ -268,7 +270,6 @@ void System::syslog_init() { syslog_.mark_interval(0); syslog_.destination(""); } - if (Mqtt::publish_single()) { if (Mqtt::publish_single2cmd()) { Mqtt::publish("system/syslog", syslog_enabled_ ? (FL_(list_syslog_level)[syslog_level_ + 1]) : "off"); @@ -397,7 +398,7 @@ void System::start() { fstotal_ = LittleFS.totalBytes() / 1024; // read only once, it takes 500 ms to read psram_ = ESP.getPsramSize() / 1024; appused_ = ESP.getSketchSize() / 1024; - appfree_ = ESP.getFreeSketchSpace() / 1024 - appused_; + appfree_ = esp_ota_get_running_partition()->size / 1024 - appused_; refreshHeapMem(); // refresh free heap and max alloc heap #endif