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[]> {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user