Minimum step time (default=42ms)

This commit is contained in:
gac-iss
2025-10-23 10:10:28 +02:00
parent e3d34466ff
commit 915026c0be
3 changed files with 25 additions and 11 deletions

View File

@@ -28,6 +28,7 @@ public class Scienta extends AreaDetector {
final Stats[] stats;
final String channelCtrl;
int frameTime = 14;
int minStepTime = 42;
public Scienta(final String name, final String channelPrefix) {
this(name, channelPrefix + ":cam1", channelPrefix + ":image1");
@@ -130,7 +131,8 @@ public class Scienta extends AreaDetector {
public void onValueChanged(Device device, Object value, Object former) {
int time_ms = (int) (((Double) value) * 1000);
int num_frames = time_ms / getFrameTimeMs();
if (num_frames != frames.take()){
Integer cur = frames.take();
if ((cur==null) || (num_frames != cur)){
frames.writeAsync(num_frames);
}
}
@@ -139,9 +141,7 @@ public class Scienta extends AreaDetector {
public void onValueChanging(Device device, Object value, Object former) throws Exception {
//Value must be multiple of getFrameTimeMs()
int val_ms = (int) (((Double) value) * 1000);
if ((val_ms % getFrameTimeMs()) != 0){
throw new IOException("Value must be multiple of " + getFrameTimeMs() + "ms");
}
checkTimeValue(val_ms);
}
});
@@ -161,12 +161,30 @@ public class Scienta extends AreaDetector {
public int getFrameTimeMs() {
return frameTime;
}
}
public void setFrameTimeMs(int value) {
frameTime = value;
}
public int getMinStepTimeMs() {
return minStepTime;
}
public void setMinStepTimeMs(int value) {
minStepTime = value;
}
public void checkTimeValue(int val_ms) throws IOException{
if ((val_ms % getFrameTimeMs()) != 0){
throw new IOException("Value must be multiple of " + getFrameTimeMs() + "ms");
}
if (val_ms < getMinStepTimeMs()){
throw new IOException("Value must be equal or greater than " + getMinStepTimeMs() + "ms");
}
}
public class ScientaSpectrum extends ChannelDoubleArray implements ReadableCalibratedArray<double[]> {
ScientaSpectrum() {