mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
Merge 9d0020d999 into 6b7c5c01f8
This commit is contained in:
@@ -123,25 +123,34 @@ namespace PepperDash.Essentials.Core
|
|||||||
// No direct tie? Run back out on the inputs' attached devices...
|
// No direct tie? Run back out on the inputs' attached devices...
|
||||||
// Only the ones that are routing devices
|
// Only the ones that are routing devices
|
||||||
var attachedMidpoints = destDevInputTies.Where(t => t.SourcePort.ParentDevice is IRoutingInputsOutputs);
|
var attachedMidpoints = destDevInputTies.Where(t => t.SourcePort.ParentDevice is IRoutingInputsOutputs);
|
||||||
|
|
||||||
|
//Create a list for tracking already checked devices to avoid loops, if it doesn't already exist from previous iteration
|
||||||
|
if (alreadyCheckedDevices == null)
|
||||||
|
alreadyCheckedDevices = new List<IRoutingInputsOutputs>();
|
||||||
|
alreadyCheckedDevices.Add(destination as IRoutingInputsOutputs);
|
||||||
|
|
||||||
foreach (var inputTieToTry in attachedMidpoints)
|
foreach (var inputTieToTry in attachedMidpoints)
|
||||||
{
|
{
|
||||||
Debug.Console(2, destination, "Trying to find route on {0}", inputTieToTry.SourcePort.ParentDevice.Key);
|
|
||||||
var upstreamDeviceOutputPort = inputTieToTry.SourcePort;
|
var upstreamDeviceOutputPort = inputTieToTry.SourcePort;
|
||||||
var upstreamRoutingDevice = upstreamDeviceOutputPort.ParentDevice as IRoutingInputsOutputs;
|
var upstreamRoutingDevice = upstreamDeviceOutputPort.ParentDevice as IRoutingInputsOutputs;
|
||||||
|
Debug.Console(2, destination, "Trying to find route on {0}", upstreamRoutingDevice.Key);
|
||||||
|
|
||||||
// Check if this previous device has already been walked
|
// Check if this previous device has already been walked
|
||||||
if (!(alreadyCheckedDevices != null && alreadyCheckedDevices.Contains(upstreamRoutingDevice)))
|
if (alreadyCheckedDevices.Contains(upstreamRoutingDevice))
|
||||||
{
|
{
|
||||||
// haven't seen this device yet. Do it. Pass the output port to the next
|
Debug.Console(2, destination, "Skipping input {0} on {1}, this was already checked", upstreamRoutingDevice.Key, destination.Key);
|
||||||
// level to enable switching on success
|
continue;
|
||||||
var upstreamRoutingSuccess = upstreamRoutingDevice.GetRouteToSource(source, upstreamDeviceOutputPort,
|
}
|
||||||
alreadyCheckedDevices, signalType, cycle, routeTable);
|
// haven't seen this device yet. Do it. Pass the output port to the next
|
||||||
if (upstreamRoutingSuccess)
|
// level to enable switching on success
|
||||||
{
|
var upstreamRoutingSuccess = upstreamRoutingDevice.GetRouteToSource(source, upstreamDeviceOutputPort,
|
||||||
Debug.Console(2, destination, "Upstream device route found");
|
alreadyCheckedDevices, signalType, cycle, routeTable);
|
||||||
goodInputPort = inputTieToTry.DestinationPort;
|
if (upstreamRoutingSuccess)
|
||||||
break; // Stop looping the inputs in this cycle
|
{
|
||||||
}
|
Debug.Console(2, destination, "Upstream device route found");
|
||||||
}
|
goodInputPort = inputTieToTry.DestinationPort;
|
||||||
|
break; // Stop looping the inputs in this cycle
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,10 +172,6 @@ namespace PepperDash.Essentials.Core
|
|||||||
//Debug.Console(2, destination, "Exiting cycle {0}", cycle);
|
//Debug.Console(2, destination, "Exiting cycle {0}", cycle);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(alreadyCheckedDevices == null)
|
|
||||||
alreadyCheckedDevices = new List<IRoutingInputsOutputs>();
|
|
||||||
alreadyCheckedDevices.Add(destination as IRoutingInputsOutputs);
|
|
||||||
|
|
||||||
Debug.Console(2, destination, "No route found to {0}", source.Key);
|
Debug.Console(2, destination, "No route found to {0}", source.Key);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user