I got the following items.
- ESP32 S2 Mini V1.0.0 with type C usb
- 1.8 inch TFT LCD Display with ST7735 driver board
The projects are organized in the following structure:
esp/
├── projects/
│ ├── 001-hello-world/ # First project
│ │ ├── CMakeLists.txt
│ │ ├── main/
│ │ │ ├── CMakeLists.txt
│ │ │ └── main.cpp
│ │ └── sdkconfig
│ ├── 002/ # Additional projects
│ └── ...
├── main # Symlink to active project's main/
├── CMakeLists.txt # Symlink to active project's CMakeLists.txt
├── sdkconfig # ESP-IDF configuration (copied/managed per project)
└── switch.sh # Project selector scriptEach project folder contains its own:
main/- Source code directoryCMakeLists.txt- Build configuration
Use the switch.sh script to select which project is active:
./switch.shThe script provides an interactive menu where you can:
- Navigate using arrow keys (
↑/↓) or vim keys (j/k) - Select by pressing
Enter
Once a project is selected, symlinks at the root directory (main and CMakeLists.txt) will automatically point to that project's files. This allows ESP-IDF tools to build and flash the selected project.
Dependencies can be found in components.espressif.com.
# add a single dependency
idf.py add-dependency "lvgl/lvgl^9.5.0"The .envrc file manages environment variables for the project. It's automatically loaded by direnv when you enter the project directory.
-
Copy
.envrc.exampleto.envrc:cp .envrc.example .envrc
-
Update
.envrcwith your values (e.g., WiFi credentials):export WIFI_SSID="your-ssid" export WIFI_PASSWORD="your-password"
-
Allow direnv to load it:
direnv allow
Note: The .envrc file is gitignored and should not be committed to the repository.
You cannot access env variables in code using getenv("WIFI_SSID").
# add this to root level CMakeLists.txt
add_compile_definitions(
LV_CONF_PATH="${CMAKE_SOURCE_DIR}/main/lv_conf.h"
WIFI_SSID="$ENV{WIFI_SSID}"
WIFI_PASSWORD="$ENV{WIFI_PASSWORD}"
)