Skip to content
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

Convert userprefs to a json file instead of header file which has to be included everywhere #5471

Merged
merged 6 commits into from
Dec 3, 2024

Conversation

thebentern
Copy link
Contributor

For your consideration is a change to the userPrefs scheme which has a more strategic direction for ad-hoc agent builds. One of the main goals of userPrefs was to enable ad-hoc builds with custom default values. However, boxing this into a header file was always limiting from a web app consumer perspective.

In the past I attempted to bridge this gap by using clang to generate a manifest of the userprefs into a json file which we would then later attempt to tokenize and replace values from user input. That approach was problematic and still had the issue of macros not being defined unless the userPrefs header was included in every single file that required use of them.

This new json based approach ensures availability globally by injecting them as build flags in our custom PIO script, still allows proper macro expansion, and will make consuming in an automated build application much simpler.

image

@panaceya
Copy link
Contributor

Nice description, but it's not clear how to use it. Please provide more examples.

Copy link
Contributor

@fifieldt fifieldt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - just had one comment about the uncommented thing - tzplaceholder.

@thebentern
Copy link
Contributor Author

Nice description, but it's not clear how to use it. Please provide more examples.

Works almost entirely the same way as the header file except it is "MACRO": "value" instead of #define MACRO value and you no longer had to include the header file. These now get injected as build flags by platformio globally

@thebentern thebentern merged commit d00e0f6 into master Dec 3, 2024
36 checks passed
@thebentern thebentern deleted the userprefs branch December 3, 2024 12:17
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

Successfully merging this pull request may close these issues.

3 participants