reverted esp-netif commit comming before esp-netif was introduced/merged onto IDF master
This commit is contained in:
parent
d23505609b
commit
b1bd86d2bf
15
main/main.c
15
main/main.c
|
@ -8,18 +8,6 @@
|
||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
|
|
||||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)
|
|
||||||
//
|
|
||||||
// From IDF 4.1.0 ESP-NETIF approach is encouraged and all network
|
|
||||||
// interfaces have to be explicitely created
|
|
||||||
//
|
|
||||||
#define TCPIP_INIT() esp_netif_init()
|
|
||||||
#define CREATE_WIFI_STATION() assert(esp_netif_create_default_wifi_sta())
|
|
||||||
#else
|
|
||||||
#define TCPIP_INIT() tcpip_adapter_init()
|
|
||||||
#define CREATE_WIFI_STATION()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
|
|
||||||
static void wifi_event_handler(void* arg, esp_event_base_t event_base,
|
static void wifi_event_handler(void* arg, esp_event_base_t event_base,
|
||||||
|
@ -44,7 +32,7 @@ esp_err_t event_handler(void *ctx, system_event_t *event)
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
nvs_flash_init();
|
nvs_flash_init();
|
||||||
TCPIP_INIT();
|
tcpip_adapter_init();
|
||||||
|
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
|
@ -53,7 +41,6 @@ void app_main(void)
|
||||||
#else
|
#else
|
||||||
ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
|
ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
|
||||||
#endif
|
#endif
|
||||||
CREATE_WIFI_STATION();
|
|
||||||
|
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
|
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
|
||||||
|
|
Loading…
Reference in New Issue