So what I am trying to accomplish is to use the board type (the
board = lolin_d32 entry) in my code as a macro. The use case, for instance, is allowing the running firmware to pull down down the correct firmware for the board as an OTA upgrade.
There are two places I can think of pulling it:
However, from what I have been able to determine, I cannot create a build flag that is available in the sketch via an
extra_scripts. I know I can put a determinate build flag in the
platformio.ini but that seems inelegant since it’s a place I can make a silly mistake as I add more board types in the future.
I have seen an answer pointing out that there are platform/board flags defined, however, what I am looking for is the simple board name. Using those flags I would need to add explicit code for each board like this:
#ifdef ARDUINO_LOLIN_D32 String x = "lolin_d32"; #else String x = "unknown"; #endif
I would greatly prefer to use something simple and that does not require edits/additions as I expand, such as:
String x = BOARD;
This does not seem possible unless I’m missing something simple?