From b0d319b209725f76aaf4ce5b71a6e49bc82d8806 Mon Sep 17 00:00:00 2001 From: gobbo_a Date: Fri, 9 Jun 2017 16:14:51 +0200 Subject: [PATCH] Startup --- devices/CurrentCamera.properties | 6 ++-- plugins/ScreenPanelDev.java | 56 ++++++++++++++++---------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index cec2c3d..5b71bc8 100644 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,7 +1,7 @@ -#Fri Jun 09 15:35:21 CEST 2017 +#Fri Jun 09 16:13:40 CEST 2017 colormap=Flame -colormapAutomatic=false -colormapMax=0.0 +colormapAutomatic=true +colormapMax=6000.0 colormapMin=0.0 flipHorizontally=false flipVertically=false diff --git a/plugins/ScreenPanelDev.java b/plugins/ScreenPanelDev.java index 4235ea8..a8afb67 100644 --- a/plugins/ScreenPanelDev.java +++ b/plugins/ScreenPanelDev.java @@ -600,12 +600,6 @@ public class ScreenPanelDev extends Panel { System.out.println("Setting camera: " + cameraName + " [" + (buttonCamtool.isSelected() ? "camtool" : "direct") + "]"); parseUserOverlays(); errorOverlay = null; - checkBackground.setEnabled(false); - spinnerThreshold.setVisible(false); - spinnerGrThreshold.setVisible(false); labelGrThreshold.setVisible(false); - spinnerGrScale.setVisible(false); labelGrScale.setVisible(false); - checkThreshold.setEnabled(false); - checkGoodRegion.setEnabled(false); if (dataTableDialog!=null){ dataTableDialog.dispose(); @@ -618,10 +612,10 @@ public class ScreenPanelDev extends Panel { calibrationDialolg = null; } - boolean was_camtool = false; + //boolean was_camtool = false; if (camera != null) { //camera.removeAllListeners(); - was_camtool = camera instanceof Camtool; + //was_camtool = camera instanceof Camtool; camera.close(); camera = null; } @@ -636,8 +630,16 @@ public class ScreenPanelDev extends Panel { boolean changed = !String.valueOf(cameraName).equals(this.cameraName); this.cameraName = cameraName; - + + if (changed || buttonDirect.isSelected()) { + spinnerThreshold.setVisible(false); + spinnerGrThreshold.setVisible(false); labelGrThreshold.setVisible(false); + spinnerGrScale.setVisible(false); labelGrScale.setVisible(false); + checkThreshold.setEnabled(false); + checkGoodRegion.setEnabled(false); + } if (changed) { + checkBackground.setEnabled(false); if ((devicesInitTask != null) && (devicesInitTask.isAlive())) { devicesInitTask.interrupt(); } @@ -676,27 +678,25 @@ public class ScreenPanelDev extends Panel { camera.assertInitialized(); System.out.println("Camera initialization OK"); if (camera instanceof Camtool) { - //Managing no background exception. Can be done in a better way? - checkBackground.setEnabled(true); - if (changed || !was_camtool) { - ((Camtool) camera).startPipeline(cameraName, null); + //Managing no background exception. Can be done in a better way? + //if (changed || !was_camtool) { + ((Camtool) camera).startPipeline(cameraName, null); + ((Camtool) camera).setBackgroundSubtraction(checkBackground.isSelected()); updateCamtoolControls(); - } else { - HashMap gr = null; - if (goodRegion){ - gr = new HashMap<>(); - gr.put("threshold", spinnerGrThreshold.getValue()); - gr.put("gfscale", spinnerGrScale.getValue()); - } - ((Camtool) camera).startPipeline(cameraName, null, checkBackground.isSelected(), null, checkThreshold.isSelected() ? (Double) spinnerThreshold.getValue() : null, gr); - } + //} else { + // HashMap gr = null; + // if (goodRegion){ + // gr = new HashMap<>(); + // gr.put("threshold", spinnerGrThreshold.getValue()); + // gr.put("gfscale", spinnerGrScale.getValue()); + // } + // ((Camtool) camera).startPipeline(cameraName, null, checkBackground.isSelected(), null, checkThreshold.isSelected() ? (Double) spinnerThreshold.getValue() : null, gr); + //} checkThreshold.setEnabled(true); checkGoodRegion.setEnabled(true); ((Camtool) camera).startReceiver(); - } else { - checkBackground.setEnabled(true); - checkBackground.setSelected(false); + } else { checkThreshold.setSelected(false); checkGoodRegion.setSelected(false); if (polling <= 0) { @@ -773,7 +773,7 @@ public class ScreenPanelDev extends Panel { onTimer(); } onChangeColormap(null); - + checkBackground.setEnabled(true); if (changed) { comboScreen.setModel(new DefaultComboBoxModel()); comboFilter.setModel(new DefaultComboBoxModel()); @@ -913,8 +913,7 @@ public class ScreenPanelDev extends Panel { void updateCamtoolControls() { if ((camera != null) && (camera instanceof Camtool)) { updatingCamtoolControls = true; - try { - checkBackground.setSelected(((Camtool) camera).getBackgroundSubtraction()); + try { Double threshold = ((Camtool) camera).getThreshold(); checkThreshold.setSelected(threshold != null); spinnerThreshold.setValue((threshold == null) ? 0 : threshold); @@ -924,6 +923,7 @@ public class ScreenPanelDev extends Panel { spinnerGrThreshold.setValue(gr.get("threshold")); spinnerGrScale.setValue(gr.get("gfscale")); } + checkBackground.setSelected(((Camtool) camera).getBackgroundSubtraction()); } catch (Exception ex) { } goodRegion = checkGoodRegion.isSelected();