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

Added the ability to send ArtSync message in the Art-Net protocol implementation. #27

Merged
merged 5 commits into from
Mar 16, 2024

Conversation

kacper516
Copy link
Contributor

@kacper516 kacper516 commented Feb 14, 2024

Changes:

  • Implemented the send_artsync method, which sends an ArtSync message to Art-Net receiving devices.
  • Added the artsync_header header to the StupidArtnet class for creating ArtSync messages.

Purpose:
Introducing the capability to send ArtSync messages enables synchronization of Art-Net receiving devices, which is essential for ensuring synchronized lighting effects on stage or in other environments.

Summary by CodeRabbit

  • New Features
    • Updated the StupidArtnet class to support creating and sending an ArtSync header, enhancing synchronization capabilities.

Copy link
Contributor

coderabbitai bot commented Feb 14, 2024

Walkthrough

The StupidArtnet library has been enhanced with the capability to manage ArtSync packets, enriching its functionality for synchronizing lighting displays. This update introduces methods for creating and transmitting ArtSync headers, seamlessly integrating this feature with the existing DMX packet handling. This advancement enables more precise control and synchronization of lighting effects, representing a significant improvement in the library's capabilities.

Changes

File(s) Change Summary
stupidArtnet/StupidArtnet.py Updated StupidArtnet class to handle ArtSync headers, added creation and sending methods.
.github/workflows/run tests.yml Updated Python version setup in the workflow from 3.10.12 to 3.11.8 for running tests.

🐰✨
In the code's woven burrow, deep and wide,
A new spell cast, with ArtSync's tide.
Packets dance in synchronized delight,
Under the moon, through the digital night.
With every byte, our magic grows,
Guided by the code that the rabbit knows.
🌟🐾

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4c4beba and a2bec3c.
Files selected for processing (1)
  • stupidArtnet/StupidArtnet.py (13 hunks)
Additional comments: 4
stupidArtnet/StupidArtnet.py (4)
  • 47-47: Initialization of artsync_header is correct but ensure its usage aligns with the intended ArtSync functionality.
  • 65-67: Calling make_artdmx_header and make_artsync_header in the constructor ensures both headers are prepared upon object instantiation. Verify that this aligns with the intended use cases for ArtSync functionality.
  • 134-150: The make_artsync_header method correctly initializes the ArtSync header according to the Art-Net protocol specifications. Ensure that the OpCode 0x52 is the correct value for ArtSync packets.
  • 387-389: Sending an ArtSync packet using send_artsync at the end of the main block is a practical demonstration of the new functionality. Ensure that this is intended for example purposes and not part of the production code.

stupidArtnet/StupidArtnet.py Outdated Show resolved Hide resolved
kacper516 and others added 3 commits February 14, 2024 13:09
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between a2bec3c and 3d43c47.
Files selected for processing (2)
  • .github/workflows/run tests.yml (1 hunks)
  • stupidArtnet/StupidArtnet.py (13 hunks)
Files skipped from review as they are similar to previous changes (1)
  • stupidArtnet/StupidArtnet.py
Additional comments: 1
.github/workflows/run tests.yml (1)
  • 10-13: Verify the project's dependencies for compatibility with Python 3.11.8 and ensure actions/setup-python@v1 supports this Python version.

Copy link
Owner

@cpvalente cpvalente left a comment

Choose a reason for hiding this comment

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

Hi @kacper516 , thank you for this.

In your proposal, the user would have to imperatively emit the ArtSync packets while the ArtDmx packet sending is automated by the clock thread.

I wonder whether this process should be managed by the library rather than by the user. But I dont have experience in this matter.

Few suggestions:

Would it make sense that the internal automation sends the ArtSync packets?

Would we like to have an opt-in process for ArtSync, perhaps an option in the constructor?

From what I understand, artDmx packets are buffered until a sync command is shown, so we would need to keep the ArtSync at the desired refresh rate. Is this correct?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 3d43c47 and 621eb08.
Files selected for processing (1)
  • stupidArtnet/StupidArtnet.py (14 hunks)
Files skipped from review as they are similar to previous changes (1)
  • stupidArtnet/StupidArtnet.py

@kacper516
Copy link
Contributor Author

In case we want to utilize ArtSync, we send it after each buffer transmission (sometimes we want to send a lot of buffers before artsync, what i tell about below).

For the ArtNet data transmission, we could consider adding an option to send ArtSync directly in the constructor. This way, we determine whether we will send synchronization data or not.

When setting up multiple ArtNet servers, for example, a list consisting of 20 ArtNet servers, each sending data to different universes but sequentially, I would like to synchronize the data only after iterating through all 20 elements. At that point, it constitutes one frame of animation for me. Then, we send the synchronization signal. For this purpose, I utilize a separate instance responsible for sending the buffer to a specific address.

Based on this, I'm introducing a commit that enables sending the synchronization signal after each packet transmission (by default, this option is set to false in the constructor). Additionally, I'm allowing direct invocation of the function via the class instance, as this might be useful in certain scenarios (at least in my case).

@cpvalente
Copy link
Owner

This all sounds sensible to me, thank you for your work.

I will prepare a release, meanwhile, do you think I could ask you for some feedback on this unresolved PR?
#25

Copy link
Owner

@cpvalente cpvalente left a comment

Choose a reason for hiding this comment

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

Great work! Thank you for your help

@cpvalente cpvalente merged commit 831f2b3 into cpvalente:master Mar 16, 2024
2 checks passed
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