But I now tried to expand the storage of strings and I am running into unexpected limits.
The Espressif docu says:
My 4MB flash is configured for an NVS space of 0x5000 bytes. With every key at "full", the pref lib tells me I have 288 free entries.String values are currently limited to 4000 bytes. This includes the null terminator.
Under key WARN I store "Strings" (actually chars) of a maximum size of 3500. When adding new records, I add them at the top and cut from the bottom until the new String fits into the 3500 limit, and putString() it back. So in my case with records of near 70 bytes I can keep the latest approx. 50 records. Good, that is how I want it.
However, I have another key DEVEL, also with a max size of 3500, which I would like to treat and behave the same way. Each one of the two keys is well under the 4000 char limit, yet DEVEL cannot hold more than 3150 bytes. Any attempts to save more results in the error message:
Code: Select all
[ 3063][E][Preferences.cpp:273] putString(): nvs_set_str fail: warn NOT_ENOUGH_SPACE
What do I need to set in order to get the maximum string storage with my two keys WARN and DEVEL?
Here is an excerpt of the content for these two keys with some test data:
Code: Select all
# WARN: Bytes used:3450 out of 3500 (no errors)
18 14:16:07.515 51_123456789_123456789_123456789_123456789_123456789
18 14:16:07.641 52_123456789_123456789_123456789_123456789_123456789
18 14:16:07.769 53_123456789_123456789_123456789_123456789_123456789
...
18 14:16:13.386 98_123456789_123456789_123456789_123456789_123456789
18 14:16:13.515 99_123456789_123456789_123456789_123456789_123456789
18 14:16:13.641 100_123456789_123456789_123456789_123456789_123456789
# DEVEL: 3158 out of 3500
18 14:19:30.327 1_123456789_123456789_123456789_123456789_123456789
18 14:19:30.441 2_123456789_123456789_123456789_123456789_123456789
18 14:19:30.491 3_123456789_123456789_123456789_123456789_123456789
...
18 14:19:34.312 43_123456789_123456789_123456789_123456789_123456789
18 14:19:34.441 44_123456789_123456789_123456789_123456789_123456789
18 14:19:34.587 45_123456789_123456789_123456789_123456789_123456789
# (errors 'NOT_ENOUGH_SPACE' when trying to save more)