From: c vw <dl1ycf@darc.de>
Date: Wed, 7 Aug 2019 09:45:44 +0000 (+0200)
Subject: preamp always "on" except for CHARLY25.
X-Git-Url: https://git.rkrishnan.org/pf/vdrive/frontends/...?a=commitdiff_plain;h=ef96dad2df62a608be8742b36fe2be28db3aa95d;p=pihpsdr.git

preamp always "on" except for CHARLY25.
---

diff --git a/hpsdrsim.c b/hpsdrsim.c
index 1974186..1259e68 100644
--- a/hpsdrsim.c
+++ b/hpsdrsim.c
@@ -644,7 +644,6 @@ int main(int argc, char *argv[])
 				memset(qsample, 0, OLDRTXLEN*sizeof(double));
 				enable_thread = 1;
 				active_thread = 1;
-				CommonMercuryFreq = 0;
 				if (pthread_create(&thread, NULL, handler_ep6, NULL) < 0)
 				{
 					perror("create old protocol thread");
diff --git a/midi3.c b/midi3.c
index 7e035c7..cfab507 100644
--- a/midi3.c
+++ b/midi3.c
@@ -185,6 +185,10 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
 	    break;
 	case PRE:	// only key supported
 	    if (filter_board == CHARLY25) {
+		//
+		// For hardware other than CHARLY25, we do not
+		// switch preamps
+		//
 		new = active_receiver->preamp + active_receiver->dither;
 		new++;
 		if (new >2) new=0;
@@ -203,12 +207,6 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
 			break;
 		}
 		g_idle_add(ext_update_att_preamp, NULL);
-	    } else {
-		// Note that these preamps are not present in most
-		// SDR hardware.
-		new=active_receiver->preamp+1;
-		if (new > 1) new=0;
-		active_receiver->preamp= (new == 1);
 	    }
 	    break;
 	case ATT:	// Key for ALEX attenuator, wheel or knob for slider
diff --git a/old_protocol.c b/old_protocol.c
index 58fc8f4..67bddd2 100644
--- a/old_protocol.c
+++ b/old_protocol.c
@@ -1110,7 +1110,13 @@ void ozy_send_buffer() {
 		output_buffer[C3]|=LT2208_DITHER_ON;
 	}
 #endif
-    if(active_receiver->preamp) {
+    if (filter_board == CHARLY25) {
+      if(active_receiver->preamp) {
+        output_buffer[C3]|=LT2208_GAIN_ON;
+      }
+    } else {
+      // preamp always "on" for non-CHARLY25 hardware
+      // (on modern boards the preamp is hard-wired "on")
       output_buffer[C3]|=LT2208_GAIN_ON;
     }
 
@@ -1276,9 +1282,12 @@ void ozy_send_buffer() {
       case 4:
         output_buffer[C0]=0x14;
         output_buffer[C1]=0x00;
-        for(i=0;i<receivers;i++) {
-          output_buffer[C1]|=(receiver[i]->preamp<<i);
-        }
+        //for(i=0;i<receivers;i++) {
+        //  output_buffer[C1]|=(receiver[i]->preamp<<i);
+        //}
+	// preamps always "on".
+        // (on modern boards the preamp is hard-wired "on")
+        output_buffer[C1]=0x0f;
         if(mic_ptt_enabled==0) {
           output_buffer[C1]|=0x40;
         }
@@ -1298,8 +1307,8 @@ void ozy_send_buffer() {
   
         if(device==DEVICE_HERMES || device==DEVICE_ANGELIA || device==DEVICE_ORION
                                  || device==DEVICE_ORION2  || device == DEVICE_STEMLAB) {
-	  // bit 5 on somee platforms activates a preamp that is hard-wired "on" on
-	  // other platforms, therefore always set it.
+	  // setting bit 5 ("Att enable") disables preamp choice
+          // (on modern boards the preamp is hard-wired "on")
           output_buffer[C4]=0x20 | (adc_attenuation[receiver[0]->adc] & 0x1F);
         } else {
 #ifdef RADIOBERRY
@@ -1314,7 +1323,8 @@ void ozy_send_buffer() {
         if(receivers==2) {
           if(device==DEVICE_HERMES || device==DEVICE_ANGELIA || device==DEVICE_ORION
                                    || device==DEVICE_ORION2  || device==DEVICE_STEMLAB) {
-	    // bit 5 on somee platforms activates a preamp that is hard-wired "on" on
+	    // setting bit 5 ("Att enable") disables preamp choice
+            // (on modern boards the preamp is hard-wired "on")
 	    // other platforms, therefore always set it.
             output_buffer[C1]=0x20 | (adc_attenuation[receiver[1]->adc] & 0x1F);
           }
diff --git a/rigctl.c b/rigctl.c
index 264a683..ee19965 100644
--- a/rigctl.c
+++ b/rigctl.c
@@ -2857,6 +2857,7 @@ void parse_cmd ( char * cmd_input,int len,int client_sock) {
         else if(strcmp(cmd_str,"PA")==0) { 
                                             // TS-2000 - PA - Set/Read Preamp function status
                                             // PiHPSDR - ZZPA - Set/Read Preamp function status
+					    // Note that currently, preamp switching is only done for CHARLY25
                                              if(len <=2) {
                                                 if(zzid_flag == 0) {
                                                    sprintf(msg,"PA%1d%1d;",active_receiver->preamp,active_receiver->preamp);