[643] Fixed new protections don't accept volatile#644
Merged
Conversation
Contributor
ST-LIB Release Plan
Pending changes
|
FoniksFox
approved these changes
May 9, 2026
Contributor
FoniksFox
left a comment
There was a problem hiding this comment.
LGTM and it seems to be working correctly
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.
Volatile Protection Sources
Related PR: #628 - ProtectionManager Without Ethernet / Fault Runtime Redesign
Summary
This follow-up extends the compile-time protection model introduced in PR #628 so protections
can use
volatilevariables directly as sample sources.Protection source storage now preserves cv-qualification through a reference source wrapper,
while rule evaluation still works with plain sample values. This keeps the public protection
declaration API unchanged and avoids making all protection reads volatile by default.
Main Changes
ReferenceSampleSource<Storage>to preserve the storage type used by a protection source.SampleSource<Storage>as an alias for the reference source wrapper.Protectionstore the actual readable source type instead of forcing every source intoSampleSource<T>.ProtectionEnginewrap raw variables with a source type that preservesvolatile.volatile floatreads and reportsthe observed value correctly.
Example