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

Fix artnet pollreply #58

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions Artnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,12 @@ uint16_t Artnet::read()

memset(ArtPollReply.goodinput, 0x08, 4);
memset(ArtPollReply.goodoutput, 0x80, 4);
memset(ArtPollReply.porttypes, 0xc0, 4);
memset(ArtPollReply.porttypes, 0x80, 4);

uint8_t shortname [18];
uint8_t longname [64];
sprintf((char *)shortname, "artnet arduino");
sprintf((char *)longname, "Art-Net -> Arduino Bridge");
memcpy(ArtPollReply.shortname, shortname, sizeof(shortname));
memcpy(ArtPollReply.longname, longname, sizeof(longname));
memset(ArtPollReply.shortname, 0, 16);
memset(ArtPollReply.longname, 0, 64);
sprintf((char *)ArtPollReply.shortname, "artnet arduino");
sprintf((char *)ArtPollReply.longname, "Art-Net -> Arduino Bridge");

ArtPollReply.etsaman[0] = 0;
ArtPollReply.etsaman[1] = 0;
Expand All @@ -142,6 +140,12 @@ uint16_t Artnet::read()
ArtPollReply.swremote = 0;
ArtPollReply.style = 0;

#if !defined(ARDUINO_SAMD_ZERO) && !defined(ESP8266) && !defined(ESP32)
Ethernet.MACAddress(ArtPollReply.mac);
#else
WiFi.macAdress(ArtPollReply.mac);
#endif

ArtPollReply.numbportsH = 0;
ArtPollReply.numbports = 4;
ArtPollReply.status2 = 0x08;
Expand All @@ -151,15 +155,16 @@ uint16_t Artnet::read()
ArtPollReply.bindip[2] = node_ip_address[2];
ArtPollReply.bindip[3] = node_ip_address[3];

uint8_t swin[4] = {0x01,0x02,0x03,0x04};
uint8_t swout[4] = {0x01,0x02,0x03,0x04};
uint8_t swin[4] = {0x00,0x01,0x02,0x03};
uint8_t swout[4] = {0x00,0x01,0x02,0x03};
for(uint8_t i = 0; i < 4; i++)
{
ArtPollReply.swout[i] = swout[i];
ArtPollReply.swin[i] = swin[i];
}
memset(ArtPollReply.nodereport, 0, 64);
sprintf((char *)ArtPollReply.nodereport, "%i DMX output universes active.", ArtPollReply.numbports);
Udp.beginPacket(broadcast, ART_NET_PORT);//send the packet to the broadcast address
Udp.beginPacket(remoteIP, ART_NET_PORT);//send the packet to the Controller that sent ArtPoll
Udp.write((uint8_t *)&ArtPollReply, sizeof(ArtPollReply));
Udp.endPacket();

Expand Down