Equivalent of preferences in ESP-IDF?

sukeshak
Posts: 31
Joined: Sat Aug 19, 2017 10:20 am

Equivalent of preferences in ESP-IDF?

Postby sukeshak » Tue Sep 26, 2017 2:07 pm

What is the equivalent API for Preferences under ESP-IDF?
https://github.com/espressif/arduino-es ... references

User avatar
kolban
Posts: 1001
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Equivalent of preferences in ESP-IDF?

Postby kolban » Tue Sep 26, 2017 2:32 pm

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
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
martinayotte
Posts: 92
Joined: Fri Nov 13, 2015 4:27 pm

Re: Equivalent of preferences in ESP-IDF?

Postby martinayotte » Tue Sep 26, 2017 3:57 pm

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.

sukeshak
Posts: 31
Joined: Sat Aug 19, 2017 10:20 am

Re: Equivalent of preferences in ESP-IDF?

Postby sukeshak » Tue Sep 26, 2017 4:28 pm

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'

User avatar
martinayotte
Posts: 92
Joined: Fri Nov 13, 2015 4:27 pm

Re: Equivalent of preferences in ESP-IDF?

Postby martinayotte » Thu Sep 28, 2017 4:36 pm

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

sukeshak
Posts: 31
Joined: Sat Aug 19, 2017 10:20 am

Re: Equivalent of preferences in ESP-IDF?

Postby sukeshak » Thu Sep 28, 2017 9:35 pm

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.

Who is online

Users browsing this forum: No registered users and 14 guests