Skip to content

Add USER_SETUP_LOADED check to ESP-IDF config path #3709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

justinnewitter
Copy link

Previously, if CONFIG_TFT_eSPI_ESPIDF was set, TFT_eSPI.h would unconditionally include TFT_config.h — even if USER_SETUP_LOADED was already defined (e.g., from User_Setup.h). This caused build errors due to missing or conflicting macros.

TFT_config.h is intended for ESP-IDF environments, while User_Setup.h is typically used in Arduino environments. However, this distinction breaks down when using PlatformIO with ESP-IDF as the base framework and Arduino as a component.

This change adds a check for USER_SETUP_LOADED even in the ESP-IDF codepath, giving users the flexibility to load their preferred configuration file. It avoids including TFT_config.h if a valid setup has already been provided.

This is especially useful in hybrid environments where ESP-IDF is used for system-level access (e.g., Bluetooth, low-level power control), but Arduino is used for everything else. In these cases, using User_Setup.h with PlatformIO may be preferred rather than relying on menuconfig.

This change maintains full compatibility with pure ESP-IDF setups that rely on TFT_config.h and idf.py menuconfig, while making the library more flexible in real-world mixed-mode builds.

Previously, if CONFIG_TFT_eSPI_ESPIDF was set, TFT_eSPI.h would
unconditionally include TFT_config.h — even if USER_SETUP_LOADED
was already defined (e.g., from User_Setup.h). This caused build
errors due to missing or conflicting macros.

TFT_config.h is intended for ESP-IDF environments, while
User_Setup.h is typically used in Arduino environments. However,
this distinction breaks down when using PlatformIO with ESP-IDF as
the base framework and Arduino as a component.

This change adds a check for USER_SETUP_LOADED even in the ESP-IDF
codepath, giving users the flexibility to load their preferred
configuration file. It avoids including TFT_config.h if a valid
setup has already been provided.

This is especially useful in hybrid environments where ESP-IDF is
used for system-level access (e.g., Bluetooth, low-level power
control), but Arduino is used for everything else. In these cases,
using User_Setup.h with PlatformIO may be preferred rather than
relying on menuconfig.

This change maintains full compatibility with pure ESP-IDF setups
that rely on TFT_config.h and idf.py menuconfig, while making the
library more flexible in real-world mixed-mode builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant