提交 ecf2f691 编写于 作者: M manjaro-xfce

传输Ascii

上级 1e61fab6
......@@ -111,41 +111,34 @@ int runSend()
fprintf(stderr, "Press Ctrl+C to stop streaming.\n");
fprintf(stderr, "Input 0 or 1:");
fprintf(stderr, "Input :");
// Actual streaming, TX Threading
while (!stop_signal_called) {
char c = getchar();
size_t total_sent = 0;
int wfm = -1;
if (c=='1'||c=='-')
wfm = 1;
else if (c=='0' || c=='.')
wfm = 0;
else
char cha = getchar();
for (int i=0;i<16;++i)
{
fprintf(stderr, "Input 0 or 1:");
continue;
char c = 0;
if (i<3 || i>11)
c = 1;
else if (i>=4)
c = (cha >> (11 - i)) & 0x01;
size_t total_sent = 0;
int wfm = c==0?0:1;
while (total_sent < WAVSIZE && !stop_signal_called )
{
size_t num_samps_sent = 0;
SPTYPE * tx_buff = wav_spread[wfm][total_sent];
const void ** tx_buff_ptr = (const void **) &tx_buff;
int start_of_burst = total_sent==0?1:0;
int end_of_burst = (total_sent + tx_sps_buff) >=WAVSIZE ?1:0;
int metai = start_of_burst * 2 + end_of_burst;
int send_sz = end_of_burst?(WAVSIZE - total_sent ):(tx_sps_buff);
UHD_DO(uhd_tx_streamer_send(tx_streamer, tx_buff_ptr,
send_sz, tx_meta + metai,
1, &num_samps_sent));
total_sent += num_samps_sent;
}
}
if (wfm<0 || wfm >1)
{
fprintf(stderr, "Error Input.\n");
continue;
}
while (total_sent < WAVSIZE && !stop_signal_called )
{
size_t num_samps_sent = 0;
SPTYPE * tx_buff = wav_spread[wfm][total_sent];
const void ** tx_buff_ptr = (const void **) &tx_buff;
int start_of_burst = total_sent==0?1:0;
int end_of_burst = (total_sent + tx_sps_buff) >=WAVSIZE ?1:0;
int metai = start_of_burst * 2 + end_of_burst;
int send_sz = end_of_burst?(WAVSIZE - total_sent ):(tx_sps_buff);
UHD_DO(uhd_tx_streamer_send(tx_streamer, tx_buff_ptr,
send_sz, tx_meta + metai,
1, &num_samps_sent));
total_sent += num_samps_sent;
}
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
......
......@@ -194,6 +194,8 @@ void runDeal()
p[1] = fftw_plan_dft_1d(WAVSIZE, in[1], out[1], FFTW_FORWARD, FFTW_ESTIMATE);
//fftw_execute(p); /* repeat as needed */
double globalMax = 0;
int count = 0;
char c = 0;
while (!stop_signal_called)
{
if (deal_count + WAVSIZE >= rx_count || rx_count < WAVSIZE )
......@@ -260,12 +262,12 @@ void runDeal()
}
}
if (best0)
if (ampwin[(deal_count +half_sz - WAVSIZE )% WAVSIZE][1]*10 > ampwin[(deal_count +half_sz - WAVSIZE )% WAVSIZE][0])
if (ampwin[(deal_count +half_sz - WAVSIZE )% WAVSIZE][1]*5 > ampwin[(deal_count +half_sz - WAVSIZE )% WAVSIZE][0])
{
best0 = false;
}
if (best1)
if (ampwin[(deal_count +half_sz - WAVSIZE )% WAVSIZE][0]*10 > ampwin[(deal_count +half_sz - WAVSIZE )% WAVSIZE][1])
if (ampwin[(deal_count +half_sz - WAVSIZE )% WAVSIZE][0]*5 > ampwin[(deal_count +half_sz - WAVSIZE )% WAVSIZE][1])
{
best1 = false;
}
......@@ -275,14 +277,36 @@ void runDeal()
if (best0 )
{
next_test = deal_count + WAVSIZE/2 - MODRATE_N * 16;
putchar('0');
fflush(stdout);
if (count==0)
count = 9;
if (count > 0 && count < 9)
{
//putchar('0');
c <<= 1;
fflush(stdout);
}
if (count > 0)
{
--count;
if (count==0)
putchar (c);
}
}
else if (best1 )
{
next_test = deal_count + WAVSIZE/2 - MODRATE_N * 16;
putchar('1');
fflush(stdout);
if (count>0)
{
//putchar('1');
c <<= 1;
c+=1;
fflush(stdout);
--count;
if (count==0)
putchar (c);
}
}
++deal_count;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册