small adjustments for NVS and PSRAM init
This commit is contained in:
parent
46f283a886
commit
c210d24a13
2 changed files with 6 additions and 4 deletions
|
|
@ -235,7 +235,7 @@ void initArduino()
|
||||||
#endif
|
#endif
|
||||||
esp_log_level_set("*", CONFIG_LOG_DEFAULT_LEVEL);
|
esp_log_level_set("*", CONFIG_LOG_DEFAULT_LEVEL);
|
||||||
esp_err_t err = nvs_flash_init();
|
esp_err_t err = nvs_flash_init();
|
||||||
if(err == ESP_ERR_NVS_NO_FREE_PAGES){
|
if(err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND){
|
||||||
const esp_partition_t* partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_NVS, NULL);
|
const esp_partition_t* partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_NVS, NULL);
|
||||||
if (partition != NULL) {
|
if (partition != NULL) {
|
||||||
err = esp_partition_erase_range(partition, 0, partition->size);
|
err = esp_partition_erase_range(partition, 0, partition->size);
|
||||||
|
|
@ -244,6 +244,8 @@ void initArduino()
|
||||||
} else {
|
} else {
|
||||||
log_e("Failed to format the broken NVS partition!");
|
log_e("Failed to format the broken NVS partition!");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log_e("Could not find NVS partition");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(err) {
|
if(err) {
|
||||||
|
|
|
||||||
|
|
@ -87,12 +87,12 @@ bool psramInit(){
|
||||||
log_e("PSRAM could not be added to the heap!");
|
log_e("PSRAM could not be added to the heap!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL && !CONFIG_ARDUINO_ISR_IRAM
|
#if CONFIG_SPIRAM_USE_MALLOC && !CONFIG_ARDUINO_ISR_IRAM
|
||||||
heap_caps_malloc_extmem_enable(CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL);
|
heap_caps_malloc_extmem_enable(CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL);
|
||||||
#endif
|
#endif
|
||||||
|
log_i("PSRAM enabled");
|
||||||
#endif
|
#endif
|
||||||
spiramDetected = true;
|
spiramDetected = true;
|
||||||
log_d("PSRAM enabled");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue