Closed ghost closed 7 years ago
In the ArtPoll packet definition (http://www.artisticlicence.com/WebSiteMaster/User%20Guides/art-net.pdf) the ID is an
Array of 8 characters, the final character is a null termination. Value = ‘A’ ‘r’ ‘t’ ‘-‘ ‘N’ ‘e’ ‘t’ 0x00
So you are right
the loop is from index zero to kess the 9: 0...8 Index 8 is undefined: ‘A’ [0] ‘r’ [1] ‘t’ [2] ‘-‘ [3] ‘N’ [4] ‘e’ [5] ‘t’ [6] 0x00 [7] ??? [8]
Then make a pull request please, but for me it was never a problem.
Your code:
// Check that packetID is "Art-Net" else ignore for (byte i = 0 ; i < 9 ; i++) { if (artnetPacket[i] != ART_NET_ID[i]) return 0; }
should be IMHO:
// Check that packetID is "Art-Net" else ignore for (byte i = 0 ; i < 8 ; i++) { if (artnetPacket[i] != ART_NET_ID[i]) return 0; }
Why should I make a pull request? Just change the 9 into a 8...
I'm not using this library but someone complained that it does not work with Rocrail: http://forum.rocrail.net/viewtopic.php?f=117&t=12727
Index 8 is the first byte of the opcode as you also wrote in your source:
opcode = artnetPacket[8] | artnetPacket[9] << 8;
Actually i am not the owner of this repository so i am not able to change it
Attach is a patch.
Thanks. Fixed by commit 5cc30a4
Checking the Art-Net ID with a length of 9 is not correct because the ID is 8 characters long including the zero termination. All packets will be dropped because the last byte of 9 will probably never match.
Array of 8 characters, the final character is a null termination. Value = ‘A’ ‘r’ ‘t’ ‘-‘ ‘N’ ‘e’ ‘t’ 0x00