'Adding wifi SSID and PASSWORD to sdkconfig

I'm creating a wifi application using ESP-IDF based on the examples but the example I'm using has options for setting the SSID and PASSWORD under:

Example Connection Configuration

enter image description here

when using idf.py menuconfig and which are used by CONFIG_EXAMPLE_WIFI_SSID and CONFIG_EXAMPLE_WIFI_PASSWORD in the code.

I want to set SSID and PASSWORD in my own project without using this in CMakeLists.txt:

set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)

without the above there isn't a way to define SSID and PASSWORD. They appear in:

build/config/kconfig_menus.json

but I can't seem to keep this from being overwritten in my own project. sdkconfig states it should not be edited.

Is there a best practice for using idf.py menuconfig? Or do most people just use sdkconfig.defaults and not use idf.py menuconfig?



Solution 1:[1]

I eventually tracked down the file Kconfig.projbuild in the example project via the build system docs:

Each component may also include a Kconfig file defining the component configuration options that can be set via menuconfig. Some components may also include Kconfig.projbuild and project_include.cmake files, which are special files for overriding parts of the project.

created my own version and put it in main and the options now appear when using idf.py menuconfig. Thanks to this video.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 codebrane