Skip to content
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

Fixed bug in modes with microsteps #2338

Merged
merged 5 commits into from
Jul 1, 2024
Merged

Fixed bug in modes with microsteps #2338

merged 5 commits into from
Jul 1, 2024

Conversation

edwardalee
Copy link
Collaborator

@edwardalee edwardalee commented Jun 28, 2024

This PR is a companion to lf-lang/reactor-c#459, adding a test and aligning reactor-c.

Summary by CodeRabbit

  • New Features

    • Improved logic for handling mode transitions and watchdog reactions in a reactive system to prevent fatal errors.
    • Introduced a new reactor Arbitrator with enhanced input handling and watchdog functionality.
  • Bug Fixes

    • Resolved fatal error occurring after mode transitions due to microstep value issues, ensuring smooth execution.

@edwardalee edwardalee requested a review from cmnrd June 28, 2024 22:33
Copy link

coderabbitai bot commented Jun 28, 2024

Walkthrough

The updates consist of a commit hash update in the reactor-c module and the addition of logic in ModesWithWatchdog.lf to handle mode transitions and watchdog reactions, fixing a fatal error due to a hardwired microstep value. Enhanced functionality is ensured by smooth transitions and added reactors.

Changes

File Path Change Summary
core/src/main/resources/lib/c/reactor-c Updated the subproject commit hash from 587a8f9498b69bc82f404e432f881d7bb0bcf383 to 5ac0a0b3b0759910e8397590c614e86652021b44.
test/C/src/modal_models/ModesWithWatchdog.lf Introduced logic to manage mode transitions and watchdog reactions, fixed fatal error due to a hardwired microstep value. Added new Arbitrator reactor with Primary and Backup modes. Developed main reactor with timer to interact with Arbitrator instance.

Sequence Diagram(s)

sequenceDiagram
    participant Main as Main Reactor
    participant Arbitrator as Arbitrator<timeout: 100 ms>
    participant Timer as Timer

    Timer-->>Main: Timer t triggers
    Main->>Arbitrator: Set inputs in1, in2
    Arbitrator->>Arbitrator: Transition to Primary mode
    Arbitrator->>Watchdog: Activate watcher
    Note over Arbitrator, Watchdog: Handling mode transition and watchdog reaction
    Watchdog-->>Arbitrator: Watchdog signal
    Arbitrator->>Arbitrator: Transition to Backup mode if necessary
Loading

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 16a28f7 and a9e8db3.

Files selected for processing (2)
  • core/src/main/resources/lib/c/reactor-c (1 hunks)
  • test/C/src/concurrent/ModesWithWatchdog.lf (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • core/src/main/resources/lib/c/reactor-c
Additional comments not posted (3)
test/C/src/concurrent/ModesWithWatchdog.lf (3)

1-11: LGTM!

The header comment provides clear context for the test, and the target declaration sets appropriate parameters.


13-35: LGTM!

The Arbitrator reactor is well-structured with correct implementation of watchdog and mode transitions.


37-46: LGTM!

The main reactor is correctly implemented to test the Arbitrator reactor with appropriate timer and reactions.


Tip

Early access features
  • OpenAI gpt-4o model for reviews and chat.

Note:

  • You can disable early access features from the CodeRabbit UI or by setting early_access: false in the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are always opted into early access features.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@lhstrh lhstrh changed the title Modes with microsteps Fixed bug in modes with microsteps Jun 30, 2024
@lhstrh lhstrh enabled auto-merge July 1, 2024 08:55
@lhstrh lhstrh added this pull request to the merge queue Jul 1, 2024
Merged via the queue into master with commit ab48e80 Jul 1, 2024
26 checks passed
@lhstrh lhstrh deleted the modes-with-microsteps branch July 1, 2024 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants