]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
radioberry using old-protocol
authorpa3gsb <pa3gsb@gmail.com>
Mon, 21 May 2018 13:05:36 +0000 (15:05 +0200)
committerpa3gsb <pa3gsb@gmail.com>
Mon, 21 May 2018 13:05:36 +0000 (15:05 +0200)
old_protocol.c
radio.c
radio.h
sliders.c

index 6ec5fee072ec316c4f513680f370325e00829918..c8da8777d839a99942bbcc05375ed734ac5ed80e 100644 (file)
@@ -797,9 +797,18 @@ void ozy_send_buffer() {
     if(active_receiver->random) {
       output_buffer[C3]|=LT2208_RANDOM_ON;
     }
-    if(active_receiver->dither) {
-      output_buffer[C3]|=LT2208_DITHER_ON;
-    }
+#ifdef RADIOBERRY
+       if (rx_gain_slider[active_receiver->adc] > 31) 
+       {
+               output_buffer[C3]|=LT2208_DITHER_OFF;}
+       else {
+               output_buffer[C3]|=LT2208_DITHER_ON;
+       }
+#else
+       if(active_receiver->dither) {
+               output_buffer[C3]|=LT2208_DITHER_ON;
+       }
+#endif
     if(active_receiver->preamp) {
       output_buffer[C3]|=LT2208_GAIN_ON;
     }
@@ -1021,7 +1030,12 @@ void ozy_send_buffer() {
         if(radio->device==DEVICE_HERMES || radio->device==DEVICE_ANGELIA || radio->device==DEVICE_ORION || radio->device==DEVICE_ORION2) {
           output_buffer[C4]=0x20|adc_attenuation[receiver[0]->adc];
         } else {
-          output_buffer[C4]=0x00;
+#ifdef RADIOBERRY
+                 int att = 63 - rx_gain_slider[active_receiver->adc];
+          output_buffer[C4]=0x20|att;
+#else
+                 output_buffer[C4]=0x00;
+#endif
         }
         break;
       case 5:
diff --git a/radio.c b/radio.c
index a7decc3d2947f5330dd6c79fda21e7668228d09a..8f4c9baac02c6e6874a0bcd9acd40f97cd8c3685 100644 (file)
--- a/radio.c
+++ b/radio.c
@@ -468,6 +468,8 @@ fprintf(stderr,"title: length=%d\n", (int)strlen(text));
 
   adc_attenuation[0]=0;
   adc_attenuation[1]=0;
+  rx_gain_slider[0] = 0;
+  rx_gain_slider[1] = 0;
 
 //fprintf(stderr,"meter_calibration=%f display_calibration=%f\n", meter_calibration, display_calibration);
   radioRestoreState();
diff --git a/radio.h b/radio.h
index 9130f0e9e7b831dc3443cf39f1686fafa5ff4e0f..c40848a74ad71eb0fdcea5e551d6b8bba4d4d2b7 100644 (file)
--- a/radio.h
+++ b/radio.h
@@ -143,6 +143,7 @@ int receivers;
 
 int adc[2];
 int adc_attenuation[2];
+int rx_gain_slider[2];
 
 int locked;
 
index ae7d7f1cfc7c6f2016f031f1c464c4fbea25bfad..10150bc4b7c538e5cf15e2db6fa96124ada60bc1 100644 (file)
--- a/sliders.c
+++ b/sliders.c
@@ -127,13 +127,10 @@ static void attenuation_value_changed_cb(GtkWidget *widget, gpointer data) {
   //from -12 to 0; the rx-gain slider functions as an att slider
   //from 0 - 48 db; the rx-gain slider functions as a gain slider with att = 0;
   //att set to 20 for good power measurement.
-  int rx_gain = (int)gtk_range_get_value(GTK_RANGE(attenuation_scale));
-  if (rx_gain > 12) {
-         adc_attenuation[active_receiver->adc]= 20;
-  } else {
-         adc_attenuation[active_receiver->adc]= 20 + (12- rx_gain);
-  }
-  set_attenuation(rx_gain);
+  int rx_gain_slider_value = (int)gtk_range_get_value(GTK_RANGE(attenuation_scale));
+  rx_gain_slider[active_receiver->adc]=rx_gain_slider_value;
+  adc_attenuation[active_receiver->adc]= MAX((12 - rx_gain_slider_value), 0);
+  set_attenuation(adc_attenuation[active_receiver->adc]);
 #else
   adc_attenuation[active_receiver->adc]=(int)gtk_range_get_value(GTK_RANGE(attenuation_scale));
   set_attenuation(adc_attenuation[active_receiver->adc]);