LWIP: determine if it has been initialised
Posted: Tue Nov 14, 2023 10:23 am
We have some library code of our own which attaches a PPP interface at the esp-netif level in ESP-IDF at run-time. The code #includes "sdkconfig.h" and switches on CONFIG_LWIP_PPP_SUPPORT so that it doesn't try to do anything unless the user has built with it.
However, this code will go "bang" somewhere inside the ESP-IDF TCP-IP code if the user happens not to have called esp_netif_init() at start of day; we'd like to avoid the "going bang" bit, which is not very friendly.
We can't fix this by calling esp_netif_init() ourselves in the library code, as the documentation says that it must be called exactly once.
Question: is there a way that we can determine, in our library code, if esp-netif has [not] been initialised, allowing us to do nothing, or return a run time error, be a bit less "bangy"?
However, this code will go "bang" somewhere inside the ESP-IDF TCP-IP code if the user happens not to have called esp_netif_init() at start of day; we'd like to avoid the "going bang" bit, which is not very friendly.
We can't fix this by calling esp_netif_init() ourselves in the library code, as the documentation says that it must be called exactly once.
Question: is there a way that we can determine, in our library code, if esp-netif has [not] been initialised, allowing us to do nothing, or return a run time error, be a bit less "bangy"?