Skip to content

Commit

Permalink
new version
Browse files Browse the repository at this point in the history
  • Loading branch information
Yves BAZIN authored and Yves BAZIN committed Jan 6, 2021
1 parent a107988 commit 5689624
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions ArtnetESP32.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ class ArtnetESP32
incomingUniverse = 99;
uint32_t decal = nbPixelsPerUniverse * 3 + ART_DMX_START;
uint32_t decal2 = nbNeededUniverses * decal;
uint8_t *offset;
uint8_t *offset, *offset2;
// bool resetframe=true;

offset2 = artnetleds1 + currentframenumber * decal2;
er:

#ifndef ARTNET_NO_TIMEOUT
timef = millis();
#endif
offset = artnetleds1 + currentframenumber * decal2;
offset = offset2;

while (incomingUniverse != startuniverse)
{
Expand All @@ -201,7 +201,7 @@ class ArtnetESP32
}
#endif
//MSG_DONTWAIT
if ((len = recvfrom(Udp.udp_server, offset, BUFFER_SIZE, 0, (struct sockaddr *)&si_other, (socklen_t *)&slen)) > 0) //1460
if ((len = recvfrom(Udp.udp_server, offset, BUFFER_SIZE, MSG_DONTWAIT, (struct sockaddr *)&si_other, (socklen_t *)&slen)) > 0) //1460
{

incomingUniverse = offset[14];
Expand All @@ -210,15 +210,18 @@ class ArtnetESP32
#endif
}
}

#ifdef ARTNET_DEBUG
printf("Passed\n");
#endif
for (int uni = startuniverse + 1; uni < nbNeededUniverses + startuniverse; uni++)
{
offset += decal;
while ((len = recvfrom(Udp.udp_server, offset, BUFFER_SIZE, 0, (struct sockaddr *)&si_other, (socklen_t *)&slen)) <= 0)
//recvfrom(Udp.udp_server, offset, BUFFER_SIZE,MSG_DONTWAIT, (struct sockaddr *)&si_other, (socklen_t *)&slen) <= 0
//recv(Udp.udp_server, offset, BUFFER_SIZE,MSG_DONTWAIT)<=0
while ( recvfrom(Udp.udp_server, offset, BUFFER_SIZE,MSG_DONTWAIT, (struct sockaddr *)&si_other, (socklen_t *)&slen) <= 0)
{
#ifdef ARTNET_DEBUG
printf("Universe : %d length:%d expected universer:%d\n", incomingUniverse, len, uni);
#endif
//incomingUniverse = *(offset + 14);

#ifndef ARTNET_NO_TIMEOUT
if (millis() - timef > 1000)
{
Expand All @@ -231,6 +234,9 @@ class ArtnetESP32
incomingUniverse = *(offset + 14);
if (incomingUniverse != uni)
{
#ifdef ARTNET_DEBUG
printf("Universe : %d length:%d expected universer:%d\n", incomingUniverse, len, uni);
#endif
lostframes++;
// resetframe=false;
goto er;
Expand Down

0 comments on commit 5689624

Please sign in to comment.