From 612e8ad96465ecd95201a4c044b5101a708f27fa Mon Sep 17 00:00:00 2001 From: c vw Date: Mon, 15 Nov 2021 14:25:12 +0100 Subject: [PATCH] Moved "IQSWAP" handling from transmitter.c to soapy_protocol.c, to be consistent with the RX chain --- soapy_protocol.c | 15 ++++++++------- transmitter.c | 9 ++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/soapy_protocol.c b/soapy_protocol.c index f3a285b..a948954 100644 --- a/soapy_protocol.c +++ b/soapy_protocol.c @@ -409,16 +409,17 @@ void soapy_protocol_iq_samples(float isample,float qsample) { long timeoutUs=100000L; if(isTransmitting()) { // - // Seemingly "iqswap" ONLY applies to the RX samples. So - // the check on "iqswap" should *not* be made here (???) + // The "iqswap" logic has now been removed from transmitter.c + // and moved here, because this is where it is also handled + // upon RX. // - //if (iqswap) { - // output_buffer[(output_buffer_index*2)]=qsample; - // output_buffer[(output_buffer_index*2)+1]=isample; - //} else { + if (iqswap) { + output_buffer[(output_buffer_index*2)]=qsample; + output_buffer[(output_buffer_index*2)+1]=isample; + } else { output_buffer[(output_buffer_index*2)]=isample; output_buffer[(output_buffer_index*2)+1]=qsample; - //} + } output_buffer_index++; if(output_buffer_index>=max_tx_samples) { int elements=SoapySDRDevice_writeStream(soapy_device,tx_stream,tx_buffs,max_tx_samples,&flags,timeNs,timeoutUs); diff --git a/transmitter.c b/transmitter.c index 1e4ef52..8fd8319 100644 --- a/transmitter.c +++ b/transmitter.c @@ -1356,13 +1356,8 @@ static void full_tx_buffer(TRANSMITTER *tx) { // for(j=0;joutput_samples;j++) { double is,qs; - if(iqswap) { - qs=tx->iq_output_buffer[j*2]; - is=tx->iq_output_buffer[(j*2)+1]; - } else { - is=tx->iq_output_buffer[j*2]; - qs=tx->iq_output_buffer[(j*2)+1]; - } + is=tx->iq_output_buffer[j*2]; + qs=tx->iq_output_buffer[(j*2)+1]; isample=is>=0.0?(long)floor(is*gain+0.5):(long)ceil(is*gain-0.5); qsample=qs>=0.0?(long)floor(qs*gain+0.5):(long)ceil(qs*gain-0.5); switch(protocol) { -- 2.45.2