You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Board: DOIT ESP32 DEVKIT V1
IDE name: Arduino
Core Installation version: 1.0.4
Computer OS: Windows 10
Upload Speed: 921600
Flash Frequency : 80Mhz
I have a question about implementation of EEPROM.commit method.
I guess that this code call nvs_commit.
But, the code call nvs_set_blob, not call nvs_commit.
And this work fine.
This code is part of EEPROME library in arduino-esp32.
bool EEPROMClass::commit() {
bool ret = false;
if (!_size) {
return false;
}
if (!_data) {
return false;
}
if (!_dirty) {
return true;
}
if (ESP_OK != nvs_set_blob(_handle, _name, _data, _size)) {
log_e( "error in write");
} else {
_dirty = false;
ret = true;
}
return ret;
}
There is nvs_set_blob but no nvs_commit.
However, nvs_set_blob does not affect NVS before call nvs_commit in description.
This is the description of nvs_set_blob method
/**
* @brief set variable length binary value for given key
*
* This family of functions set value for the key, given its name. Note that
* actual storage will not be updated until nvs_commit function is called.
*
* @param[in] handle Handle obtained from nvs_open function.
* Handles that were opened read only cannot be used.
* @param[in] key Key name. Maximal length is 15 characters. Shouldn't be empty.
* @param[in] value The value to set.
* @param[in] length length of binary value to set, in bytes; Maximum length is
* 508000 bytes or (97.6% of the partition size - 4000) bytes
* whichever is lower.
*
* @return
* - ESP_OK if value was set successfully
* - ESP_ERR_NVS_INVALID_HANDLE if handle has been closed or is NULL
* - ESP_ERR_NVS_READ_ONLY if storage handle was opened as read only
* - ESP_ERR_NVS_INVALID_NAME if key name doesn't satisfy constraints
* - ESP_ERR_NVS_NOT_ENOUGH_SPACE if there is not enough space in the
* underlying storage to save the value
* - ESP_ERR_NVS_REMOVE_FAILED if the value wasn't updated because flash
* write operation has failed. The value was written however, and
* update will be finished after re-initialization of nvs, provided that
* flash operation doesn't fail again.
* - ESP_ERR_NVS_VALUE_TOO_LONG if the value is too long
*/
esp_err_t nvs_set_blob(nvs_handle handle, const char* key, const void* value, size_t length);
"Note that actual storage will not be updated until nvs_commit function is called."
How can this possible?
I mean that EEPROME.write and commit method work fine. Whether power off the device, the data is preserved.
But, descriptions of the nvs_set_blob and nvs_commit are different about this situation.
Please, could you explain what happened behind of code?
I'm not fluent in English. Please understand it.
The text was updated successfully, but these errors were encountered:
HaejinYang
changed the title
EEPROM.commit does not call nvs_commit function. Is right?
EEPROM.commit does not call nvs_commit function. Is it right?
Nov 13, 2021
Uh oh!
There was an error while loading. Please reload this page.
Board: DOIT ESP32 DEVKIT V1
IDE name: Arduino
Core Installation version: 1.0.4
Computer OS: Windows 10
Upload Speed: 921600
Flash Frequency : 80Mhz
I have a question about implementation of EEPROM.commit method.
I guess that this code call nvs_commit.
But, the code call nvs_set_blob, not call nvs_commit.
And this work fine.
This code is part of EEPROME library in arduino-esp32.
There is nvs_set_blob but no nvs_commit.
However, nvs_set_blob does not affect NVS before call nvs_commit in description.
This is the description of nvs_set_blob method
"Note that actual storage will not be updated until nvs_commit function is called."
How can this possible?
I mean that EEPROME.write and commit method work fine. Whether power off the device, the data is preserved.
But, descriptions of the nvs_set_blob and nvs_commit are different about this situation.
Please, could you explain what happened behind of code?
I'm not fluent in English. Please understand it.
The text was updated successfully, but these errors were encountered: