From 82f4344735b5f82ff35b1ac74b9ac1486ae29664 Mon Sep 17 00:00:00 2001 From: BytingBulldogs3539 Date: Wed, 15 Nov 2023 21:51:24 -0500 Subject: [PATCH] Fix comment format, fix bug when a csi camera is not the first camera loaded or the only csi camera. --- .../vision/processes/VisionSourceManager.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java b/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java index c7178744ef..4ee25354d2 100644 --- a/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java +++ b/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java @@ -302,18 +302,20 @@ private List filterAllowedDevices(List allDevices) List paths = new ArrayList<>(); - - // Use the other paths to filter out devices that share the same path other than the index select only the lowest index. - // A ov5647 on a raspi 5 would show another path as platform-1000880000.pisp_be-video-index0, platform-1000880000.pisp_be-video-index4, and platform-1000880000.pisp_be-video-index5. - // This code will remove "indexX" from all the other paths from all the devices and make sure that we only take one camera stream from each device the stream with the lowest index. + // Use the other paths to filter out devices that share the same path other than the index + // select only the lowest index. + // A ov5647 on a raspi 5 would show another path as platform-1000880000.pisp_be-video-index0, + // platform-1000880000.pisp_be-video-index4, and platform-1000880000.pisp_be-video-index5. + // This code will remove "indexX" from all the other paths from all the devices and make sure + // that we only take one camera stream from each device the stream with the lowest index. for (String p : device.otherPaths) { - paths.add(p.replace("index" + device.dev, "")); + paths.add(p.split("index")[0]); } boolean skip = false; for (var otherDevice : filteredDevices) { List otherPaths = new ArrayList<>(); for (String p : otherDevice.otherPaths) { - otherPaths.add(p.replace("index" + otherDevice.dev, "")); + otherPaths.add(p.split("index")[0]); } if (paths.containsAll(otherPaths)) { if (otherDevice.dev >= device.dev) {