PlatformIO 5.0.3.
Example code:
size_t used_entries = 0;
if (nvs_get_used_entry_count(station_handle, &used_entries) == ESP_OK)
{
// вычисление общего количества станций
ESP_LOGI(TAG, "Total the slots of stations: %d", used_entries);
}
Return result: 130. The real value is 13. That is, zero is appended to the correct value.
ESP_ERROR_CHECK(nvs_flash_init_partition("hardware"));
nvs_iterator_t it = nvs_entry_find("hardware", "stations", NVS_TYPE_BLOB);
uint8_t counter = 0;
while (it != NULL)
{
nvs_entry_info_t info;
nvs_entry_info(it, &info);
it = nvs_entry_next(it);
ESP_LOGI(TAG, "key '%s', type '%d' \n", info.key, info.type);
counter++;
};
ESP_LOGI(TAG, "Total stations: %d", counter);
This code returns the correct number of records.
What am I doing wrong?