nvs: allow nvs_flash_init to be called more than once

Also don’t assert in nvs_* functions if nvs_flash_init wasn’t called,
and make nvs_flash_init_custom an internal API for unit tests.
This commit is contained in:
Ivan Grokhotkov
2016-11-15 18:24:56 +08:00
parent 51021b06f8
commit 6e97936bac
7 changed files with 73 additions and 23 deletions

View File

@@ -69,6 +69,11 @@ esp_err_t Storage::init(uint32_t baseSector, uint32_t sectorCount)
return ESP_OK;
}
bool Storage::isValid() const
{
return mState == StorageState::ACTIVE;
}
esp_err_t Storage::findItem(uint8_t nsIndex, ItemType datatype, const char* key, Page* &page, Item& item)
{
for (auto it = std::begin(mPageManager); it != std::end(mPageManager); ++it) {