node-dmx / dmx

DMX controller library for node.js
MIT License
297 stars 95 forks source link

Fix universe buffer for ArtNet #38

Closed Joebayld closed 6 years ago

Joebayld commented 6 years ago

This should be a UInt8 buffer, not an Int16. Previously setting a universe in the options did nothing.

wiedi commented 6 years ago

I'm not sure this is correct. I currently don't have any art-net devices to test, so I'm just looking at http://artisticlicence.com/WebSiteMaster/User%20Guides/art-net.pdf.

The two relevant fields seem to be:

And Port-Address is defined as

one of the 32,768 possible addresses to which a DMX frame can be directed. The Port-Address is a 15 bit number composed of Net+Sub-Net+Universe.

Where

Currently the assumption is that the "universe" passed in as an option is the full "port-address". Maybe this option should be renamed to "port_address" or there should be additional options for the "net" and "sub-net"?

The other actual thing that seems wrong is that writeInt16BE should probably be writeInt16LE - maybe you can test if this also works with your hardware as I'd think that to be a better fix.

Thanks!

Joebayld commented 6 years ago

I just tested - writeInt16LE fixes it. I typically use a UInt8 and ignore the other buffer as you would never need to go over 255 universes. But you're correct. The endians were just swapped.

Thanks

Fensterbank commented 6 years ago

@Joebayld If this fixed the problem, do you want to update your commit to just change writeInt16BE into writeInt16LE? Then we could merge and close this pull request.

Thanks!