Fix single partition free space

This commit is contained in:
Theo Arends 2022-05-07 11:05:10 +02:00
parent 70277bbf52
commit 07f1c5f302
1 changed files with 11 additions and 5 deletions

View File

@ -461,11 +461,6 @@ uint32_t ESP_getChipId(void) {
return id; return id;
} }
uint32_t ESP_getFreeSketchSpace(void) {
uint32_t size = EspRunningFactoryPartition();
return (size) ? size : ESP.getFreeSketchSpace();
}
uint32_t ESP_getSketchSize(void) { uint32_t ESP_getSketchSize(void) {
static uint32_t sketchsize = 0; static uint32_t sketchsize = 0;
@ -475,6 +470,17 @@ uint32_t ESP_getSketchSize(void) {
return sketchsize; return sketchsize;
} }
uint32_t ESP_getFreeSketchSpace(void) {
if (EspSingleOtaPartition()) {
uint32_t size = EspRunningFactoryPartition();
if (!size) {
size = ESP.getFreeSketchSpace();
}
return size - ESP_getSketchSize();
}
return ESP.getFreeSketchSpace();
}
uint32_t ESP_getFreeHeap(void) { uint32_t ESP_getFreeHeap(void) {
// ESP_getFreeHeap() returns also IRAM which we don't use // ESP_getFreeHeap() returns also IRAM which we don't use
return heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); return heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);