]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Moved "IQSWAP" handling from transmitter.c to soapy_protocol.c,
authorc vw <dl1ycf@darc.de>
Mon, 15 Nov 2021 13:25:12 +0000 (14:25 +0100)
committerc vw <dl1ycf@darc.de>
Mon, 15 Nov 2021 13:25:12 +0000 (14:25 +0100)
to be consistent with the RX chain

soapy_protocol.c
transmitter.c

index f3a285bf076433ddfcca1a4de29954703a23cff1..a948954e8402878f25605ba25612ce0685a9334a 100644 (file)
@@ -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);
index 1e4ef52e4f95c278aac7026e62a978f9dcea6e61..8fd8319ef4ab7dbbc5375c961b505db2a3d7d142 100644 (file)
@@ -1356,13 +1356,8 @@ static void full_tx_buffer(TRANSMITTER *tx) {
        //
        for(j=0;j<tx->output_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) {