Skip to content

Settings improvements #6

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

Open
wwaltb opened this issue Mar 12, 2025 · 1 comment
Open

Settings improvements #6

wwaltb opened this issue Mar 12, 2025 · 1 comment

Comments

@wwaltb
Copy link
Contributor

wwaltb commented Mar 12, 2025

I think that the settings should be able to be defined in other places than just the settings header file, so adding guard clauses around them could be an improvement. It also allows these settings to be configured in other libraries.

@wwaltb
Copy link
Contributor Author

wwaltb commented Apr 8, 2025

So I found that this is a long standing issue with Arduino libraries since the sketches are compiled separately from libraries. Adding the guard clauses then will not allow the settings to be adjusted through sketch #DEFINEs, but it does still have some advantages:

  • With arduino-cli, you can pass defines while compiling. For example, to change the sample rate:
    arduino-cli compile ... --build-property "compiler.cpp.extra_flags=-DSAMPLE_RATE=4096 -MMD -c"
    The extra options here are platform specific, as some platforms such as esp32 have used the extra_flags property which was originally meant to be reserved for the user. This issue from arduino-cli hopes to create a definitive user namespace for compile flags, which would allow for easier ways to set these flags in the future and possibly GUI ways implemented in Arduino-IDE.
  • These guard clauses allow other libraries (specifically AudioPrism and Vibrosonics) to use SAMPLE_RATE and WINDOW_SIZE defines as well, either inheriting AudioLab's property or setting their own based on include order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant