-
Notifications
You must be signed in to change notification settings - Fork 3
Release 0.4 #26
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
Release 0.4 #26
Conversation
There was a problem hiding this comment.
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 releases version 0.4 of the firmware-controller crate with significant improvements to the field attribute system. The release transitions from PubSubChannel to Watch-based state subscriptions, provides independent getter/setter generation, and removes the deprecated pub_setter syntax.
- Refactored published field streams to use
embassy_sync::watch::Watchchannels that yield current value on first poll, then subsequent changes - Added new
getterandsetterattributes that work independently ofpublish, with support for custom naming - Removed the old
pub_settersub-attribute in favor of the new standalonesetterattribute
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration.rs | Updated test attributes to use new syntax; added tests for initial stream value, custom-named getters/setters, and independent setters without publish |
| src/controller/mod.rs | Updated function signature to pass getter and setter field collections to impl expansion |
| src/controller/item_struct.rs | Major refactoring: introduced ControllerAttrs struct, separated parsing and code generation, added getter/setter field info structures, implemented Watch-based publishing with initial value sending |
| src/controller/item_impl.rs | Added getter generation logic with request/response channels; updated setter generation to handle both published and non-published fields |
| README.md | Updated examples to show new stream behavior with initial value consumption; revised API documentation for getter/setter attributes |
| CLAUDE.md | Updated technical documentation to reflect Watch channel usage, getter/setter attributes, and new stream semantics |
| CHANGELOG.md | Added release notes for 0.4.0 with breaking changes and new features |
| Cargo.toml | Version bump to 0.4.0 |
| Cargo.lock | Version bump to 0.4.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
If `getter` attribute is specified on a field, a client getter by the same name as the field, is generated for you. You can override the name by specifying a string value to the `getter` attribute.
The attribute is now called `setter` and it works very similar to the `getter` attribute. For backwards compatibility, we still allow `pub_setter` attribute under the `published` attribute.
That is, on the first `poll_next`, they yield the current value. This is helpful to avoid a footgun situation where a user could first get the current value and then subscribe to changes, leading to possibly missing out on changes in between the two operations. Now, if you want to subscribe to changes, you just create the stream directly and you get the current value by just calling `.next()` on it. Breaking Changes!!!! The stream now only yields the raw new value of the field, instead of yielding a struct with both old and new values. If user needs to keep the old value, they are free to do so manually.
Since we're breaking API anyway, we can just ditch this.
pub_setterattribute