Skip to content

feat(limits): initial suggestion for limits - #82

Draft
edvardxyz wants to merge 5 commits into
masterfrom
feature/min-max-values
Draft

feat(limits): initial suggestion for limits#82
edvardxyz wants to merge 5 commits into
masterfrom
feature/min-max-values

Conversation

@edvardxyz

@edvardxyz edvardxyz commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_t union plus min/max fields to param_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_RAM macro signature to accept _min/_max arguments.

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.

Comment thread src/param/param.c
Comment thread include/param/param.h
Comment thread src/param/param.c Outdated
Comment thread include/param/param.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants