[Solved] esp_wifi_init - what are the record types in the queue?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

[Solved] esp_wifi_init - what are the record types in the queue?

Postby kolban » Sat Sep 24, 2016 4:03 am

If I am understanding correctly, we must call esp_wifi_init() before making any other ESP32 wifi API calls. This API takes a pointer to a wifi_init_config_t. Within that structure is a property called "event_q" which is documented as a FreeRTOS queue which I am presuming is created with a call to xQueueCreate(). However, xQueueCreate() wants a size per record in the queue. What would be a good size for this record?

Do we have any samples of usage of esp_wifi_init() available to us?
Last edited by kolban on Fri Sep 30, 2016 3:12 pm, edited 1 time in total.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32


User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: esp_wifi_init - what are the record types in the queue?

Postby kolban » Sat Sep 24, 2016 1:51 pm

From that one line answer ... I think you are saying ...

"One of the good things about IDF is that some of the source code for the environment in which your ESP32 application runs is available on a Github repository called:

https://github.com/espressif/esp-idf

While no-one expects programmers who simply want to use ESP32 as a platform to have to grunge through the source in order to learn how to use it, these are early days in the life of ESP32. The choices may have been to delay ESP32 release until ALL the documentation was ready ... or, as seems to have been done ... place the ESP32 in our hands and our knowledge on how to use it will mature and be documented over time. In the meantime, if one has questions, feel free to pose them on the forum and if others have beaten that path before, they might be able to share what they have learned ... otherwise we can indeed look in the source and get clues, hints and knowledge from there. However, it is important to note that NOT all of the source seems to be present. When we clone the ESP-IDF, part of that pulls down the project:

https://github.com/espressif/esp32-wifi-lib

which are files released only as binaries and not as source. If we search the ESP-IDF for the function you were looking for ... 'esp_wifi_init', we don't find it ... this might imply that it is supplied as binary only within the binary libraries. If this is the case, we must just be patient and wait for Espressif documentation to catch up".
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: esp_wifi_init - what are the record types in the queue?

Postby WiFive » Sat Sep 24, 2016 2:21 pm

No, in that exact file linked you can see:

Code: Select all

static void esp_wifi_task(void *pvParameters)
{
    esp_err_t err;
    wifi_init_config_t cfg;
    cfg.event_q = (xQueueHandle)esp_event_get_handler();
   
    do {
        err = esp_wifi_init(&cfg);    
       
And if you look further you will find:

Code: Select all

g_event_handler = xQueueCreate(CONFIG_SYSTEM_EVENT_QUEUE_SIZE, sizeof(system_event_t));
https://github.com/espressif/esp-idf/bl ... 32/event.c

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: esp_wifi_init - what are the record types in the queue?

Postby ESP_igrr » Sun Sep 25, 2016 3:09 am

Just to clarify a bit: currently application developers are not supposed to call esp_wifi_init, it is called automatically from startup code. One only needs to configure wifi settings in app_main function.

This, however, is going to change in the coming days, as app_main callback will be removed, and all the initialization (including wifi init) will be done in user provided 'main' function.

Who is online

Users browsing this forum: No registered users and 111 guests