]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Reverted storing the "Alex Attenuator" settings for each band,
authorDL1YCF <dl1ycf@darc.de>
Sat, 22 Aug 2020 10:31:24 +0000 (12:31 +0200)
committerDL1YCF <dl1ycf@darc.de>
Sat, 22 Aug 2020 10:31:24 +0000 (12:31 +0200)
since the step attenuator also are not treated like this.

14 files changed:
Makefile.mac
client_server.c
client_server.h
equalizer_menu.c
ext.c
freqent_menu.c
general_menu.c
radio.c
radio.h
radio_menu.c
receiver.c
rx_menu.c
sliders.c
vfo.c

index d5d0cd19273a61d26b835a02e57f44a0a976360c..89fd8d20617844cf5548a898262a7c52423c52d2 100644 (file)
@@ -12,7 +12,7 @@ PURESIGNAL_INCLUDE=PURESIGNAL
 LOCALCW_INCLUDE=LOCALCW
 
 # uncomment the line below for SoapySDR
-SOAPYSDR_INCLUDE=SOAPYSDR
+#SOAPYSDR_INCLUDE=SOAPYSDR
 
 # uncomment the line to below include support for sx1509 i2c expander
 #SX1509_INCLUDE=sx1509
@@ -150,7 +150,7 @@ OPTIONS=$(MIDI_OPTIONS) $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(USBOZY_OPTIONS
         $(CONTROLLER2_OPTIONS) $(AUDIO_OPTIONS) \
        -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION)
 
-LIBS=-lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(GTKLIBS) $(SOAPYSDRLIBS) $(STEMLAB_LIBS) $(MIDI_LIBS)
+LIBS=     -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(GTKLIBS) $(SOAPYSDRLIBS) $(STEMLAB_LIBS) $(MIDI_LIBS)
 INCLUDES=$(GTKINCLUDES)
 
 COMPILE=$(CC) $(CFLAGS) $(OPTIONS) $(INCLUDES)
index aace4b8d6763ec5734446a470ce9bbc8d5b114cd..569253832aee570c171e01692f93ae9002827946 100644 (file)
@@ -1306,11 +1306,6 @@ g_print("send_squelch rx=%d enable=%d squelch=%d\n",rx,enable,squelch);
   }
 }
 
-void send_eq(int s, int rxeq, int txeq) {
-  // inform client about RX/TX equalizer status
-  // NOT-YET
-}
-
 void send_noise(int s,int rx,int nb,int nb2,int nr,int nr2,int anf,int snb) {
   NOISE_COMMAND command;
 g_print("send_noise rx=%d nb=%d nb2=%d nr=%d nr2=%d anf=%d snb=%d\n",rx,nb,nb2,nr,nr2,anf,snb);
index 6287f7442775ea7b3c9c3e094ae7187186814da6..926b93fcb46ad2d7e765da61d4318e4742754dc6 100644 (file)
@@ -488,7 +488,6 @@ extern void send_agc_gain(int s,int rx,int gain,int hang,int thresh);
 extern void send_attenuation(int s,int rx,int attenuation);
 extern void send_squelch(int s,int rx,int enable,int squelch);
 extern void send_noise(int s,int rx,int nb,int nb2,int nr,int nr2,int anf,int snb);
-extern void send_eq(int s, int rxeq, int txeq);
 extern void send_band(int s,int rx,int band);
 extern void send_mode(int s,int rx,int mode);
 extern void send_filter(int s,int rx,int filter);
index fdfea86c25ac9dd07fc0a104689b33ff297bbdbd..f51ef3337ffa1e68a22c545f94e912a79f49a85f 100644 (file)
@@ -98,7 +98,10 @@ void set_eq() {
 void update_eq() {
 #ifdef CLIENT_SERVER
   if(radio_is_remote) {
-     send_eq(client_socket,enable_rx_eq, enable_tx_equalizer);
+     //
+     // insert here any function to inform the client of equalizer setting
+     // changes, if this becomes part of the protocol
+     //
   } else {
 #endif
     set_eq();
diff --git a/ext.c b/ext.c
index 41ad26fb4662566c492c1d1230f17d9eb4cf3c14..6cdf9868bcfb19f318c72b9052fd3fddcfcb111d 100644 (file)
--- a/ext.c
+++ b/ext.c
@@ -310,10 +310,7 @@ int ext_update_att_preamp(void *data) {
 
 int ext_set_alex_attenuation(void *data) {
   int val=GPOINTER_TO_INT(data);
-  BAND *band=band_get_band(vfo[VFO_A].band);
-  // store changed attenuation in "band" info
-  band->alexAttenuation=val;
-  set_alex_attenuation();
+  set_alex_attenuation(val);
   return 0;
 }
 
index 9de8a11f203ce2fea6afe2a2b8b8e04bcbbe1ff7..d1a57b66c144920448d50e93ea0ba84366134550 100644 (file)
@@ -130,12 +130,13 @@ static gboolean freqent_select_cb (GtkWidget *widget, gpointer data) {
                 FILTER* band_filters=filters[entry->mode];
                 FILTER* band_filter=&band_filters[entry->filter];
                 set_filter(active_receiver,band_filter->low,band_filter->high);
+                if(active_receiver->id==0) {
+                  set_alex_rx_antenna();
+                  set_alex_tx_antenna();
+                  // set_alex_attenuation(band->alexAttenuation); // nowhere maintained
+                }
               }
               setFrequency(f);
-             // defer set_alex.. until here since setFrequency sets the VFO.band
-              set_alex_rx_antenna();
-              set_alex_tx_antenna();
-              set_alex_attenuation();
               g_idle_add(ext_vfo_update,NULL);
             }
             set = 1;
index 01e173f5064bdc89b8766714af9bb0274148ec19..c7c9b68ad4d9385e97356b66a0a3d0801ecb3160 100644 (file)
@@ -110,7 +110,7 @@ static void alex_cb(GtkWidget *widget, gpointer data) {
     if(active_receiver->id==0) {
       set_alex_rx_antenna(band->alexRxAntenna);
       set_alex_tx_antenna(band->alexTxAntenna);
-      set_alex_attenuation(band->alexAttenuation);
+      // set_alex_attenuation(band->alexAttenuation); // nowhere maintained
     }
   }
 }
diff --git a/radio.c b/radio.c
index ded66cb67edbc09e376d073540490e359c2a8e01..4a04e697330944003d772a41894fc88bef7ec30b 100644 (file)
--- a/radio.c
+++ b/radio.c
@@ -184,7 +184,11 @@ double mic_gain=0.0;
 int binaural=0;
 
 int mic_linein=0;
-int linein_gain=16; // 0..31
+//
+// linein_gain = 0...31 maps onto -34.5dB ... +12 dB
+// (in 1.5 dB steps), and 0 dB corresponds to linein_gain=23
+//
+int linein_gain=23;
 int mic_boost=0;
 int mic_bias_enabled=0;
 int mic_ptt_enabled=0;
@@ -1852,21 +1856,12 @@ void set_alex_tx_antenna() {
 
 //
 // For HPSDR, only receiver[0]->alex_attenuation has an effect
-// Set this from the attenuation stored "per band"
 //
-void set_alex_attenuation() {
-    BAND *band;
-    switch (protocol) {
-      case ORIGINAL_PROTOCOL:
-        band=band_get_band(vfo[VFO_A].band);
-        receiver[0]->alex_attenuation=band->alexAttenuation;
-        break;
-      case NEW_PROTOCOL:
-        band=band_get_band(vfo[VFO_A].band);
-        receiver[0]->alex_attenuation=band->alexAttenuation;
-        schedule_high_priority();
-        break;
-      }
+void set_alex_attenuation(int v) {
+    receiver[0]->alex_attenuation=v;
+    if(protocol==NEW_PROTOCOL) {
+      schedule_high_priority();
+    }
 }
 
 void radioRestoreState() {
diff --git a/radio.h b/radio.h
index 1d199c13609df6c1237373f2adb039a79a33ef36..3772e2c8b49da71d22efed32d893982ea7f94eed 100644 (file)
--- a/radio.h
+++ b/radio.h
@@ -337,7 +337,7 @@ extern void setSquelch(RECEIVER *rx);
 extern void set_attenuation(int value);
 extern void set_alex_rx_antenna(void);
 extern void set_alex_tx_antenna(void);
-extern void set_alex_attenuation(void);
+extern void set_alex_attenuation(int v);
 
 extern int isTransmitting();
 
index aa43bcb5daa2f4466b1905f5952918741c629553..9400f2b3a37e090f02af2060ce34ffaa93ed648d 100644 (file)
@@ -288,13 +288,21 @@ void load_filters(void) {
     filter_board_changed();
   }
 
-  //
-  // This should not be necessary HERE
-  //
-  if(filter_board==ALEX || filter_board==APOLLO || filter_board==CHARLY25) {
+  if(filter_board==ALEX || filter_board==APOLLO) {
+    BAND *band=band_get_current_band();
+    // mode and filters have nothing to do with the filter board
+    //BANDSTACK_ENTRY* entry=bandstack_entry_get_current();
+    //setFrequency(entry->frequency);
+    //setMode(entry->mode);
+    //set_mode(active_receiver,entry->mode);
+    //FILTER* band_filters=filters[entry->mode];
+    //FILTER* band_filter=&band_filters[entry->filter];
+    //set_filter(active_receiver,band_filter->low,band_filter->high);
+    if(active_receiver->id==0) {
       set_alex_rx_antenna();
       set_alex_tx_antenna();
-      set_alex_attenuation();
+      //set_alex_attenuation(band->alexAttenuation); // nowhere maintained
+    }
   }
   att_type_changed();
 }
index 898f43b6b775ee21e91681a422150c970f2a83ce..a0975798fd542151956d015a4147a8e108064e7a 100644 (file)
@@ -1027,7 +1027,7 @@ fprintf(stderr,"create_receiver: id=%d default adc=%d\n",rx->id, rx->adc);
   
   BAND *b=band_get_band(vfo[rx->id].band);
   rx->alex_antenna=b->alexRxAntenna;
-  rx->alex_attenuation=b->alexAttenuation;
+  //rx->alex_attenuation=b->alexAttenuation;  // nowhere maintained
 
   rx->agc=AGC_MEDIUM;
   rx->agc_gain=80.0;
index c56a5e4750fadf81ccc7a25083379d5e4b691849..3fff41311a8908f7045a6c4a85cb2cbb01d117a7 100644 (file)
--- a/rx_menu.c
+++ b/rx_menu.c
@@ -33,7 +33,6 @@
 #include "receiver.h"
 #include "sliders.h"
 #include "new_protocol.h"
-#include "vfo.h"
 
 static GtkWidget *parent_window=NULL;
 static GtkWidget *menu_b=NULL;
@@ -81,12 +80,8 @@ static void preamp_cb(GtkWidget *widget, gpointer data) {
 }
 
 static void alex_att_cb(GtkWidget *widget, gpointer data) {
-  BAND *band;
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
-    // store value in the "band" info
-    band=band_get_band(vfo[VFO_A].band);
-    band->alexAttenuation=GPOINTER_TO_INT(data);
-    set_alex_attenuation();
+    set_alex_attenuation((intptr_t) data);
     update_att_preamp();
   }
 }
@@ -314,7 +309,7 @@ void rx_menu(GtkWidget *parent) {
 #ifdef USBOZY
          (protocol==ORIGINAL_PROTOCOL && device == DEVICE_OZY) ||
 #endif
-        (protocol==NEW_PROTOCOL && device == NEW_DEVICE_ATLAS)) {
+        (protocol==NEW_PROTOCOL && device == NEW_DEVICE_ATLAS)) {
         GtkWidget *preamp_b=gtk_check_button_new_with_label("Preamp");
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preamp_b), active_receiver->preamp);
         gtk_grid_attach(GTK_GRID(grid),preamp_b,x,4,1,1);
@@ -324,6 +319,9 @@ void rx_menu(GtkWidget *parent) {
       if (filter_board == ALEX && active_receiver->adc == 0
           && ((protocol==ORIGINAL_PROTOCOL && device != DEVICE_ORION2) || (protocol==NEW_PROTOCOL && device != NEW_DEVICE_ORION2))) {
   
+        //
+        // The "Alex ATT" value is stored in receiver[0] no matter how the ADCs are selected
+        //
         GtkWidget *alex_att_label=gtk_label_new(NULL);
         gtk_label_set_markup(GTK_LABEL(alex_att_label), "<b>Alex Attenuator</b>");
         gtk_grid_attach(GTK_GRID(grid), alex_att_label, x, 5, 1, 1);
@@ -332,7 +330,7 @@ void rx_menu(GtkWidget *parent) {
           gchar button_text[] = "xx dB";
           sprintf(button_text, "%d dB", i*10);
           GtkWidget *alex_att_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(last_alex_att_b), button_text);
-          gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(alex_att_b), active_receiver->alex_attenuation == i);
+          gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(alex_att_b), receiver[0]->alex_attenuation == i);
           gtk_grid_attach(GTK_GRID(grid), alex_att_b, x, 6 + i, 1, 1);
           g_signal_connect(alex_att_b, "toggled", G_CALLBACK(alex_att_cb), GINT_TO_POINTER(i));
           last_alex_att_b = alex_att_b;
index 07b55a4c3c64a99d6e5ead46a86177c544dcbd9a..0b306c58b2388199015978c38adaf389e4ff7fc9 100644 (file)
--- a/sliders.c
+++ b/sliders.c
@@ -250,9 +250,7 @@ static void c25_att_combobox_changed(GtkWidget *widget, gpointer data) {
     // this button is only valid for the first receiver
     // store attenuation, such that in meter.c the correct level is displayed
     adc_attenuation[active_receiver->adc] = 12*val;
-    BAND* band = band_get_band(vfo[VFO_A].band);
-    band->alexAttenuation=val;
-    set_alex_attenuation();
+    set_alex_attenuation(val);
   } else {
     // always show "0 dB" on the button if the second RX is active
     if (val != 0) {
diff --git a/vfo.c b/vfo.c
index cb13f6456a0efc554971c5b4e80c2312cd2a29c0..fefa670aec737db77c4cc39ed69a01eae1ad8714 100644 (file)
--- a/vfo.c
+++ b/vfo.c
@@ -410,6 +410,7 @@ void vfo_band_changed(int id,int b) {
   switch(id) {
     case 0:
       bandstack->current_entry=vfo[id].bandstack;
+      // set_alex_attenuation(band->alexAttenuation); // nowhere maintained
       receiver_vfo_changed(receiver[0]);
       break;
    case 1:
@@ -418,7 +419,6 @@ void vfo_band_changed(int id,int b) {
       }
       break;
   }
-  set_alex_attenuation();
   set_alex_rx_antenna();
 
   if(can_transmit) {
@@ -461,6 +461,7 @@ void vfo_bandstack_changed(int b) {
   switch(id) {
     case 0:
       bandstack->current_entry=vfo[id].bandstack;
+      // set_alex_attenuation(band->alexAttenuation); // nowhere maintained
       receiver_vfo_changed(receiver[0]);
       break;
    case 1:
@@ -471,7 +472,6 @@ void vfo_bandstack_changed(int b) {
   }
 
   set_alex_rx_antenna();
-  set_alex_attenuation();
   if(can_transmit) {
     set_alex_tx_antenna();
     tx_set_mode(transmitter,get_tx_mode());
@@ -590,7 +590,6 @@ void vfo_a_to_b() {
     receiver_vfo_changed(receiver[1]);
   }
   set_alex_rx_antenna();
-  set_alex_attenuation();
   if(can_transmit) {
     set_alex_tx_antenna();
     tx_set_mode(transmitter,get_tx_mode());
@@ -611,7 +610,6 @@ void vfo_b_to_a() {
   vfo[VFO_A].rit=vfo[VFO_B].rit;
   receiver_vfo_changed(receiver[0]);
   set_alex_rx_antenna();
-  set_alex_attenuation();
   if(can_transmit) {
     set_alex_tx_antenna();
     tx_set_mode(transmitter,get_tx_mode());
@@ -666,7 +664,6 @@ void vfo_a_swap_b() {
     receiver_vfo_changed(receiver[1]);
   }
   set_alex_rx_antenna();
-  set_alex_attenuation();
   if(can_transmit) {
     set_alex_tx_antenna();
     tx_set_mode(transmitter,get_tx_mode());