From: c vw <dl1ycf@darc.de>
Date: Mon, 13 Jan 2020 18:21:00 +0000 (+0100)
Subject: improvements for DIVERSITY
X-Git-Url: https://git.rkrishnan.org/components/frontends/pb.xhtml?a=commitdiff_plain;h=8eb469efc6b7d23c0770141cd721cb47a1533c1a;p=pihpsdr.git

improvements for DIVERSITY
---

diff --git a/old_protocol.c b/old_protocol.c
index b5b0fdb..ccb75d4 100644
--- a/old_protocol.c
+++ b/old_protocol.c
@@ -1198,6 +1198,11 @@ void ozy_send_buffer() {
 
 
     output_buffer[C4]=0x04;  // duplex
+    //
+    // This is used to phase-synchronize RX1 and RX2 on some boards
+    // and enforces that the RX1 and RX2 frequencies are the same.
+    //
+    if (diversity_enabled) output_buffer[C4] |= 0x80;
 
     // 0 ... 7 maps on 1 ... 8 receivers
     output_buffer[C4]|=(num_hpsdr_receivers-1)<<3;
@@ -1429,7 +1434,12 @@ void ozy_send_buffer() {
 	  if (isTransmitting()) {
             output_buffer[C1]=0x3F;
           } else {
-            output_buffer[C1]=0x20 | (adc_attenuation[receiver[1]->adc] & 0x1F);
+	    // if diversity is enabled, use RX1 att value for RX2
+            if (diversity_enabled) {
+              output_buffer[C1]=0x20 | (adc_attenuation[receiver[0]->adc] & 0x1F);
+	    } else {
+              output_buffer[C1]=0x20 | (adc_attenuation[receiver[1]->adc] & 0x1F);
+	    }
           }
         }
         output_buffer[C2]=0x00; // ADC3 attenuator disabled.