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

Using set_values #47

Open
tmolberg opened this issue May 13, 2024 · 2 comments
Open

Using set_values #47

tmolberg opened this issue May 13, 2024 · 2 comments

Comments

@tmolberg
Copy link

tmolberg commented May 13, 2024

Hi,

Probably not an issue with the project but just wanted to check if im doing something wrong trying to set an explicite value and not a fade.

For reference, I have a PKnight Artnet4 - Cr041 (probably one of cheapest artnet controllers avaliable :D)

the fade function works as intended as shown in your example. If I on the other hand try to use the set_values function towards a device, nothing seems to happen. Changing the fade time to 0, seems to do something along the lines of what I want, it just feels wrong when there is a specific function to set the value directly.

I had a look in the issues list and found another reference of a person having issues using the set_values function. The example below does not seem to do anything.

import asyncio, time
from pyartnet import ArtNetNode

async def main():
    node = ArtNetNode('192.168.100.22', 6454, start_refresh_task=True)
    universe = node.add_universe(0)
    channel = universe.add_channel(start=1, width=6)
    channel.set_values([255,255,255,255,255,0]) #on this specific device, the last channel is used for special effects (strobes)
    await channel
    asyncio.sleep(1)
    channel.set_values([0,0,0,0,0,0])
    
asyncio.run(main())

Have I misunderstood how the set_values function should work?

@tmolberg tmolberg reopened this May 13, 2024
@tmolberg
Copy link
Author

Found another reference where set_values seems to be working.


    channel.set_values([255,255,255,0,255,0])
    await channel
    await asyncio.sleep(1)

    channel.set_values([0,0,0,0,0,0])
    await channel
    await asyncio.sleep(1)

Im wondering, whats the best way of handling that the light actually recieves the command to shut off? await channel doesnt seem to do anything when using set_values, but if I use await asyncio.sleep(1), then the light hits the target values which were requested.

I was more or less hoping everything needed would be to use channel.set_values([255,255,255,0,255,0]) and channel.set_values([0,0,0,0,0,0]) and it would do it, but then again, im not a developer

@spacemanspiff2007
Copy link
Owner

spacemanspiff2007 commented May 23, 2024

When you create a node you specify with max_fps the interval at which the data will be sent to the device.
Calling set_values will sent out the data with the next "tick", e.g. if you have max_fps=25 then you have to wait at least 40ms so the data can be sent because it could be that you just missed the send interval.

Awaiting an object waits for all Fades to complete. So the most easy solution would be to set a fade with maybe 0ms duration. and just call await channel or await node.
Does that make it more clear?

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

No branches or pull requests

2 participants