Skip to content

Conversation

@zeenix
Copy link
Collaborator

@zeenix zeenix commented Dec 1, 2025

These attributes could be used to declare a controller method that's run by the run method, periodically based on the timeout specified.

We don't need defmt features here.
Copy link

Copilot AI left a 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 adds support for periodic poll methods in controllers using three new attributes: poll_seconds, poll_millis, and poll_micros. Poll methods are automatically called by the controller's run() loop at specified intervals using embassy_time::Ticker. Methods with identical timeout values and units are grouped together and executed sequentially when the ticker fires.

  • Adds PollMethod struct and parsing logic to handle poll attributes on controller methods
  • Implements duration-based grouping to optimize ticker usage for methods with the same interval
  • Integrates poll methods into the run() method's select loop using select_biased!

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/controller/item_impl.rs Implements poll method parsing, attribute removal, and code generation logic. Adds PollDuration enum and generate_poll_code function to create ticker declarations and select arms.
tests/integration.rs Adds integration test for poll methods using mock time driver to verify polling intervals and method grouping behavior.
README.md Documents poll method feature with usage examples and key characteristics.
CLAUDE.md Updates internal architecture documentation to describe poll methods implementation.
Cargo.toml Simplifies embassy-time dev dependency by removing defmt features and adding mock-driver for testing.
Cargo.lock Updates lockfile to reflect dependency changes, removing defmt-related packages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

These attributes could be used to declare a controller method that's run
by the `run` method, periodically based on the timeout specified.
@maxgr0 maxgr0 self-requested a review December 19, 2025 18:35
@zeenix zeenix merged commit 4af16bc into layerx-world:main Dec 19, 2025
3 checks passed
@zeenix zeenix deleted the poll-methods branch December 19, 2025 18:35
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.

2 participants