Commit d057e544 authored by lbernstone's avatar lbernstone Committed by Me No Dev

Added a freeEntries method to Preferences library (#1722)

parent b05430cf
......@@ -468,3 +468,13 @@ size_t Preferences::getBytes(const char* key, void * buf, size_t maxLen){
}
return len;
}
size_t Preferences::freeEntries() {
nvs_stats_t nvs_stats;
esp_err_t err = nvs_get_stats(NULL, &nvs_stats);
if(err){
log_e("Failed to get nvs statistics");
return 0;
}
return nvs_stats.free_entries;
}
......@@ -64,6 +64,7 @@ class Preferences {
size_t getString(const char* key, char* value, size_t maxLen);
String getString(const char* key, String defaultValue = String());
size_t getBytes(const char* key, void * buf, size_t maxLen);
size_t freeEntries();
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment