mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-28 02:11:40 +00:00
Check for exposure setting validity before accessing. (#1618)
If the exposure property for the generic USB camera settable was not valid for one camera in the list, then the thread would crash/hang and no cameras would show up in the list
This commit is contained in:
@@ -95,9 +95,11 @@ public class GenericUSBCameraSettables extends VisionSourceSettables {
|
||||
// first.
|
||||
var autoExpProp = findProperty("exposure_auto", "auto_exposure");
|
||||
|
||||
exposureAbsProp = expProp.get();
|
||||
this.minExposure = exposureAbsProp.getMin();
|
||||
this.maxExposure = exposureAbsProp.getMax();
|
||||
if (expProp.isPresent()) {
|
||||
exposureAbsProp = expProp.get();
|
||||
this.minExposure = exposureAbsProp.getMin();
|
||||
this.maxExposure = exposureAbsProp.getMax();
|
||||
}
|
||||
|
||||
if (autoExpProp.isPresent()) {
|
||||
autoExposureProp = autoExpProp.get();
|
||||
@@ -184,7 +186,7 @@ public class GenericUSBCameraSettables extends VisionSourceSettables {
|
||||
softSet("auto_exposure_bias", 12);
|
||||
softSet("iso_sensitivity_auto", 1);
|
||||
softSet("iso_sensitivity", 1); // Manual ISO adjustment by default
|
||||
autoExposureProp.set(PROP_AUTO_EXPOSURE_ENABLED);
|
||||
if (autoExposureProp != null) autoExposureProp.set(PROP_AUTO_EXPOSURE_ENABLED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user