changes on Cufluo_expose_script,filename_creator and bugfix in receiver (was crashing in

case of two gettimeofday() call returning the same value
This commit is contained in:
mozzanica
2021-03-24 14:12:34 +01:00
parent 0641de6e13
commit 9b07df6841
10 changed files with 169 additions and 78 deletions

View File

@ -0,0 +1 @@
ju_udp_receiver_3threads_new_header

View File

@ -167,7 +167,7 @@ int main(int argc,char *argv[])
if ((argc>2)&&(strcmp(argv[1],"C6")==0)) { top=0;bot=0;chid=6;}
if ((argc>2)&&(strcmp(argv[1],"C7")==0)) { top=0;bot=0;chid=7;}
int kkk=0;
chidy=(int)(chid/4);
chidx=(chid%4);
ipxoffs=chidy*1024*256; //offset: zero if in the bottom part, half image otherwise
@ -326,17 +326,26 @@ int main(int argc,char *argv[])
gettimeofday(&tsss,NULL);
tdif=(1e6*(tsss.tv_sec - tss.tv_sec)+(long)(tsss.tv_usec)-(long)(tss.tv_usec));
rpratio=(totalnpacket/(float)128)/(float)(packetframenumcurr-packetframenumold);
aimageration=ncompleteframes/(float)(packetframenumcurr-packetframenumfirst);
npri=(int) ((float)(500000)/(((float)(tdif)/(float)(packetframenumcurr-packetframenumold)))/50.0 + 1) * 50;
aimageration=ncompleteframes/(float)(packetframenumcurr-packetframenumfirst+1);
// printf(" \n %ld %ld %ld %ld \n",(long)tsss.tv_sec,(long)tss.tv_sec,(long)tsss.tv_usec,(long)tss.tv_usec);
if (tdif>0) {
npri=(int) ((float)(500000)/(((float)(tdif)/(float)(packetframenumcurr-packetframenumold)))/50.0 + 1) * 50;
}
//printf("npri = %d %f \n " ,npri,(float)(tdif)/(float)(packetframenumcurr-packetframenumold) );
if ((rpratio!=1)&&(printeach!=npri-1)) {
printf(A_C_RED "Average hardware rate = %4d Hz, Average Rcv. image ratio= %1.7f Rcv. pck. ratio %1.5f , ringbuf max =%4d/%4d Fr#: %ld \n" A_C_RESET, (int)( 1e6/(tdif/(packetframenumcurr-packetframenumold))), aimageration, rpratio ,maxringsize,RINGSIZE,packetframenumcurr-packetframenumfirst);
}
else {
printf("Average hardware rate = %4d Hz, Average Rcv. image ratio= %1.7f Rcv. pck. ratio %1.5f , ringbuf max =%4d/%4d Fr#: %ld \n", (int)( 1e6/(tdif/(packetframenumcurr-packetframenumold))), aimageration, rpratio ,maxringsize,RINGSIZE,packetframenumcurr-packetframenumfirst);
// printf("%f %lu %d \n",tdif,packetframenumcurr,packetframenumold);
printf("timestamp: %lds.%ldns SC= 0x%x 0x%x", (packet.timestamp)/10000000,((packet.timestamp)%10000000)/10, (((packet.debug)>>8)&0xf), packet.headerVersion);
printf("timestamp: %4lds.%6ldns SC= 0x%x ", (packet.timestamp)/10000000,((packet.timestamp)%10000000)/10, (((packet.debug)>>8)&0xf));
// printf("SC= 0x%x ", (((packet.debug)>>8)&0xf));
@ -444,8 +453,7 @@ int main(int argc,char *argv[])
if (strcmp(request,"give\n")==0) {
// sc_tolook_for=15-(kkk%3);
// kkk++;
sc_tolook_for=13;
while (frametosend<=frametosendold){
usleep(20000); //TBC
@ -455,7 +463,7 @@ int main(int argc,char *argv[])
//if ((((ringbuffer[localpt].bunchid)>>8)&0xf)==2){ frametosend=(*putpt)-ib; break;}
// replaced with 'timeout'
if ((count_since_scfound > 100 )) { // tunable
printf("Receiver to online disp: going to look for sc15 any SC instead of SCX\n");
// printf("Receiver to online disp: going to look for sc15 any SC instead of SCX\n");
intimeout=1;
}