Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
Discussion options

I have a code base targeted for two different ESP32 boards. I need to conditionally compile certain sections depending on the target. How can I tell which board is selected in the Arduino Boards Manager, and can that be used for a series of #ifdef conditions?

Or is there a different/better way?

Arduino IDE 1.8.19
Arduino-esp32 core 1.0.6

Thanks.

You must be logged in to vote

Many thanks to @atanisoft & miraculix200 over on Gitter for solving this one. Their answers:

Miraculix200
have a look at https://github.com/espressif/esp-idf/blob/master/examples/wifi/power_save/main/power_save.c#L98
while it says CONFIG_IDFTARGET* it will also work in Arduino

Mike Dunston @atanisoft
If you are targeting to ESP32 (not S2/S3/C3) boards that are listed in boards.txt you can use the value after the = on lines like this:

esp32s3.build.board=ESP32S3_DEV
which expands from ARDUINO_{build.board} to ARDUINO_ESP32S3_DEV (as example). Using CONFIG_IDF_TARGET_{ESP32, ESP32C3, ESP32S2, ESP32S3} will only work for arduino-es...

Replies: 1 comment

Comment options

Many thanks to @atanisoft & miraculix200 over on Gitter for solving this one. Their answers:

Miraculix200
have a look at https://github.com/espressif/esp-idf/blob/master/examples/wifi/power_save/main/power_save.c#L98
while it says CONFIG_IDFTARGET* it will also work in Arduino

Mike Dunston @atanisoft
If you are targeting to ESP32 (not S2/S3/C3) boards that are listed in boards.txt you can use the value after the = on lines like this:

esp32s3.build.board=ESP32S3_DEV
which expands from ARDUINO_{build.board} to ARDUINO_ESP32S3_DEV (as example). Using CONFIG_IDF_TARGET_{ESP32, ESP32C3, ESP32S2, ESP32S3} will only work for arduino-esp32 2.x versions (which I'd highly recommend moving up to!)
You must be logged in to vote
0 replies
Answer selected by Xylopyrographer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /