From 02bbe9bc490fb987cd992f5aebce144a668958e7 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 5 Jan 2024 18:32:58 -0700 Subject: [PATCH] Actually implement OV9281/2311 things --- .../components/cameras/CameraSettingsCard.vue | 57 ++++++++++++++++++- .../stores/settings/CameraSettingsStore.ts | 3 +- photon-client/src/types/SettingTypes.ts | 32 ++++++++++- photon-client/src/types/WebsocketDataTypes.ts | 3 +- .../configuration/PhotonConfiguration.java | 2 + .../vision/camera/CameraQuirk.java | 8 +++ .../vision/camera/QuirkyCamera.java | 30 ++++++++-- .../vision/processes/VisionModule.java | 10 ++++ .../photonvision/server/RequestHandler.java | 19 ++++++- 9 files changed, 152 insertions(+), 12 deletions(-) diff --git a/photon-client/src/components/cameras/CameraSettingsCard.vue b/photon-client/src/components/cameras/CameraSettingsCard.vue index 844b6d3f66..0430984d40 100644 --- a/photon-client/src/components/cameras/CameraSettingsCard.vue +++ b/photon-client/src/components/cameras/CameraSettingsCard.vue @@ -3,13 +3,14 @@ import PvSelect from "@/components/common/pv-select.vue"; import PvNumberInput from "@/components/common/pv-number-input.vue"; import { useCameraSettingsStore } from "@/stores/settings/CameraSettingsStore"; import { useStateStore } from "@/stores/StateStore"; -import { ref, watchEffect } from "vue"; +import { computed, ref, watchEffect } from "vue"; +import { CameraSettings } from "@/types/SettingTypes"; const currentFov = ref(); const saveCameraSettings = () => { useCameraSettingsStore() - .updateCameraSettings({ fov: currentFov.value }, false) + .updateCameraSettings({ fov: currentFov.value, quirksToChange: quirksToChange.value }, false) .then((response) => { useCameraSettingsStore().currentCameraSettings.fov.value = currentFov.value; useStateStore().showSnackbarMessage({ @@ -41,6 +42,50 @@ const saveCameraSettings = () => { watchEffect(() => { currentFov.value = useCameraSettingsStore().currentCameraSettings.fov.value; }); + +const quirksToChange = ref({ + ArduOV9281: false, + ArduOV2311: false, +}) + +let arducams = ["N/A", "OV9281", "OV2311"] + +const arducamModel = computed({ + get() { + const quirks = useCameraSettingsStore().currentCameraSettings.cameraQuirks.quirks; + + if (quirks.ArduOV9281) { + return 1; + } else if (quirks.ArduOV2311) { + return 2; + } + return 0; + }, + set(value) { + console.log("hi") + console.log(value) + + if (value === 1) { + quirksToChange.value.ArduOV9281 = true; + quirksToChange.value.ArduOV2311 = false; + } else if (value === 2) { + quirksToChange.value.ArduOV9281 = false; + quirksToChange.value.ArduOV2311 = true; + } else { + quirksToChange.value.ArduOV9281 = false; + quirksToChange.value.ArduOV2311 = false; + } + } +}) + + +const isArducam = () => { + const settings = useCameraSettingsStore().currentCameraSettings; + // console.log("Is arducam?") + // console.log(settings.cameraQuirks.quirks.ArudcamCamera) + return settings.cameraQuirks.quirks.ArudcamCamera; +} +