Configurable frame time (default=14ms)
This commit is contained in:
@@ -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<double[]> {
|
||||
|
||||
|
||||
@@ -638,7 +638,7 @@
|
||||
</Component>
|
||||
<Component class="ch.psi.pshell.swing.ValueSelection" name="valueTime">
|
||||
<Properties>
|
||||
<Property name="decimals" type="int" value="2"/>
|
||||
<Property name="decimals" type="int" value="3"/>
|
||||
<Property name="maxValue" type="double" value="1000.0"/>
|
||||
<Property name="minValue" type="double" value="0.0"/>
|
||||
<Property name="name" type="java.lang.String" value="scienta.stepTime" noResource="true"/>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -289,7 +289,7 @@
|
||||
<Component id="jLabel14" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="valueHigh" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="43" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="45" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user