diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 6d0da8ced..0f543ec34 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -623,7 +623,7 @@ void CmndStatus(void) ",\"" D_JSON_FLASHCHIPID "\":\"%06X\"" #endif // ESP8266 ",\"FlashFrequency\":%d,\"" D_JSON_FLASHMODE "\":%d"), - ESP_getSketchSize()/1024, ESP.getFreeSketchSpace()/1024, ESP_getFreeHeap1024(), + ESP_getSketchSize()/1024, ESP_getFreeSketchSpace()/1024, ESP_getFreeHeap1024(), #ifdef ESP32 uxTaskGetStackHighWaterMark(nullptr) / 1024, ESP.getPsramSize()/1024, ESP.getFreePsram()/1024, #endif // ESP32 diff --git a/tasmota/support_esp.ino b/tasmota/support_esp.ino index 5e960166d..6e81a0630 100644 --- a/tasmota/support_esp.ino +++ b/tasmota/support_esp.ino @@ -45,6 +45,10 @@ uint32_t ESP_getChipId(void) { return ESP.getChipId(); } +uint32_t ESP_getFreeSketchSpace(void) { + return ESP.getFreeSketchSpace(); +} + uint32_t ESP_getSketchSize(void) { return ESP.getSketchSize(); } @@ -454,6 +458,13 @@ uint32_t ESP_getChipId(void) { return id; } +uint32_t ESP_getFreeSketchSpace(void) { + if (EspSingleOtaPartition()) { + return 0xD0000; // SafeBoot (factory) partition size + } + return ESP.getFreeSketchSpace(); +} + uint32_t ESP_getSketchSize(void) { static uint32_t sketchsize = 0; diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 4489b5576..f8df04274 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -2460,7 +2460,7 @@ void HandleInformation(void) WSContentSend_P(PSTR("}1" D_PROGRAM_FLASH_SIZE "}2%d kB"), ESP.getFlashChipSize() / 1024); #endif WSContentSend_P(PSTR("}1" D_PROGRAM_SIZE "}2%d kB"), ESP_getSketchSize() / 1024); - WSContentSend_P(PSTR("}1" D_FREE_PROGRAM_SPACE "}2%d kB"), ESP.getFreeSketchSpace() / 1024); + WSContentSend_P(PSTR("}1" D_FREE_PROGRAM_SPACE "}2%d kB"), ESP_getFreeSketchSpace() / 1024); #ifdef ESP32 WSContentSend_PD(PSTR("}1" D_FREE_MEMORY "}2%1_f kB (" D_FRAGMENTATION " %d%%)"), &freemem, ESP_getHeapFragmentation()); if (UsePSRAM()) { @@ -2786,7 +2786,7 @@ void HandleUploadLoop(void) { } // upload.buf[2] = 3; // Force DOUT - ESP8285 } - uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000; + uint32_t maxSketchSpace = (ESP_getFreeSketchSpace() - 0x1000) & 0xFFFFF000; if (!Update.begin(maxSketchSpace)) { //start with max available size Web.upload_error = 2; // Not enough space return; diff --git a/tasmota/xdrv_52_3_berry_tasmota.ino b/tasmota/xdrv_52_3_berry_tasmota.ino index 3e2c85f13..6a1453d15 100644 --- a/tasmota/xdrv_52_3_berry_tasmota.ino +++ b/tasmota/xdrv_52_3_berry_tasmota.ino @@ -184,7 +184,7 @@ extern "C" { be_newobject(vm, "map"); be_map_insert_int(vm, "flash", ESP.getFlashChipSize() / 1024); be_map_insert_int(vm, "program", ESP_getSketchSize() / 1024); - be_map_insert_int(vm, "program_free", ESP.getFreeSketchSpace() / 1024); + be_map_insert_int(vm, "program_free", ESP_getFreeSketchSpace() / 1024); be_map_insert_int(vm, "heap_free", ESP_getFreeHeap() / 1024); be_map_insert_int(vm, "frag", ESP_getHeapFragmentation()); // give info about stack size