package QuickVerifyCrap; import java.io.FileNotFoundException; import java.io.RandomAccessFile; import java.math.BigInteger; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; public class Logic2PWMMassageliege { static final int REFRATE = 500_000_000; static final int SAMPLELENGTH=REFRATE/32_000;//500MS samplerate/32KHz static final int SAMPLELENGTH_BUFFERED= (int) (SAMPLELENGTH*1.1);//500MS samplerate/32KHz public static void main(String[] args) throws Exception { long[] edges_ch1 = null; long[] edges_ch2 = null; String basepath = "/home/tgoerner/loa/000034/export/"; RandomAccessFile ch1 = new RandomAccessFile(basepath+"digital_0.bin","r"); RandomAccessFile ch2 = new RandomAccessFile(basepath+"digital_1.bin","r"); ch1.readLong(); //magic LMAA ch1.readInt(); ch1.readInt(); boolean initialHigh1 = (ch1.readInt()!=0); ch1.readDouble(); ch1.readDouble(); int countEdges1 = (int) Long.reverseBytes(ch1.readLong()); if(initialHigh1) { countEdges1++; } int writeptr = 0; edges_ch1 = new long[countEdges1+1]; if(initialHigh1) { edges_ch1[0]=-1; writeptr++; } while(writeptr> lst= new LinkedList<>(); List samples = new LinkedList<>(); int c1 = 1; //zeit zur ersten flanke weg, die ist bullshit.exe da zeit vor erster messung int c2 = 1; while(c1SAMPLELENGTH_BUFFERED)&&(edges_ch2[c2+1]>SAMPLELENGTH_BUFFERED)) { cutoff=true; } if(c1SAMPLELENGTH_BUFFERED) { samplesize=SAMPLELENGTH; } short sample = (short)((edges_ch1[c1]*32768)/samplesize); samples.add(sample); c1+=2; } else if(c2SAMPLELENGTH_BUFFERED) { samplesize=SAMPLELENGTH; } short sample = (short)(((edges_ch2[c2]*32768)/samplesize)*-1); samples.add(sample); c2+=2; } else { System.out.println("ZÖINKS"); c1=edges_ch1.length; c2=edges_ch2.length; } if(cutoff) { lst.add(samples); samples = new LinkedList<>(); } } for(int i=0;i file = lst.get(i); for(int j=0;j