From 5136dad535381f49b6cf2164b63503688a73eb8f Mon Sep 17 00:00:00 2001 From: superpenguin612 <74030080+superpenguin612@users.noreply.github.com> Date: Thu, 2 Nov 2023 22:36:24 -0400 Subject: [PATCH] Add StickyFPS quirk for Arducam OV2311 (#994) Disable setting first video mode on boot. Resolution is actually set immediately after --- .../main/java/org/photonvision/vision/camera/CameraQuirk.java | 2 ++ .../main/java/org/photonvision/vision/camera/QuirkyCamera.java | 3 ++- .../java/org/photonvision/vision/camera/USBCameraSource.java | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/CameraQuirk.java b/photon-core/src/main/java/org/photonvision/vision/camera/CameraQuirk.java index 69f9c564cb..928aa6f847 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/CameraQuirk.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/CameraQuirk.java @@ -30,4 +30,6 @@ public enum CameraQuirk { CompletelyBroken, /** Has adjustable focus and autofocus switch */ AdjustableFocus, + /** Changing FPS repeatedly with small delay does not work correctly */ + StickyFPS, } diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java b/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java index da2dc835cb..53d89167ec 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/QuirkyCamera.java @@ -44,7 +44,8 @@ public class QuirkyCamera { new QuirkyCamera( -1, -1, "mmal service 16.1", CameraQuirk.PiCam), // PiCam (via V4L2, not zerocopy) new QuirkyCamera(-1, -1, "unicam", CameraQuirk.PiCam), // PiCam (via V4L2, not zerocopy) - new QuirkyCamera(0x85B, 0x46D, CameraQuirk.AdjustableFocus) // Logitech C925-e + new QuirkyCamera(0x85B, 0x46D, CameraQuirk.AdjustableFocus), // Logitech C925-e + new QuirkyCamera(0x6366, 0x0c45, CameraQuirk.StickyFPS) // Arducam OV2311 ); public static final QuirkyCamera DefaultCamera = new QuirkyCamera(0, 0, ""); diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java index ad235da26a..6717f4edd8 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java @@ -102,7 +102,8 @@ public class USBCameraSettables extends VisionSourceSettables { protected USBCameraSettables(CameraConfiguration configuration) { super(configuration); getAllVideoModes(); - setVideoMode(videoModes.get(0)); + if (!cameraQuirks.hasQuirk(CameraQuirk.StickyFPS)) + setVideoMode(videoModes.get(0)); // fixes double FPS set } public void setAutoExposure(boolean cameraAutoExposure) {