Storing Logs

gregstewart90
Posts: 52
Joined: Thu Jan 19, 2017 5:17 pm

Re: Storing Logs

Postby gregstewart90 » Wed Sep 13, 2017 1:48 pm

ESP_igrr wrote:If you can pack two int32 variables into an int64 and store that instead of a blob, that will be twice as efficient.


I definitely can pack them together. Should I make an array of the log entries and save that to the blob or should I try to rename each entry?

Code: Select all

BlobLog blob_logs[];
...
nvs_set_blob(my_handle, "log", &blob_logs, sizeof(blob_logs));

or

Code: Select all

nvs_set_i32(my_handle, "unique_name", new_blob_log); //unique_name will probably just be an incremented int.


With the former it is easier to save since I don't have to create unique names for the nvs location, and with the latter I will have to read many different locations when accessing the blob. Does the latter have an advantage?

ESP_igrr
Posts: 794
Joined: Tue Dec 01, 2015 8:37 am

Re: Storing Logs

Postby ESP_igrr » Thu Sep 14, 2017 12:40 am

Not rewriting what was already written is obviously more efficient. You will need less flash operations when using a separate key-value pair for each log entry.

Who is online

Users browsing this forum: No registered users and 7 guests