-1

I am trying to make some sort of easy way to define mcu that I use, and by defining mcu, different header files should be included. I tried doing it with #if and #elif directives :

#include "Parameters.h"

#if MCU_IN_USE == ESP32_S3_MINI_1
   #include "ESP32_S3_MINI_1_PINOUT.h"
#elif MCU_IN_USE == ESP32_S3_WROOM
   #include "ESP32_S3_WROOM_PINOUT.h"
#endif

and in Parameters.h file I defined MCU like this:

//#define MCU_IN_USE         ESP32_S3_MINI_1
#define MCU_IN_USE         ESP32_S3_WROOM

I plan to uncomment the one I use and comment the other one, but the problem is that no matter which define is uncommented, I always get first option in #if statement even though, I am using #elif define: enter image description here

What causes this problem?

3
  • 1
    What are ESP32_S3_MINI_1 and ESP32_S3_WROOM defined to? Commented Sep 19, 2023 at 8:44
  • fixed it. I don't know why, but I did not defined them to anything, so basically I defined a MCU_IN_USE to nothing. Very shameful mistake Commented Sep 19, 2023 at 8:48
  • 1
    :-) Can happen to anyone! Voting to close as a typo. Commented Sep 19, 2023 at 8:49

1 Answer 1

0

So basically I defined MCU_IN_USE to ESP32_S3_WROOM and ESP32_S3_WROOM is defined to nothing, it is not constant or string or anything, it's just an empty definition. I don't know why I did this, because it super basic mistake, but fixed it by including this

#define ESP32_S3_MINI_1     0
#define ESP32_S3_WROOM      1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.