|
From: | Marcus Müller |
Subject: | Re: [Discuss-gnuradio] Sync short in gr-ieee802-11 |
Date: | Wed, 12 Apr 2017 12:22:50 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
Hi Nikita, I'll jump into the general_work method here, directly:
switch(d_state) { case SEARCH: { int i; for(i = 0; i < ninput; i++) { if(in_cor[i] > d_threshold) { if(d_plateau < MIN_PLATEAU) { d_plateau++; } else { d_state = COPY; … break; } … } consume_each(i); return 0; } case COPY: { int o = 0; while( o < ninput && o < noutput && d_copied < MAX_SAMPLES) { if(in_cor[o] > d_threshold) { if(d_plateau < MIN_PLATEAU) { d_plateau++; // there's another frame } else if(d_copied > MIN_GAP) { d_copied = 0; d_plateau = 0; … break; } … out[o] = in[o] * exp(gr_complex(0, -d_freq_offset * d_copied)); o++; d_copied++; } if(d_copied == MAX_SAMPLES) { d_state = SEARCH; } … consume_each(o); return o; } }So, this is a pretty classical state machine approach: at every call of general_work, the block is in either the COPY or the SEARCH state. We only care about whether COPY also does a search operation, and, lo: if(d_plateau < MIN_PLATEAU) { d_plateau++; // there's another frame } else if(d_copied > MIN_GAP) { d_copied = 0; d_plateau = 0;is exactly that. Best regards, Marcus On 12.04.2017 12:12, Nikita Airee
wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |