From 14ed7ce7a4d303c405933df3bb3021015c09eb57 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 4 Dec 2020 19:38:23 -0800 Subject: [PATCH] Ensure stream divisor respects pipeline changes (#163) Ensure stream divisor respects pipeline changes. Previously this was only set on UI commands and on construction. --- .../common/configuration/StreamDivisor.java | 31 ------------------- .../vision/processes/VisionModule.java | 6 ++++ 2 files changed, 6 insertions(+), 31 deletions(-) delete mode 100644 photon-server/src/main/java/org/photonvision/common/configuration/StreamDivisor.java diff --git a/photon-server/src/main/java/org/photonvision/common/configuration/StreamDivisor.java b/photon-server/src/main/java/org/photonvision/common/configuration/StreamDivisor.java deleted file mode 100644 index e47ad133c..000000000 --- a/photon-server/src/main/java/org/photonvision/common/configuration/StreamDivisor.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2020 Photon Vision. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.photonvision.common.configuration; - -public enum StreamDivisor { - NONE(1), - HALF(2), - QUARTER(4), - SIXTH(6); - - public final Integer value; - - StreamDivisor(int value) { - this.value = value; - } -} diff --git a/photon-server/src/main/java/org/photonvision/vision/processes/VisionModule.java b/photon-server/src/main/java/org/photonvision/vision/processes/VisionModule.java index c8f5da539..0ae6193a1 100644 --- a/photon-server/src/main/java/org/photonvision/vision/processes/VisionModule.java +++ b/photon-server/src/main/java/org/photonvision/vision/processes/VisionModule.java @@ -261,6 +261,12 @@ public class VisionModule { visionSource.getSettables().setBrightness(config.cameraBrightness); visionSource.getSettables().setExposure(config.cameraExposure); + // Also set new frame divisor + dashboardInputStreamer.setFrameDivisor( + pipelineManager.getCurrentPipelineSettings().streamingFrameDivisor); + dashboardOutputStreamer.setFrameDivisor( + pipelineManager.getCurrentPipelineSettings().streamingFrameDivisor); + if (!cameraQuirks.hasQuirk(CameraQuirk.Gain)) { config.cameraGain = -1; } else {