udp_perf/tcp_perf examples: Erase NVS if no more free pages

Follows same pattern as other examples.

Amendment to https://github.com/espressif/esp-idf/pull/1279
This commit is contained in:
Angus Gratton 2017-11-20 16:07:52 +11:00 committed by Angus Gratton
parent 3b84c1e8fa
commit 05dd46cd72
2 changed files with 14 additions and 2 deletions

View File

@ -124,7 +124,13 @@ static void tcp_conn(void *pvParameters)
void app_main(void)
{
nvs_flash_init();
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK( ret );
#if EXAMPLE_ESP_WIFI_MODE_AP
ESP_LOGI(TAG, "EXAMPLE_ESP_WIFI_MODE_AP");
wifi_init_softap();

View File

@ -103,7 +103,13 @@ static void udp_conn(void *pvParameters)
void app_main(void)
{
nvs_flash_init();
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK( ret );
#if EXAMPLE_ESP_WIFI_MODE_AP
ESP_LOGI(TAG, "EXAMPLE_ESP_WIFI_MODE_AP");
wifi_init_softap();