I am using about 4 different boards to build a sensor and I have been using the precompiler to adjust the settings after I select the board in the IDE.
Is is possible to identify which board I have selected in the IDE so I can use this to define the different board configurations on the code?
I am using a HELTEC ESP32 V2, a WEMOS D1 RE MINI, A DOIT DEVKIT V1 and a ESP8266 DEVKIT. Their pinot is different and this is the reason I am using definitions on the precompiler...
If I could get the selected board from the IDE, it would be easier for me when switching boards.
The uno.build.board property is used to set a compile-time macro ARDUINO_{build.board} to allow use of conditional code between #ifdefs. If not defined, a build.board value is automatically generated and the Arduino development software outputs a warning. In this case the macro defined at compile time will be ARDUINO_AVR_UNO.
None of the board names you mentioned match with the official board names used by the ESP32 and ESP8266 platforms, so I'm not able to provide you with the macro names. But if you study the information at the link I posted above and then check the boards.txt files for each platform, you'll be able to figure out what the board identification macro is for each of your boards and then use preprocessor conditionals to adjust your code accordingly: