Skip to content

Commit

Permalink
Added code to ignore a sequence number error when the sequence number…
Browse files Browse the repository at this point in the history
… is zero. Some sources do not increment the sequence number.
  • Loading branch information
MartinMueller2003 committed Jan 17, 2024
1 parent 035e9d7 commit 76328af
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions ESPixelStick/src/input/InputArtnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ void c_InputArtnet::GetStatus (JsonObject & jsonStatus)
// DEBUG_START;

JsonObject ArtnetStatus = jsonStatus.createNestedObject (F ("Artnet"));
ArtnetStatus[CN_unifirst] = startUniverse;
ArtnetStatus[CN_unilast] = LastUniverse;
ArtnetStatus[CN_unifirst] = startUniverse;
ArtnetStatus[CN_unilast] = LastUniverse;
ArtnetStatus[CN_unichanlim] = ChannelsPerUniverse;
// DEBUG_V ("");

ArtnetStatus[F ("lastData")] = lastData;
ArtnetStatus[CN_num_packets] = num_packets;
ArtnetStatus[F ("lastData")] = lastData;
ArtnetStatus[CN_num_packets] = num_packets;
ArtnetStatus[CN_packet_errors] = packet_errors;
ArtnetStatus[CN_last_clientIP] = LastRemoteIP.toString ();

Expand Down Expand Up @@ -126,7 +126,7 @@ void c_InputArtnet::Process ()

//-----------------------------------------------------------------------------
void c_InputArtnet::onDmxFrame (uint16_t CurrentUniverseId,
uint32_t length,
uint32_t length,
uint8_t SequenceNumber,
uint8_t * data,
IPAddress remoteIP)
Expand All @@ -143,9 +143,16 @@ void c_InputArtnet::onDmxFrame (uint16_t CurrentUniverseId,
// Do we need to update a sequnce error?
if (SequenceNumber != CurrentUniverse.SequenceNumber)
{
CurrentUniverse.SequenceErrorCounter++;
// DEBUG_V(String(" CurrentUniverseId: ") + String(CurrentUniverseId));
// DEBUG_V(String(" SequenceNumber: ") + String(SequenceNumber));
// DEBUG_V(String("CurrentUniverse.SequenceNumber: ") + String(CurrentUniverse.SequenceNumber));
CurrentUniverse.SequenceNumber = SequenceNumber;
++packet_errors;
// some systems always send a zero sequence number so we ignore the error in that case.
if(0 != SequenceNumber)
{
CurrentUniverse.SequenceErrorCounter++;
++packet_errors;
}
}

++CurrentUniverse.SequenceNumber;
Expand All @@ -158,11 +165,7 @@ void c_InputArtnet::onDmxFrame (uint16_t CurrentUniverseId,
OutputMgr.WriteChannelData( CurrentUniverse.DestinationOffset,
min(CurrentUniverse.BytesToCopy, length),
&data[CurrentUniverse.SourceDataOffset]);
/*
memcpy(CurrentUniverse.Destination,
&data[CurrentUniverse.SourceDataOffset],
min(CurrentUniverse.BytesToCopy, length));
*/

InputMgr.RestartBlankTimer (GetInputChannelId ());
}
else
Expand Down

0 comments on commit 76328af

Please sign in to comment.