Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
udp_perf/tcp_perf examples: Erase NVS if no more free pages
Browse files Browse the repository at this point in the history
Follows same pattern as other examples.

Amendment to espressif/esp-idf#1279
  • Loading branch information
projectgus committed Nov 20, 2017
1 parent 3b84c1e commit 05dd46c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion examples/performance/tcp_perf/main/tcp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 7 additions & 1 deletion examples/performance/udp_perf/main/udp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 05dd46c

Please sign in to comment.