feat(limits): initial suggestion for limits - #82
Draft
edvardxyz wants to merge 5 commits into
Draft
Conversation
edvardxyz
requested review from
Lykkeberg,
Copilot,
jeanbaptistelab,
johandc,
kivkiv12345,
steffenmortensen-si and
troelsjessen
June 29, 2026 06:33
There was a problem hiding this comment.
Pull request overview
This PR introduces initial infrastructure for parameter value limits by extending param_t with min/max bounds and adding a bounds check into numeric param_set_* paths.
Changes:
- Add
param_bound_tunion plusmin/maxfields toparam_t(intended to be type-agnostic bounds storage). - Add a bounds check to generated numeric setters in
src/param/param.c. - Extend
PARAM_DEFINE_STATIC_RAMmacro signature to accept_min/_maxarguments.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/param/param.c |
Adds bounds enforcement to numeric setters; currently needs compilation and “limits enabled/disabled” semantics resolved. |
include/param/param.h |
Adds param_t min/max storage and type-mapping macros; updates PARAM_DEFINE_STATIC_RAM API to accept min/max. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Initial suggestion for how we could add limits.
Do we want to break PARAM_DEFINE API or try and keep backwards compat?
We could use PM_LIMITS flag to conditionally check
The param_t struct grows by 16 bytes 2*8
We could also just make a pre set callback for the user something like:
if (param->pre_set) {
if (param->pre_set(param, i, &value) == false) {
return;
}
} \
We could have both or one of these.
We might also extend union to have 32bits