-
Notifications
You must be signed in to change notification settings - Fork 7.6k
LED_BUILTIN must be macro not const int #4134
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
Comments
I have been bitten by this issue too. Even inside the esp32 eco system it causes confusion. |
If it is desired to leave it as a const int, an easy thing to do is to add this define: And for all those that are unfamiliar with the cpp macro parsing rules defined by the standard, it is not a circular definition. --- bill |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
bump. |
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. |
bump. |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
Still an issue. example:
would become:
|
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. |
@bperrybap submit a PR containing the fix. |
I would consider it if the project owners would comment and agree to the fix. |
@bperrybap you do realize this is a community supported project right? The community drives most of the development via PRs and issues. I agree it would be a bit of work to update the various pins files, but if this is a critical feature it would be worth it to invest the time. Future pin headers would need to be validated for the same before merge as well |
I am fully aware of how community supported projects typically work. This is not the only case of this. In fact some of the worst offenders of this behavior / attitude are the original arduino.cc developers. It took me more than a year to get them accept some changes to fix digitalWrite() to make register updates atomic and to this day, I believe that one of them still does not understand atomicity issures related to RISC instructions and never accepted that there was an atomicity issue related to i/o register updates being done in foreground code. This is why, now, before I go off and generate a PR to fix an issue, particularly one that involves touching several modules, I like to get some sort of acknowledgement up front that
|
we are pretty open for PRs ;) few do not get merged (sometimes takes a while, but happens non the less) |
@me-no-dev Can that commit be backed out so a proper PR can be pulled in? BTW, there are a few other macro symbols that need fixing as well. |
new PR was merged with proper definitions :) issue should now be resolved ;) |
Looks good. In the future, I'll not be hesitant to create a PR. |
The symbol LED_BUILTIN is supposed to be a macro not a const int
This was discussed at length on the Arduino developers mailing list years ago and final conclusion is that it must be a macro.
The reason is that some boards have a builtin led and some don't.
The only way for code, particularly library code that runs a many different platforms/core/boards, to "know" if the board that the code is being compiled for has a built in led is to use a macro for LED_BUILTIN so that the code can do compile time conditionals and enable / disable any led code appropriately when being built for various boards.
If you go look at the variants that arduino.cc supplies and even the esp8266 variants, you will see that LED_BUILTIN is a macro rather than a const int
variants that use const int instead of a macro will "trick" code into thinking that there is no built in led.
The text was updated successfully, but these errors were encountered: