spacemanspiff2007 / PyArtNet

"Python wrappers for the Art-Net protocol to send DMX over Ethernet"
GNU General Public License v3.0
70 stars 14 forks source link

DMX data sent seems to be 1 byte longer than the channle width #46

Closed aiotech-pub closed 8 months ago

aiotech-pub commented 8 months ago

This is the original test code:

import asyncio
from pyartnet import ArtNetNode

async def main():
    # Run this code in your async function
    node = ArtNetNode('192.168.1.93', 6454)

    # Create universe 0
    universe = node.add_universe(1)

    # Add a channel to the universe which consists of 3 values
    # Default size of a value is 8Bit (0..255) so this would fill
    # the DMX values 1..3 of the universe
    chn1 = universe.add_channel(start=1, width=3)

    # Fade channel to 255,0,0 in 5s
    # The fade will automatically run in the background
    chn1.add_fade([100,200,250], 1000)

    # this can be used to wait till the fade is complete
    await chn1

asyncio.run(main())

if __name__ == '__main__':
    pass

seems to me that it would send 3 bytes on the first 3 DMX addresses but my HW receives always 4 bytes:

DMX: Univ: 1, Seq: 6, Data(4): 14 28 32 0
DMX: Univ: 1, Seq: 7, Data(4): 18 30 3C 0
DMX: Univ: 1, Seq: 8, Data(4): 1C 38 46 0
DMX: Univ: 1, Seq: 9, Data(4): 20 40 50 0
DMX: Univ: 1, Seq: 10, Data(4): 24 48 5A 0
DMX: Univ: 1, Seq: 11, Data(4): 28 50 64 0
DMX: Univ: 1, Seq: 12, Data(4): 2C 58 6E 0
DMX: Univ: 1, Seq: 13, Data(4): 30 60 78 0
DMX: Univ: 1, Seq: 14, Data(4): 34 68 82 0
DMX: Univ: 1, Seq: 15, Data(4): 38 70 8C 0
DMX: Univ: 1, Seq: 16, Data(4): 3C 78 96 0
DMX: Univ: 1, Seq: 17, Data(4): 40 80 A0 0
DMX: Univ: 1, Seq: 18, Data(4): 44 88 AA 0
DMX: Univ: 1, Seq: 19, Data(4): 48 90 B4 0
DMX: Univ: 1, Seq: 20, Data(4): 4C 98 BE 0
DMX: Univ: 1, Seq: 21, Data(4): 50 A0 C8 0
DMX: Univ: 1, Seq: 22, Data(4): 54 A8 D2 0
DMX: Univ: 1, Seq: 23, Data(4): 58 B0 DC 0
DMX: Univ: 1, Seq: 24, Data(4): 5C B8 E6 0
DMX: Univ: 1, Seq: 25, Data(4): 60 C0 F0 0
DMX: Univ: 1, Seq: 26, Data(4): 64 C8 FA 0

Did I understand correctly the code? Seems to me there are one more byte always 0 for DMX 4th address. What do I need to send the fading values on the first 3 DMX addresses?

spacemanspiff2007 commented 8 months ago

That's the correct behavior. With amount of dmx values has to be divisble by two. See artnet spec

aiotech-pub commented 8 months ago

Ahhhhhh... my fault, thanks