mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 01:58:39 +00:00
Fix bootloop if nvs partition is missing or has non-default label
This commit is contained in:
@@ -70,8 +70,13 @@ bool ESP32PreferenceBackend::load(uint8_t *data, size_t len) {
|
||||
}
|
||||
|
||||
void ESP32Preferences::open() {
|
||||
nvs_flash_init();
|
||||
esp_err_t err = nvs_open("esphome", NVS_READWRITE, &this->nvs_handle);
|
||||
esp_err_t err = nvs_flash_init();
|
||||
if (err != 0) {
|
||||
this->nvs_handle = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
err = nvs_open("esphome", NVS_READWRITE, &this->nvs_handle);
|
||||
if (err == 0)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user