diff --git a/src/main/java/Scienta.java b/src/main/java/Scienta.java index c5a36b6..b0c30a4 100644 --- a/src/main/java/Scienta.java +++ b/src/main/java/Scienta.java @@ -27,6 +27,7 @@ public class Scienta extends AreaDetector { final ChannelDouble acquisitionTime; final Stats[] stats; final String channelCtrl; + int frameTime = 14; public Scienta(final String name, final String channelPrefix) { this(name, channelPrefix + ":cam1", channelPrefix + ":image1"); @@ -128,7 +129,7 @@ public class Scienta extends AreaDetector { @Override public void onValueChanged(Device device, Object value, Object former) { int time_ms = (int) (((Double) value) * 1000); - Integer num_frames = time_ms / 40; + int num_frames = time_ms / getFrameTimeMs(); if (num_frames != frames.take()){ frames.writeAsync(num_frames); } @@ -136,10 +137,10 @@ public class Scienta extends AreaDetector { @Override public void onValueChanging(Device device, Object value, Object former) throws Exception { - //Value must be multiple of 40ms + //Value must be multiple of getFrameTimeMs() int val_ms = (int) (((Double) value) * 1000); - if ((val_ms % 40) != 0){ - throw new IOException("Value must be multiple of 40ms"); + if ((val_ms % getFrameTimeMs()) != 0){ + throw new IOException("Value must be multiple of " + getFrameTimeMs() + "ms"); } } }); @@ -148,7 +149,7 @@ public class Scienta extends AreaDetector { @Override public void onValueChanged(Device device, Object value, Object former) { int num_frames = (Integer)value; - int time_ms = num_frames * 40; + int time_ms = num_frames * getFrameTimeMs(); Double time = ((double)time_ms) / 1000.0; if (time != stepTime.take()){ stepTime.writeAsync(time); @@ -157,6 +158,14 @@ public class Scienta extends AreaDetector { } }); } + + public int getFrameTimeMs() { + return frameTime; + } + + public void setFrameTimeMs(int value) { + frameTime = value; + } public class ScientaSpectrum extends ChannelDoubleArray implements ReadableCalibratedArray { diff --git a/src/main/java/ScientaPanel.form b/src/main/java/ScientaPanel.form index 48e1f67..3c25798 100644 --- a/src/main/java/ScientaPanel.form +++ b/src/main/java/ScientaPanel.form @@ -638,7 +638,7 @@ - + diff --git a/src/main/java/ScientaPanel.java b/src/main/java/ScientaPanel.java index 5285c09..05f6a12 100644 --- a/src/main/java/ScientaPanel.java +++ b/src/main/java/ScientaPanel.java @@ -20,7 +20,7 @@ import ch.psi.pshell.swing.*; */ public final class ScientaPanel extends DevicePanel { - LinePlotSeries spectrumSeries; + LinePlotSeries spectrumSeries; public ScientaPanel() { initComponents(); @@ -44,8 +44,8 @@ public final class ScientaPanel extends DevicePanel { getDevice().getHighEnergy().writeAsync(value); } else if (origin == valueTime) { int val_ms = (int) (((Double) value) * 1000); - if ((val_ms % 40) != 0){ - throw new IOException("Value must be multiple of 40ms"); + if ((val_ms % getDevice().getFrameTimeMs()) != 0){ + throw new IOException("Value must be multiple of " + getDevice().getFrameTimeMs() + "ms"); } getDevice().getStepTime().writeAsync(value); } else if (origin == valueSize) { @@ -97,7 +97,7 @@ public final class ScientaPanel extends DevicePanel { public void setShowSpectrum(boolean value) { plotSpectrum.setVisible(value); } - + @Override public Scienta getDevice() { return (Scienta) super.getDevice(); @@ -632,7 +632,7 @@ public final class ScientaPanel extends DevicePanel { jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel8.setText("Time:"); - valueTime.setDecimals(2); + valueTime.setDecimals(3); valueTime.setMaxValue(1000.0); valueTime.setMinValue(0.0); valueTime.setName("scienta.stepTime"); // NOI18N diff --git a/src/main/java/ScientaParametersPanel.form b/src/main/java/ScientaParametersPanel.form index 823065a..97ae2d3 100644 --- a/src/main/java/ScientaParametersPanel.form +++ b/src/main/java/ScientaParametersPanel.form @@ -289,7 +289,7 @@ - + diff --git a/src/main/java/ScientaParametersPanel.java b/src/main/java/ScientaParametersPanel.java index 2516ab4..1d087cd 100644 --- a/src/main/java/ScientaParametersPanel.java +++ b/src/main/java/ScientaParametersPanel.java @@ -38,8 +38,8 @@ public final class ScientaParametersPanel extends DevicePanel { if (editing) { try{ int val_ms = (int) (((Double) value) * 1000); - if ((val_ms % 40) != 0){ - throw new IOException("Value must be multiple of 40ms"); + if ((val_ms % getDevice().getFrameTimeMs()) != 0){ + throw new IOException("Value must be multiple of " + getDevice().getFrameTimeMs() + "ms"); } } catch (Exception ex) { showException(ex);