Skip to content

Commit c210d24

Browse files
committed
small adjustments for NVS and PSRAM init
1 parent 46f283a commit c210d24

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Diff for: cores/esp32/esp32-hal-misc.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void initArduino()
235235
#endif
236236
esp_log_level_set("*", CONFIG_LOG_DEFAULT_LEVEL);
237237
esp_err_t err = nvs_flash_init();
238-
if(err == ESP_ERR_NVS_NO_FREE_PAGES){
238+
if(err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND){
239239
const esp_partition_t* partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_NVS, NULL);
240240
if (partition != NULL) {
241241
err = esp_partition_erase_range(partition, 0, partition->size);
@@ -244,6 +244,8 @@ void initArduino()
244244
} else {
245245
log_e("Failed to format the broken NVS partition!");
246246
}
247+
} else {
248+
log_e("Could not find NVS partition");
247249
}
248250
}
249251
if(err) {

Diff for: cores/esp32/esp32-hal-psram.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ bool psramInit(){
8787
log_e("PSRAM could not be added to the heap!");
8888
return false;
8989
}
90-
#if CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL && !CONFIG_ARDUINO_ISR_IRAM
91-
heap_caps_malloc_extmem_enable(CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL);
90+
#if CONFIG_SPIRAM_USE_MALLOC && !CONFIG_ARDUINO_ISR_IRAM
91+
heap_caps_malloc_extmem_enable(CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL);
9292
#endif
93+
log_i("PSRAM enabled");
9394
#endif
9495
spiramDetected = true;
95-
log_d("PSRAM enabled");
9696
return true;
9797
}
9898

0 commit comments

Comments
 (0)