unsigned mySensor = getSensor(sensorId);
ix += 2; //Skip time
-#if DEBUG>=1
+ #if DEBUG>=1
printf("Head\t%08x\tID\t%08x\tStatus\t%08x\tError\t%08x\tDebug\t%08x\n",
sensorHead, sensorId, sensorStatus, sensorError, sensorDebug);
-#endif
+ #endif
if(sensorHead != 0xffffffff) {
//Something is really wrong with data. Skip SubEvent!
printf("Broken Sensor Header\n");
statistics[mySensor][FRREALBROKEN]++;
-#if DEBUG!=1
- printf("Head\t%08x\tID\t%08x\tStatus\t%08x\tError\t%08x\tDebug\t%08x\n",
- sensorHead, sensorId, sensorStatus, sensorError, sensorDebug);
-#endif
+ #if DEBUG!=1
+ printf("Head\t%08x\tID\t%08x\tStatus\t%08x\tError\t%08x\tDebug\t%08x\n",
+ sensorHead, sensorId, sensorStatus, sensorError, sensorDebug);
+ #endif
return -1;
}
unsigned frameEndPos = ix + sensorLength;
unsigned d,line = 0,column,pixels,statecnt = 0,ovf = 0;
-#if DEBUG>=1
- printf("\t\t\tHeader\t%08x\tFrame\t%08x\tLength\t%i\n",
+ #if DEBUG>=1
+ printf("\t\t\tHeader\t%08x\tFrame\t%08x\tLength\t%i\n",
sensorDummy, sensorNumber, sensorLength);
-#endif
+ #endif
if(sensorLength == 0) {
goto FrameEnd;
}
else {
pixels = (d & 0x3);
column = (d >> 2) & 0x7FF;
-#if DEBUG>1
+ #if DEBUG>1
printf("\t%d, %d x %d\n",line,column,pixels+1);
-#endif
+ #endif
pixelcount[mySensor][column] += pixels+1;
pixelMap[mySensor][line][column]++;
if (pixels > 1) {
pixelMap[mySensor][line][column+2]++;
if (pixels > 2) {
- pixelMap[mySensor][line][column]++;
+ pixelMap[mySensor][line][column+3]++;
}
}
}
FILE* cvt;
int status;
cvt = popen("gnuplot", "w");
- fprintf(cvt, "set terminal png size 800,400 font \",9\";\n");
- fprintf(cvt, "set palette model RGB;\n");
- fprintf(cvt, "set xrange [0:1152];\n");
- fprintf(cvt, "set yrange [0:576];\n");
- fprintf(cvt, "set cbrange [0:%i];\n",statistics[i][FRVALID]);
- fprintf(cvt, "set palette defined ( 0 'white', 1 'red', 5 'black', 10 'blue', %i 'green');\n",statistics[i][FRVALID]);
+ if (!cvt) {
+ printf("couldn't open a pipe; quitting\n");
+ exit(1);
+ }
+ fprintf(cvt, "set terminal png size 800,400 font \",9\";\n");
+ fprintf(cvt, "set palette model RGB;\n");
+ fprintf(cvt, "set xrange [0:1152];\n");
+ fprintf(cvt, "set yrange [0:576];\n");
+ fprintf(cvt, "set cbrange [0:%i];\n",statistics[i][FRVALID]);
+ fprintf(cvt, "set palette defined ( 0 'white', 1 'red', 5 'black', 10 'blue', %i 'green');\n",statistics[i][FRVALID]);
- time_t rawtime;
- struct tm * timeinfo;
- time (&rawtime);
- timeinfo = localtime (&rawtime);
- char ts[200];
- strftime (ts,200,"set label 100 \"%H:%M:%S\" at screen 0.98,0.02 right tc rgb \"#000044\" font \"monospace,8\"\n",timeinfo);
- fprintf(cvt,ts);
+ time_t rawtime;
+ struct tm * timeinfo;
+ time (&rawtime);
+ timeinfo = localtime (&rawtime);
+ char ts[200];
+ strftime (ts,200,"set label 100 \"%H:%M:%S\" at screen 0.98,0.02 right tc rgb \"#000044\" font \"monospace,8\"\n",timeinfo);
+ fprintf(cvt,ts);
- fprintf(cvt, "set label 101 \"%i States, %i good, %i broken, %i invalid\" at screen 0.02,0.01 left tc rgb \"#000044\" font \"monospace,8\"\n",
- hitcount[i],
- statistics[i][FRVALID],
- statistics[i][FRBROKEN],
- statistics[i][FRREALBROKEN]);
+ fprintf(cvt, "set label 101 \"%i States, %i good, %i broken, %i invalid\" at screen 0.02,0.01 left tc rgb \"#000044\" font \"monospace,8\"\n",
+ hitcount[i],
+ statistics[i][FRVALID],
+ statistics[i][FRBROKEN],
+ statistics[i][FRREALBROKEN]);
- fprintf(cvt, "set label 102 \"hit rates: A: %.3e B: %.3e C: %.3e D:%.3e\" at screen 0.4,0.01 left tc rgb \"#000044\" font \"monospace,8\"\n",
- hitrates[0],
- hitrates[1],
- hitrates[2],
- hitrates[3]);
- fprintf(cvt, "set output '%s/%s_%08x.png';\n",picPath,mySystem,sensors[i]);
- fprintf(cvt, "plot '-' matrix with image\n");
-
- for(unsigned r = 0; r < 576; r++) {
- for(unsigned c = 0; c < 1152; c++) {
- fprintf(cvt,"%i ",pixelMap[i][r][c]);
- }
- fprintf(cvt,"\n");
+ fprintf(cvt, "set label 102 \"hit rates: A: %.3e B: %.3e C: %.3e D:%.3e\" at screen 0.4,0.01 left tc rgb \"#000044\" font \"monospace,8\"\n",
+ hitrates[0],
+ hitrates[1],
+ hitrates[2],
+ hitrates[3]);
+ fprintf(cvt, "set output '%s/%s_%08x.png';\n",picPath,mySystem,sensors[i]);
+ fprintf(cvt, "plot '-' matrix with image\n");
+
+ for(unsigned r = 0; r < 576; r++) {
+ for(unsigned c = 0; c < 1152; c++) {
+ fprintf(cvt,"%d ",pixelMap[i][r][c]);
}
-
-
- fprintf(cvt, "e\n\n");
- if (!cvt) {
- printf("couldn't open a pipe; quitting\n");
- exit(1);
+ fprintf(cvt,"\n");
}
+
+
+ fprintf(cvt, "e\n\n");
fflush(cvt);
status=pclose(cvt);
if (!WIFEXITED(status)) printf("error on closing the pipe\n");