Skip to content
Advertisement

ESP32 – combining two or more SDK example projects into one

tl;dr — how do I combine a pair of SDK projects together and have the “menuconfig” system work properly?


I have a simple project in mind for an ESP32 module: Have the ESP32 provide a new dedicated WiFi network that allows a smart phone to connect directly to the ESP32. Once connected, the phone can point its web browser to the IP address of the ESP32 (hard-coded as 192.168.1.1) and the ESP32 will accept HTTP connections from the phone. Thus the user will have a simple interface through which to interact with the ESP32 using HTML data-entry forms, buttons and so on.

Note, this connection goes no further than the ESP32, no internet connection is required at all for this project.

Luckily, the SDK for the module includes lots of examples, and I have managed to get the web server working, and also the WiFi access point, but not both at the same time. These are two example projects (“… examples/protocols/http_server/simple” and “… examples/wifi/getting_started/softAP”).

So far I’ve managed to discover that the WiFi access point software runs in the “background” and continues even after the main() function has ended. This means that I should be able to bring in the web-server code from the other example and execute it in the main() function. I’m pretty sure that will be feasible (please correct me if I’m mistaken).

The Question:

Each of these two example projects contain a “idf.py menuconfig” command that lets the user quickly change any of the important settings such as the WiFi SSID or the HTTP basic authentication password.

I’d like to retain this menu system after the two projects have been combined because it’s extremely useful and somewhat reduces the human error involved in altering the code before recompiling.

Is there a simple way to combine the menuconfig systems from two SDK example projects into a single one that can be used to fully configure a project that is a combination of both code-bases?

Further info: I’m using the ESP-IDF dev kit on an Ubuntu 20 virtual machine, connecting to the ESP32 via USB.

Advertisement

Answer

It’s very simple. The menuconfig items are described in the component’s Kconfig.projbuild file. If you want add those items from one project to the other, you can simply copy-paste the content of one main/Kconfig.projbuild file to the other one and that’s it. See ESP IDF documentation for details.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement