Skip to content

Commit 8fc8193

Browse files
committed
Fix send only to ports whichg are configured as inputs into the Art-Net system
1 parent 5158dd1 commit 8fc8193

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

ArtNetSharp/Communication/AbstractInstance.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -625,12 +625,16 @@ private async Task sendAllArtDMX()
625625
try
626626
{
627627
bag.LastSended = utcNow;
628-
config = portConfigs?.FirstOrDefault(pc => PortAddress.Equals(pc.PortAddress, port.OutputPortAddress));
628+
// Send only to ports which are inputs into ArtNet
629+
config = portConfigs?.Where(cfg => cfg.Input)
630+
.FirstOrDefault(pc => PortAddress.Equals(pc.PortAddress, port.OutputPortAddress));
631+
632+
if (config == null)
633+
continue;
634+
629635
sourcePort = config?.PortNumber ?? 0;
630636
sendTasks.Add(sendArtDMX(port, sourcePort, bag.Data, bag.GetSequence(), config?.ForceBroadcast ?? false));
631637
sended++;
632-
if (config == null)
633-
continue;
634638
}
635639
catch (Exception e)
636640
{
@@ -647,13 +651,16 @@ private async Task sendAllArtDMX()
647651
bag.LastSended = DateTime.UtcNow;
648652
}
649653
}
650-
catch (Exception e) { Logger.LogError(e, "Outer Block"); }
654+
catch (Exception e)
655+
{
656+
Logger.LogError(e, "Outer Block");
657+
}
651658

652659
await Task.WhenAll(sendTasks);
653660
sendTasks.Clear();
661+
654662
if (EnableSync && sended != 0)
655663
await sendArtSync();
656-
657664
}
658665
catch (Exception ex) { Logger.LogError(ex); }
659666
}

0 commit comments

Comments
 (0)