Fix OTA update size not accurate on ESP32

Use proper function to get partition size instead of guessing doing wrong calculation
This commit is contained in:
Luc 2019-08-10 20:25:47 +02:00
parent 7bc15e1bd9
commit 6fc6df1577
3 changed files with 7 additions and 4 deletions

View File

@ -99,13 +99,13 @@
//ESP_SPIFFS_FILESYSTEM 0
//ESP_FAT_FILESYSTEM 1
//ESP_LITTLEFS_FILESYSTEM 2 //Not Yet implemented
#define FILESYSTEM_FEATURE ESP_SPIFFS_FILESYSTEM
#define FILESYSTEM_FEATURE ESP_FAT_FILESYSTEM
//DIRECT_PIN_FEATURE: allow to access pin using ESP201 command
#define DIRECT_PIN_FEATURE
//TIMESTAMP_FEATURE: set time system
#define TIMESTAMP_FEATURE
//#define TIMESTAMP_FEATURE
//FILESYSTEM_TIMESTAMP_FEATURE: allow to get last write time from FILESYSTEM files
//#define FILESYSTEM_TIMESTAMP_FEATURE

View File

@ -22,7 +22,7 @@
#define _VERSION_ESP3D_H
//version and sources location
#define FW_VERSION "3.0.0.a10"
#define FW_VERSION "3.0.0.a11"
#define REPOSITORY "https://github.com/luc-github/ESP3D"
#endif //_VERSION_ESP3D_H

View File

@ -144,7 +144,10 @@ size_t ESP_FileSystem::max_update_size()
#if defined (ARDUINO_ARCH_ESP32)
//Is OTA available ?
if (esp_ota_get_running_partition()) {
flashsize = ESP.getFreeSketchSpace() + ESP.getSketchSize();
const esp_partition_t* partition = esp_ota_get_next_update_partition(NULL);
if (partition){
flashsize = partition->size;
}
} else {
flashsize = 0;
}