nvs_flash_init()
and write some parameters into nvs
Code: Select all
nvs_handle mHandler;
if (nvs_open(WIFI_TAG, NVS_READWRITE, &mHandler) == ESP_OK)
{
nvs_set_str(mHandler, NVS_SSID, wifi_ssid);
nvs_set_str(mHandler, NVS_PASS, wifi_pass);
if (nvs_commit(mHandler) == ESP_OK)
{
i2c_oled_showstr(0, 6, "W");
}
nvs_close(mHandler);
}but while i try to read this with this code
Code: Select all
nvs_handle mHandler;
bool ret = false;
ret = nvs_open(WIFI_TAG, NVS_READONLY, &mHandler);
ESP_ERROR_CHECK(nvs_get_str(mHandler, NVS_SSID, wifi_ssid, &wifi_ssid_length));
ESP_ERROR_CHECK(nvs_get_str(mHandler, NVS_PASS, wifi_pass, &wifi_pass_length));
nvs_close(mHandler);
return ret;there is an error :
ESP_ERROR_CHECK failed: esp_err_t 0x110c (ESP_ERR_NVS_INVALID_LENGTH) at 0x40221cd8
could any one tell me where my problem is?thx
btw,my partition table is Single Factory app,no OTA