main/task_wifi.c

changeset 8
115e93bf8796
parent 7
2b337dd92f25
child 9
1659bd3c7a2b
equal deleted inserted replaced
7:2b337dd92f25 8:115e93bf8796
168 168
169 void task_wifi( void * pvParameters ) 169 void task_wifi( void * pvParameters )
170 { 170 {
171 ESP_LOGI(TAG, "Start WiFi"); 171 ESP_LOGI(TAG, "Start WiFi");
172 172
173 /*
174 * Initialize NVS
175 */
176 esp_err_t ret = nvs_flash_init();
177 if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
178 ESP_ERROR_CHECK(nvs_flash_erase());
179 ret = nvs_flash_init();
180 }
181 ESP_ERROR_CHECK(ret);
182
183 /* event handler and event group for the wifi driver */ 173 /* event handler and event group for the wifi driver */
184 xEventGroupWifi = xEventGroupCreate(); 174 xEventGroupWifi = xEventGroupCreate();
185 /* initialize the tcp stack */ 175 /* initialize the tcp stack */
186 ESP_ERROR_CHECK(esp_netif_init()); 176 ESP_ERROR_CHECK(esp_netif_init());
187 ESP_ERROR_CHECK(esp_event_loop_create_default()); 177 ESP_ERROR_CHECK(esp_event_loop_create_default());

mercurial