diff --git a/examples/performance/tcp_perf/main/tcp_main.c b/examples/performance/tcp_perf/main/tcp_main.c index c96b0d02b4..000ed6d42a 100644 --- a/examples/performance/tcp_perf/main/tcp_main.c +++ b/examples/performance/tcp_perf/main/tcp_main.c @@ -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(); diff --git a/examples/performance/udp_perf/main/udp_main.c b/examples/performance/udp_perf/main/udp_main.c index cad32a8134..8bbd05ff0f 100644 --- a/examples/performance/udp_perf/main/udp_main.c +++ b/examples/performance/udp_perf/main/udp_main.c @@ -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();