|
|
|
@ -57,6 +57,7 @@ namespace gr { |
|
|
|
last_input=0; |
|
|
|
last_input=0; |
|
|
|
mode=COPY; |
|
|
|
mode=COPY; |
|
|
|
dosync_counter=0; |
|
|
|
dosync_counter=0; |
|
|
|
|
|
|
|
weakout_counter=0; |
|
|
|
} |
|
|
|
} |
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Our virtual destructor. |
|
|
|
* Our virtual destructor. |
|
|
|
@ -73,10 +74,13 @@ namespace gr { |
|
|
|
pmt::pmt_t meta = pmt::car(pdu); // meta declares type 0:RDS, 1:sync/nosync
|
|
|
|
pmt::pmt_t meta = pmt::car(pdu); // meta declares type 0:RDS, 1:sync/nosync
|
|
|
|
pmt::pmt_t sync = pmt::cdr(pdu); |
|
|
|
pmt::pmt_t sync = pmt::cdr(pdu); |
|
|
|
if(1L==pmt::to_long(meta) && pmt::eqv(sync,pmt::PMT_F)){ |
|
|
|
if(1L==pmt::to_long(meta) && pmt::eqv(sync,pmt::PMT_F)){ |
|
|
|
lout<< "entered nosync"<<std::endl; |
|
|
|
lout<< "switched to copy"<<std::endl; |
|
|
|
lout<<"mode: "<<mode<<std::endl; |
|
|
|
//lout<<"mode: "<<mode<<std::endl;
|
|
|
|
mode=COPY; |
|
|
|
mode=COPY; |
|
|
|
lout<<"mode: "<<mode<<std::endl; |
|
|
|
lout<<"mode: "<<mode<<std::endl; |
|
|
|
|
|
|
|
//lout<<"weakout_counter:"<<weakout_counter<<std::endl;
|
|
|
|
|
|
|
|
//weakout_counter=0;
|
|
|
|
|
|
|
|
//outbit_counter=0;
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -88,7 +92,12 @@ namespace gr { |
|
|
|
{ |
|
|
|
{ |
|
|
|
const float *in = (const float *) input_items[0]; |
|
|
|
const float *in = (const float *) input_items[0]; |
|
|
|
float *out = (float *) output_items[0]; |
|
|
|
float *out = (float *) output_items[0]; |
|
|
|
|
|
|
|
if(outbit_counter>1000){ |
|
|
|
|
|
|
|
outbit_counter=0; |
|
|
|
|
|
|
|
weakout_counter=0; |
|
|
|
|
|
|
|
lout<<"mode: "<<mode<<std::endl; |
|
|
|
|
|
|
|
lout<<"weakout_counter:"<<weakout_counter<<std::endl; |
|
|
|
|
|
|
|
} |
|
|
|
for (int i = 0; i < noutput_items; i++) { |
|
|
|
for (int i = 0; i < noutput_items; i++) { |
|
|
|
if(mode==COPY){ |
|
|
|
if(mode==COPY){ |
|
|
|
out[i]=in[DECIM*i]; |
|
|
|
out[i]=in[DECIM*i]; |
|
|
|
@ -102,12 +111,16 @@ namespace gr { |
|
|
|
else if(mode==NOSKIP){ |
|
|
|
else if(mode==NOSKIP){ |
|
|
|
out[i]=in[DECIM*i]-in[DECIM*i+1]; |
|
|
|
out[i]=in[DECIM*i]-in[DECIM*i+1]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//lout<<std::fixed << std::setprecision(3)<<out[i]<<".";
|
|
|
|
|
|
|
|
if(mode!=COPY and std::abs(out[i])<threshold){ |
|
|
|
|
|
|
|
weakout_counter++; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
last_input=in[(noutput_items-1)*DECIM+1];//to use for next iteration of work
|
|
|
|
last_input=in[(noutput_items-1)*DECIM+1];//to use for next iteration of work
|
|
|
|
//lout<<noutput_items<<std::endl;
|
|
|
|
//lout<<noutput_items<<std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
/*synchronize:*/ |
|
|
|
/*synchronize:*/ |
|
|
|
if(mode==COPY and dosync_counter==SYNC_COUNTER_MAX){ |
|
|
|
if(mode==COPY and dosync_counter>=SYNC_COUNTER_MAX){ |
|
|
|
dosync_counter=0; |
|
|
|
dosync_counter=0; |
|
|
|
float out_noskip; |
|
|
|
float out_noskip; |
|
|
|
float out_skip; |
|
|
|
float out_skip; |
|
|
|
@ -132,23 +145,22 @@ namespace gr { |
|
|
|
//lout<<"\t,out_skip:"<<out_skip<<std::endl;
|
|
|
|
//lout<<"\t,out_skip:"<<out_skip<<std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (skip_is_better_counter>6){ |
|
|
|
if (skip_is_better_counter>3){//2017-05-02 lowered from 6
|
|
|
|
mode=SKIP; |
|
|
|
mode=SKIP; |
|
|
|
lout<<"switched to skip"<< std::endl; |
|
|
|
lout<<"switched to skip"<< std::endl; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (skip_is_better_counter<-6){ |
|
|
|
else if (skip_is_better_counter<-3){ |
|
|
|
mode=NOSKIP; |
|
|
|
mode=NOSKIP; |
|
|
|
lout<<"switched to noskip"<< std::endl; |
|
|
|
lout<<"switched to noskip"<< std::endl; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if(mode==COPY){ |
|
|
|
} |
|
|
|
|
|
|
|
else if(mode==COPY){ |
|
|
|
dosync_counter++; |
|
|
|
dosync_counter++; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Tell runtime system how many output items we produced.
|
|
|
|
// Tell runtime system how many output items we produced.
|
|
|
|
|
|
|
|
outbit_counter+=noutput_items; |
|
|
|
return noutput_items; |
|
|
|
return noutput_items; |
|
|
|
}/*end of work*/ |
|
|
|
}/*end of work*/ |
|
|
|
} /* namespace multirds */ |
|
|
|
} /* namespace multirds */ |
|
|
|
|