Fix loop of unique ota partition wrongly detected as second partition

next update partition should give null if no next app partition, but actually it loop first partition, so compare both addresses to be sure there are 2 distinct partitions
This commit is contained in:
Luc 2020-09-24 20:12:35 +02:00
parent 766eb4efbd
commit e9b742434f
2 changed files with 8 additions and 6 deletions

View File

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

View File

@ -65,13 +65,15 @@ size_t ESP_FileSystem::max_update_size()
#endif //ARDUINO_ARCH_ESP8266
#if defined (ARDUINO_ARCH_ESP32)
//Is OTA available ?
if (esp_ota_get_running_partition()) {
const esp_partition_t* partition = esp_ota_get_next_update_partition(NULL);
const esp_partition_t* mainpartition = esp_ota_get_running_partition();
if (mainpartition) {
const esp_partition_t* partition = esp_ota_get_next_update_partition(mainpartition);
if (partition) {
flashsize = partition->size;
const esp_partition_t* partition2 = esp_ota_get_next_update_partition(partition);
if (partition2 && (partition->address!=partition2->address)) {
flashsize = partition2->size;
}
}
} else {
flashsize = 0;
}
#endif //ARDUINO_ARCH_ESP32
return flashsize;