Page 1 of 1

Equivalent of preferences in ESP-IDF?

Posted: Tue Sep 26, 2017 2:07 pm
by sukeshak
What is the equivalent API for Preferences under ESP-IDF?
https://github.com/espressif/arduino-es ... references

Re: Equivalent of preferences in ESP-IDF?

Posted: Tue Sep 26, 2017 2:32 pm
by kolban
Howdy,
If by preferences you mean the ability to set configuration options at compiled time that can be customized ... then it might be that you can leverage the ESP-IDF build system. This allows you to add any number of custom options that can be modified via the "make menuconfig" tooling. See:

http://esp-idf.readthedocs.io/en/latest ... ystem.html

Re: Equivalent of preferences in ESP-IDF?

Posted: Tue Sep 26, 2017 3:57 pm
by martinayotte
No, Kolban. The OP means by Preferences storages which he provided link for.
A bit like nvs_rw_value and nvs_rw_blob.
But Preferences provided much more methods for Strings as an example, but those could be done with blobs.
In fact, Preferences are on top of NVS, so this class could be copied/pasted into any ESP-IDF code.

Re: Equivalent of preferences in ESP-IDF?

Posted: Tue Sep 26, 2017 4:28 pm
by sukeshak
martinayotte wrote:No, Kolban. The OP means by Preferences storages which he provided link for.
A bit like nvs_rw_value and nvs_rw_blob.
But Preferences provided much more methods for Strings as an example, but those could be done with blobs.
In fact, Preferences are on top of NVS, so this class could be copied/pasted into any ESP-IDF code.
Yes you got it. And probably its a good idea to have it on both sides since its easier API set.
SPIFFS is also available on both sides now as an option... but wanted to know the plans for 'preferences'

Re: Equivalent of preferences in ESP-IDF?

Posted: Thu Sep 28, 2017 4:36 pm
by martinayotte
I don't know about ESP-IDF plans/schedules, but since Preferences is top of NVS, NVS could be use instead, here is an example for putString() :

https://github.com/espressif/arduino-es ... #L245-L260

Re: Equivalent of preferences in ESP-IDF?

Posted: Thu Sep 28, 2017 9:35 pm
by sukeshak
martinayotte wrote:I don't know about ESP-IDF plans/schedules, but since Preferences is top of NVS, NVS could be use instead, here is an example for putString() :

https://github.com/espressif/arduino-es ... #L245-L260
Thank you. Will try it out.