diff --git a/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqMain.java b/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqMain.java index d6a5d98..9695b58 100644 --- a/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqMain.java +++ b/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqMain.java @@ -42,6 +42,11 @@ public class FdaqMain { File file = new File(args[0]); + if(file.exists()){ + System.err.println("File "+file.getName()+ " already exists."); + System.exit(-1); + } + FdaqConfiguration configuration = new FdaqConfiguration(); String config = System.getProperty(FDAQ_CONFIG); @@ -65,7 +70,7 @@ public class FdaqMain { } }); - SerializerTXT serializer = new SerializerTXT(file); + SerializerTXT serializer = new SerializerTXT(file, false); serializer.setShowDimensionHeader(false); bus.register(serializer); diff --git a/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqService.java b/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqService.java index b60897f..141697a 100644 --- a/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqService.java +++ b/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqService.java @@ -84,7 +84,7 @@ public class FdaqService { bytebuffer.order(ByteOrder.LITTLE_ENDIAN); bytebuffer.putInt(26); // Function number (index of pointer to function) bytebuffer.putInt(numberOfElements); - // TODO + if(first){ bytebuffer.putInt(1); // Reset FIFO flag - The first time there need to be a 1 in int to reset the fifo buffer on the box first=false; @@ -117,6 +117,13 @@ public class FdaqService { logger.info("End of Stream"); break; } + + if(t<1028){ + // The first 1028 are wrong (not really wrong but there are repeated values/holes) + // It has to do with the fact that we asynchronously reset the FIFO. + // This is independent of the frequency + continue; + } int a = buffer.getInt(); int b = buffer.getInt();