mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Update camera path if matched camera path doesn't match saved path
Improves stability when cameras change USB ports.
This commit is contained in:
@@ -217,7 +217,7 @@ public class VisionSourceManager {
|
||||
if (cameraInfo != null) {
|
||||
logger.debug("Matched the config for " + config.baseName + " to a physical camera!");
|
||||
detectedCameraList.remove(cameraInfo);
|
||||
cameraConfigurations.add(config);
|
||||
cameraConfigurations.add(mergeInfoIntoConfig(config, cameraInfo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,6 +246,15 @@ public class VisionSourceManager {
|
||||
return cameraConfigurations;
|
||||
}
|
||||
|
||||
private CameraConfiguration mergeInfoIntoConfig(CameraConfiguration cfg, UsbCameraInfo info) {
|
||||
if (!cfg.path.equals(info.path)) {
|
||||
logger.debug("Updating path config from " + cfg.path + " to " + info.path);
|
||||
cfg.path = info.path;
|
||||
}
|
||||
|
||||
return cfg;
|
||||
}
|
||||
|
||||
private List<VisionSource> loadVisionSourcesFromCamConfigs(List<CameraConfiguration> camConfigs) {
|
||||
List<VisionSource> usbCameraSources = new ArrayList<>();
|
||||
camConfigs.forEach(configuration -> usbCameraSources.add(new USBCameraSource(configuration)));
|
||||
|
||||
Reference in New Issue
Block a user