-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Converted EEPROM library to use nvs instead of partition. #2678
Conversation
…rom partition from all partition table CSV files.
nvs_commit(_handle); | ||
nvs_set_blob(_handle, _name, hold_data, size); | ||
free(hold_data); | ||
nvs_commit(_handle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this whole block of code needs some comments to explain exactly what is going on :) I got lost with all those reads, writes and erases. What data is where... you need 2 blobs to hold the default 4K EEPROM, but reading through your code I got lost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no way to expand a key, so in order to do so, it tests for free space, then holds the data while it deletes the key. If it is a new key, it just fills with zeros. I think changing the variable name to key_data will make it clearer.
left a few notes :) |
@@ -117,11 +105,10 @@ class EEPROMClass { | |||
template <class T> T writeAll (int address, const T &); | |||
|
|||
protected: | |||
uint32_t _sector; | |||
nvs_handle _handle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you maybe forward declare the nvs_handle
so it is not required to include nvs in the header?
…the library and persist data
Serial.println(EEPROM.readByte(address)); | ||
address += sizeof(byte); | ||
|
||
Serial.println(char(EEPROM.readChar(address))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this actually compile? Shouldn't it be println((char)EEPROM.readChar(address));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
travis would have complained :) not sure how Make will like it though
Serial.println(EEPROM.readString(address)); | ||
address += sentence.length(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Length +1?
This is a good feature that save a bit of flash space but it breaks all deployed systems where factory settings are stored into EEPROM flash partition. |
Will do! @lbernstone any ideas on how that can be detected and moved to NVS? |
@me-no-dev My reasons: arduino-esp32 is too matured to start having breaking changes caused by memory partitioning. |
Hi, in addition to breaking EEPROM it also breaks any files stored earlier in SPIFFS; the SPIFFS offset moved from 0x291000 to 0x290000. On on my system, any SPIFFS files saved with core 1.0.2 cannot be read by core 1.0.3. I can only read SPIFFS with 1.0.3 when i edit my partitions/default.csv back to the 1.0.2 values (line 6: spiffs). Those 1000 bytes gained are not worth breaking backward compatibility in my humble opinion. I was surprised not to find any documentation on this because i assume lots of people have/will run into this problem. |
Converted EEPROM library to use nvs instead of partition.
Removed eeprom partition from all partition table CSV files.