From 3530b227786851947f08e79396b353d6796e415e Mon Sep 17 00:00:00 2001 From: "Cameron (3539)" Date: Thu, 31 Oct 2024 22:36:06 -0400 Subject: [PATCH 1/2] Update GenericUSBCameraSettables.java --- .../vision/camera/USBCameras/GenericUSBCameraSettables.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java index 818b567df3..8bbd685a8b 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java @@ -186,7 +186,7 @@ public void setGain(int gain) { @Override public VideoMode getCurrentVideoMode() { - return camera.isConnected() ? camera.getVideoMode() : null; + return camera.getVideoMode(); // This returns the current video mode even if the camera is disconnected } @Override @@ -196,7 +196,8 @@ public void setVideoModeInternal(VideoMode videoMode) { logger.error("Got a null video mode! Doing nothing..."); return; } - camera.setVideoMode(videoMode); + if(camera.setVideoMode(videoMode)) + logger.debug("Failed to set video mode!"); } catch (Exception e) { logger.error("Failed to set video mode!", e); } From e66a3b7de87fae9f8f1c115e14d104ebcb0a9940 Mon Sep 17 00:00:00 2001 From: "Cameron (3539)" Date: Thu, 31 Oct 2024 22:42:03 -0400 Subject: [PATCH 2/2] lint and format --- .../vision/camera/USBCameras/GenericUSBCameraSettables.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java index 8bbd685a8b..af4de588f3 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameras/GenericUSBCameraSettables.java @@ -186,7 +186,8 @@ public void setGain(int gain) { @Override public VideoMode getCurrentVideoMode() { - return camera.getVideoMode(); // This returns the current video mode even if the camera is disconnected + return camera + .getVideoMode(); // This returns the current video mode even if the camera is disconnected } @Override @@ -196,8 +197,7 @@ public void setVideoModeInternal(VideoMode videoMode) { logger.error("Got a null video mode! Doing nothing..."); return; } - if(camera.setVideoMode(videoMode)) - logger.debug("Failed to set video mode!"); + if (camera.setVideoMode(videoMode)) logger.debug("Failed to set video mode!"); } catch (Exception e) { logger.error("Failed to set video mode!", e); }