From d0e5e3434fe328ffa65e386c5e6935b8002c2df0 Mon Sep 17 00:00:00 2001 From: Luc <8822552+luc-github@users.noreply.github.com> Date: Sun, 14 Jun 2020 10:53:22 +0200 Subject: [PATCH] Fix sketch size calculation if 1MB flash --- esp3d/src/modules/filesystem/esp_filesystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esp3d/src/modules/filesystem/esp_filesystem.cpp b/esp3d/src/modules/filesystem/esp_filesystem.cpp index 8456aac8..75c46597 100644 --- a/esp3d/src/modules/filesystem/esp_filesystem.cpp +++ b/esp3d/src/modules/filesystem/esp_filesystem.cpp @@ -62,9 +62,9 @@ size_t ESP_FileSystem::max_update_size() size_t flashsize = 0; #if defined (ARDUINO_ARCH_ESP8266) flashsize = ESP.getFlashChipSize(); - //if higher than 1MB take out SPIFFS + //if higher than 1MB or not (no more support for 512KB flash) if (flashsize <= 1024 * 1024) { - flashsize = (1024 * 1024)-ESP.getSketchSize()-1024; + flashsize = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000; } else { flashsize = flashsize - ESP.getSketchSize()-totalBytes()-1024; //max OTA partition is 1019Kb