mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-03 03:01:40 +00:00
Fix windows NPEs around exposure+klogs (#1529)
This commit is contained in:
@@ -65,6 +65,10 @@ public class KernelLogLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void outputNewPrintks() {
|
public void outputNewPrintks() {
|
||||||
|
if (listener == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (var msg : listener.getNewlines()) {
|
for (var msg : listener.getNewlines()) {
|
||||||
// We currently set all logs to debug regardless of their actual level
|
// We currently set all logs to debug regardless of their actual level
|
||||||
logger.log(msg, LogLevel.DEBUG);
|
logger.log(msg, LogLevel.DEBUG);
|
||||||
|
|||||||
@@ -96,9 +96,12 @@ public class GenericUSBCameraSettables extends VisionSourceSettables {
|
|||||||
var autoExpProp = findProperty("exposure_auto", "auto_exposure");
|
var autoExpProp = findProperty("exposure_auto", "auto_exposure");
|
||||||
|
|
||||||
exposureAbsProp = expProp.get();
|
exposureAbsProp = expProp.get();
|
||||||
autoExposureProp = autoExpProp.get();
|
|
||||||
this.minExposure = exposureAbsProp.getMin();
|
this.minExposure = exposureAbsProp.getMin();
|
||||||
this.maxExposure = exposureAbsProp.getMax();
|
this.maxExposure = exposureAbsProp.getMax();
|
||||||
|
|
||||||
|
if (autoExpProp.isPresent()) {
|
||||||
|
autoExposureProp = autoExpProp.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAllCamDefaults() {
|
public void setAllCamDefaults() {
|
||||||
@@ -169,7 +172,7 @@ public class GenericUSBCameraSettables extends VisionSourceSettables {
|
|||||||
softSet("auto_exposure_bias", 0);
|
softSet("auto_exposure_bias", 0);
|
||||||
softSet("iso_sensitivity_auto", 0); // Disable auto ISO adjustment
|
softSet("iso_sensitivity_auto", 0); // Disable auto ISO adjustment
|
||||||
softSet("iso_sensitivity", 0); // Manual ISO adjustment
|
softSet("iso_sensitivity", 0); // Manual ISO adjustment
|
||||||
autoExposureProp.set(PROP_AUTO_EXPOSURE_DISABLED);
|
if (autoExposureProp != null) autoExposureProp.set(PROP_AUTO_EXPOSURE_DISABLED);
|
||||||
|
|
||||||
// Most cameras leave exposure time absolute at the last value from their AE
|
// Most cameras leave exposure time absolute at the last value from their AE
|
||||||
// algorithm.
|
// algorithm.
|
||||||
@@ -199,7 +202,7 @@ public class GenericUSBCameraSettables extends VisionSourceSettables {
|
|||||||
public void setExposureRaw(double exposureRaw) {
|
public void setExposureRaw(double exposureRaw) {
|
||||||
if (exposureRaw >= 0.0) {
|
if (exposureRaw >= 0.0) {
|
||||||
try {
|
try {
|
||||||
autoExposureProp.set(PROP_AUTO_EXPOSURE_DISABLED);
|
if (autoExposureProp != null) autoExposureProp.set(PROP_AUTO_EXPOSURE_DISABLED);
|
||||||
|
|
||||||
int propVal = (int) MathUtil.clamp(exposureRaw, minExposure, maxExposure);
|
int propVal = (int) MathUtil.clamp(exposureRaw, minExposure, maxExposure);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user