esp_netif, examples: esp_netif_init() moved into ESP_ERROR_CHECK()

esp_netif_init() returns standard esp_err_t error code (unlike tcpip_adapter init), so shall be checked for the return value
Also to make the initialization code more consistent.
This commit is contained in:
David Cermak 2019-11-29 10:54:02 +01:00
parent b61b927008
commit 31b2702387
60 changed files with 60 additions and 60 deletions

View file

@ -212,7 +212,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base,
static void initialise_wifi(void)
{
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta();

View file

@ -126,7 +126,7 @@ void initialise_wifi(void)
return;
}
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta();

View file

@ -66,7 +66,7 @@ static void got_ip_event_handler(void *arg, esp_event_base_t event_base,
void app_main(void)
{
// Initialize TCP/IP network interface (should be called only once in application)
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
// Create default event loop that running in background
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();

View file

@ -178,7 +178,7 @@ static void event_handler(void *arg, esp_event_base_t event_base,
void register_ethernet(void)
{
eth_event_group = xEventGroupCreate();
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
eth_netif = esp_netif_new(&cfg);

View file

@ -377,7 +377,7 @@ void app_main(void)
ESP_ERROR_CHECK(mesh_light_init());
ESP_ERROR_CHECK(nvs_flash_init());
/* tcpip initialization */
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
/* event initialization */
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* crete network interfaces for mesh (only station instance saved for further manipulation, soft AP instance ignored */

View file

@ -301,7 +301,7 @@ void app_main(void)
ESP_ERROR_CHECK(mesh_light_init());
ESP_ERROR_CHECK(nvs_flash_init());
/* tcpip initialization */
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
/* event initialization */
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* crete network interfaces for mesh (only station instance saved for further manipulation, soft AP instance ignored */

View file

@ -440,7 +440,7 @@ clean_up:
void app_main(void)
{
ESP_ERROR_CHECK( nvs_flash_init() );
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -306,7 +306,7 @@ clean_up:
void app_main(void)
{
ESP_ERROR_CHECK( nvs_flash_init() );
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -541,7 +541,7 @@ void app_main(void)
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -65,7 +65,7 @@ void wifi_init_sta(void)
{
s_wifi_event_group = xEventGroupCreate();
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta();

View file

@ -131,7 +131,7 @@ static void http2_task(void *args)
void app_main(void)
{
ESP_ERROR_CHECK( nvs_flash_init() );
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -122,7 +122,7 @@ static void http_get_task(void *pvParameters)
void app_main(void)
{
ESP_ERROR_CHECK( nvs_flash_init() );
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -46,7 +46,7 @@ void app_main(void)
static httpd_handle_t server = NULL;
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -67,7 +67,7 @@ esp_err_t start_file_server(const char *base_path);
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -216,7 +216,7 @@ void app_main(void)
static httpd_handle_t server = NULL;
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -126,7 +126,7 @@ esp_err_t init_fs(void)
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
initialise_mdns();
netbiosns_init();

View file

@ -272,7 +272,7 @@ void app_main(void)
static httpd_handle_t server = NULL;
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -274,7 +274,7 @@ static void https_get_task(void *pvParameters)
void app_main(void)
{
ESP_ERROR_CHECK( nvs_flash_init() );
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -151,7 +151,7 @@ static void https_get_task(void *pvParameters)
void app_main(void)
{
ESP_ERROR_CHECK( nvs_flash_init() );
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -103,7 +103,7 @@ void app_main(void)
static httpd_handle_t server = NULL;
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* Register event handlers to start server when Wi-Fi or Ethernet is connected,

View file

@ -79,7 +79,7 @@ void app_main(void)
initialize_console();
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* wait for active network connection */
ESP_ERROR_CHECK(example_connect());

View file

@ -169,7 +169,7 @@ void app_main(void)
esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE);
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -139,7 +139,7 @@ void app_main(void)
esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE);
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -111,7 +111,7 @@ void app_main(void)
esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE);
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -128,7 +128,7 @@ void app_main(void)
esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE);
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -138,7 +138,7 @@ void app_main(void)
esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE);
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -111,7 +111,7 @@ void app_main(void)
esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE);
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -120,7 +120,7 @@ void app_main(void)
esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE);
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -174,7 +174,7 @@ void app_main(void)
{
ESP_ERROR_CHECK( nvs_flash_init() );
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -208,7 +208,7 @@ static void openssl_server_init(void)
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -215,7 +215,7 @@ void app_main(void)
#else
#error "Unsupported AUTH Negotiation"
#endif
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &on_ip_event, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID, &on_ppp_changed, NULL));

View file

@ -119,7 +119,7 @@ void app_main(void)
static void obtain_time(void)
{
ESP_ERROR_CHECK( nvs_flash_init() );
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK( esp_event_loop_create_default() );
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -112,7 +112,7 @@ static void tcp_client_task(void *pvParameters)
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -137,7 +137,7 @@ CLEAN_UP:
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -111,7 +111,7 @@ static void udp_client_task(void *pvParameters)
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -484,7 +484,7 @@ static void mcast_example_task(void *pvParameters)
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -112,7 +112,7 @@ static void udp_server_task(void *pvParameters)
void app_main(void)
{
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -90,7 +90,7 @@ void app_main(void)
esp_log_level_set("TRANS_TCP", ESP_LOG_DEBUG);
ESP_ERROR_CHECK(nvs_flash_init());
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -112,7 +112,7 @@ static void start_ble_provisioning(void)
void app_main(void)
{
/* Initialize networking stack */
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
/* Create default event loop needed by the
* main app and the provisioning service */

View file

@ -83,7 +83,7 @@ static void start_console_provisioning(void)
void app_main(void)
{
/* Initialize networking stack */
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
/* Create default event loop needed by the
* main app and the provisioning service */

View file

@ -84,7 +84,7 @@ static void start_softap_provisioning(void)
void app_main(void)
{
/* Initialize networking stack */
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
/* Create default event loop needed by the
* main app and the provisioning service */

View file

@ -107,7 +107,7 @@ void app_main(void)
}
/* Initialize TCP/IP */
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
/* Initialize the event loop */
ESP_ERROR_CHECK(esp_event_loop_create_default());

View file

@ -99,7 +99,7 @@ static void start_softap_provisioning(void)
void app_main(void)
{
/* Initialize networking stack */
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
/* Create default event loop needed by the
* main app and the provisioning service */

View file

@ -44,7 +44,7 @@ static void initialise_wifi(void)
if (initialized) {
return;
}
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_t *ap_netif = esp_netif_create_default_wifi_ap();

View file

@ -156,7 +156,7 @@ void app_main(void)
// Netif creation and configure
//
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
esp_netif_t* netif = esp_netif_new(&config);
assert(netif);

View file

@ -125,7 +125,7 @@ void app_main(void)
}
ESP_ERROR_CHECK( err );
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -278,7 +278,7 @@ void app_main(void)
}
ESP_ERROR_CHECK( err );
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -112,7 +112,7 @@ void app_main(void)
}
ESP_ERROR_CHECK(err);
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.

View file

@ -43,7 +43,7 @@ static void socket_init(void)
int err;
struct sockaddr_in saddr = { 0 };
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
err = getaddrinfo("localhost", "80", &hints, &res);

View file

@ -41,7 +41,7 @@ static void example_espnow_deinit(example_espnow_send_param_t *send_param);
/* WiFi should start before using ESPNOW */
static void example_wifi_init(void)
{
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );

View file

@ -85,7 +85,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
/* Initialize Wi-Fi as sta and set scan method */
static void fast_scan(void)
{
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();

View file

@ -45,7 +45,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base,
void wifi_init_softap(void)
{
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_create_default_wifi_ap();

View file

@ -64,7 +64,7 @@ void wifi_init_sta(void)
{
s_wifi_event_group = xEventGroupCreate();
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_create_default_wifi_sta();

View file

@ -108,7 +108,7 @@ void initialise_wifi(void)
return;
}
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK( esp_event_loop_create_default() );
netif_ap = esp_netif_create_default_wifi_ap();

View file

@ -55,7 +55,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
/*init wifi as sta and set power save mode*/
static void wifi_power_save(void)
{
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta();
assert(sta_netif);

View file

@ -103,7 +103,7 @@ static void print_cipher_type(int pairwise_cipher, int group_cipher)
/* Initialize Wi-Fi as sta and set scan method */
static void wifi_scan(void)
{
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta();
assert(sta_netif);

View file

@ -64,7 +64,7 @@ static void initialize_nvs(void)
/* Initialize wifi with tcp/ip adapter */
static void initialize_wifi(void)
{
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));

View file

@ -78,7 +78,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
static void initialise_wifi(void)
{
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
s_wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta();

View file

@ -104,7 +104,7 @@ static void initialise_wifi(void)
unsigned int client_key_bytes = client_key_end - client_key_start;
#endif /* CONFIG_EXAMPLE_EAP_METHOD_TLS */
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK(esp_event_loop_create_default());
sta_netif = esp_netif_create_default_wifi_sta();

View file

@ -97,7 +97,7 @@ static void got_ip_event_handler(void* arg, esp_event_base_t event_base,
/*init wifi as sta and start wps*/
static void start_wps(void)
{
esp_netif_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta();
assert(sta_netif);