]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Fixed transmitter references for RTL-SDR (no tranmit)
authorJohn Melton G0ORX <john.d.melton@googlemail.com>
Sun, 6 Oct 2019 17:11:56 +0000 (18:11 +0100)
committerJohn Melton G0ORX <john.d.melton@googlemail.com>
Sun, 6 Oct 2019 17:11:56 +0000 (18:11 +0100)
15 files changed:
ant_menu.c
audio.c
discovered.h
discovery.c
ext.c
midi.h
midi2.c
midi3.c
radio.c
radio.h
radio_menu.c
soapy_discovery.c
soapy_protocol.c
transmitter.c
vfo.c

index b6bb7ecc17f4efb2677cf138b2cc0a521d6889bb..d7ac9f796c16ed4a9af49981e005f6159d619d96 100644 (file)
@@ -417,19 +417,21 @@ g_print("rx_antennas=%d\n",radio->info.soapy.rx_antennas);
       gtk_grid_attach(GTK_GRID(grid),adc0_antenna_combo_box,1,1,1,1);
     }
 
-    g_print("tx_antennas=%d\n",radio->info.soapy.tx_antennas);
-    if(radio->info.soapy.tx_antennas>0) {
-      GtkWidget *antenna_label=gtk_label_new("TX Antenna:");
-      gtk_grid_attach(GTK_GRID(grid),antenna_label,0,2,1,1);
-      dac0_antenna_combo_box=gtk_combo_box_text_new();
-
-      for(i=0;i<radio->info.soapy.tx_antennas;i++) {
-        gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(dac0_antenna_combo_box),NULL,radio->info.soapy.tx_antenna[i]);
+    if(can_transmit) {
+      g_print("tx_antennas=%d\n",radio->info.soapy.tx_antennas);
+      if(radio->info.soapy.tx_antennas>0) {
+        GtkWidget *antenna_label=gtk_label_new("TX Antenna:");
+        gtk_grid_attach(GTK_GRID(grid),antenna_label,0,2,1,1);
+        dac0_antenna_combo_box=gtk_combo_box_text_new();
+  
+        for(i=0;i<radio->info.soapy.tx_antennas;i++) {
+          gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(dac0_antenna_combo_box),NULL,radio->info.soapy.tx_antenna[i]);
+        }
+  
+        gtk_combo_box_set_active(GTK_COMBO_BOX(dac0_antenna_combo_box),dac[0].antenna);
+        g_signal_connect(dac0_antenna_combo_box,"changed",G_CALLBACK(dac0_antenna_cb),&dac[0]);
+        gtk_grid_attach(GTK_GRID(grid),dac0_antenna_combo_box,1,2,1,1);
       }
-
-      gtk_combo_box_set_active(GTK_COMBO_BOX(dac0_antenna_combo_box),dac[0].antenna);
-      g_signal_connect(dac0_antenna_combo_box,"changed",G_CALLBACK(dac0_antenna_cb),&dac[0]);
-      gtk_grid_attach(GTK_GRID(grid),dac0_antenna_combo_box,1,2,1,1);
     }
 
   }
diff --git a/audio.c b/audio.c
index 70e160048401d7c39f49f7749fccbc23f77a4b3a..2028e32683061cd665a744ec3a29f18b76596cc3 100644 (file)
--- a/audio.c
+++ b/audio.c
@@ -371,7 +371,10 @@ int audio_write(RECEIVER *rx,short left_sample,short right_sample) {
   snd_pcm_sframes_t delay;
   long rc;
   long trim;
-  int mode=transmitter->mode;
+  int mode=modeUSB;
+  if(can_transmit) {
+    mode=transmitter->mode;
+  }
   //
   // We have to stop the stream here if a CW side tone may occur.
   // This might cause underflows, but we cannot use audio_write
index 3309f88fff825d54e4f789a3175d471c600325b2..fcff6835ee1fd239b33232a114b978f48c473bc4 100644 (file)
@@ -93,6 +93,7 @@ struct _DISCOVERED {
     int supported_receivers;
     int supported_transmitters;
     int adcs;
+    int dacs;
     double frequency_min;
     double frequency_max;
     union {
@@ -107,6 +108,7 @@ struct _DISCOVERED {
       } network;
 #ifdef SOAPYSDR
       struct soapy {
+        char version[128];
         int rtlsdr_count;
         int sample_rate;
         size_t rx_channels;
index 5252bdd063b4aaaa9fd24bd64751d68f746405d6..6f7c8009db052a06ca2e0012b5807dddc06dfd29 100644 (file)
@@ -298,8 +298,7 @@ fprintf(stderr,"%p Protocol=%d name=%s\n",d,d->protocol,d->name);
           break;
 #ifdef SOAPYSDR
         case SOAPYSDR_PROTOCOL:
-          sprintf(text,"%s SOAPY_SDR v%d.%d.%d USB",
-                        d->name,d->software_version/100,(d->software_version%100)/10,d->software_version%10);
+          sprintf(text,"%s (Protocol SOAPY_SDR %s) on USB",d->name,d->info.soapy.version);
           break;
 #endif
 #ifdef STEMLAB_DISCOVERY
diff --git a/ext.c b/ext.c
index 34464a8ada510adbde03a36a52cd3d2ff8bd0de3..93ffaf0c593758661bde701942c259685f151913 100644 (file)
--- a/ext.c
+++ b/ext.c
@@ -186,8 +186,10 @@ int ext_sliders_update(void *data) {
 
 #ifdef PURESIGNAL
 int ext_tx_set_ps(void *data) {
-  int state=(GPOINTER_TO_INT(data)
-  tx_set_ps(transmitter, state);
+  if(can_tranmit) {
+    int state=(GPOINTER_TO_INT(data)
+    tx_set_ps(transmitter, state);
+  }
   return 0;
 }
 #endif
@@ -220,7 +222,9 @@ int ext_set_drive(void *data) {
 }
 
 int ext_set_compression(void *data) {
-  set_compression(transmitter);
+  if(can_transmit) {
+    set_compression(transmitter);
+  }
   return 0;
 }
 
@@ -260,18 +264,22 @@ int ext_set_attenuation_value(void *data) {
 
 #ifdef PURESIGNAL
 int ext_ps_update(void *data) {
-  if(transmitter->puresignal==0) {
-    tx_set_ps(transmitter,1);
-  } else {
-    tx_set_ps(transmitter,0);
+  if(can_transmit) {
+    if(transmitter->puresignal==0) {
+      tx_set_ps(transmitter,1);
+    } else {
+      tx_set_ps(transmitter,0);
+    }
   }
   return 0;
 }
 #endif
 
 int ext_two_tone(void *data) {
-  int state=transmitter->twotone?0:1;
-  tx_set_twotone(transmitter,state);
+  if(can_transmit) {
+    int state=transmitter->twotone?0:1;
+    tx_set_twotone(transmitter,state);
+  }
   return 0;
 }
 
@@ -453,13 +461,15 @@ int ext_agc_update(void *data) {
 }
 
 int ext_split_update(void *data) {
-  split=split==1?0:1;
-  if(split) {
-    tx_set_mode(transmitter,vfo[VFO_B].mode);
-  } else {
-    tx_set_mode(transmitter,vfo[VFO_A].mode);
-  }
+  if(can_transmit) {
+    split=split==1?0:1;
+    if(split) {
+      tx_set_mode(transmitter,vfo[VFO_B].mode);
+    } else {
+      tx_set_mode(transmitter,vfo[VFO_A].mode);
+    }
   vfo_update();
+  }
   return 0;
 }
 
diff --git a/midi.h b/midi.h
index 50915a7c3c717ea640bdcd1209da508a4f2a7fac..e21cab2f609a64d28a3779e97f351e0a9af0076a 100644 (file)
--- a/midi.h
+++ b/midi.h
 //
 enum MIDIaction {
   ACTION_NONE=0,       // No-Op (unassigned key)
-  AGC,                 // AGC level
+  MIDI_AGC,                    // AGC level
   AGCATTACK,           // AGC ATTACK (cycle fast/med/slow etc.)
   ATT,                 // Step attenuator or Programmable attenuator
   AF_GAIN,             // AF gain
   BAND_DOWN,           // cycle through bands downwards
   BAND_UP,             // cycle through bands upwards
   COMPRESS,            // TX compressor value
-  CTUN,                        // CTUN on/off
+  MIDI_CTUN,                   // CTUN on/off
   FILTER_UP,           // cycle through filters upwards
   FILTER_DOWN,         // cycle through filters downwards
   MIC_VOLUME,          // MIC gain
-  LOCK,                        // disable frequency changes
+  MIDI_LOCK,                   // disable frequency changes
   MODE_UP,             // cycle through modes upwards
   MODE_DOWN,           // cycle through modes downwards
-  MOX,                 // toggle "mox" state
-  NB,                  // cycle through NoiseBlanker states (none, NB, NB2)
-  NR,                  // cycle through NoiseReduction states (none, NR, NR2)
+  MIDI_MOX,                    // toggle "mox" state
+  MIDI_NB,                     // cycle through NoiseBlanker states (none, NB, NB2)
+  MIDI_NR,                     // cycle through NoiseReduction states (none, NR, NR2)
   PRE,                 // preamp on/off
   PAN_HIGH,            // "high" value of current panadapter
   PAN_LOW,             // "low" value of current panadapter
-  PS,                  // PURESIGNAL on/off
-  RIT_CLEAR,           // clear RIT value
+  MIDI_PS,                     // PURESIGNAL on/off
+  MIDI_RIT_CLEAR,              // clear RIT value
   RIT_VAL,             // change RIT value
-  SPLIT,               // Split on/off
+  MIDI_SPLIT,          // Split on/off
   SWAP_VFO,            // swap VFO A/B frequency
-  TUNE,                        // toggle "tune" state
+  MIDI_TUNE,                   // toggle "tune" state
   TX_DRIVE,            // RF output power
   VFO,                 // change VFO frequency
   VFO_A2B,             // VFO A -> B
diff --git a/midi2.c b/midi2.c
index b23e2c56f640e9b75497671f9e67f5fde70aceac..c8f81f97a341141472c7cc60675bf738bff19d3b 100644 (file)
--- a/midi2.c
+++ b/midi2.c
@@ -92,31 +92,31 @@ static struct {
   const char *str;
 } ActionTable[] = {
         { AF_GAIN,      "AFGAIN"},
-        { AGC,          "AGC"},
+        { MIDI_AGC,     "AGC"},
        { AGCATTACK,    "AGCATTACK"},
         { ATT,          "ATT"},
         { BAND_DOWN,    "BANDDOWN"},
         { BAND_UP,      "BANDUP"},
         { COMPRESS,     "COMPRESS"},
-       { CTUN,         "CTUN"},
+       { MIDI_CTUN,    "CTUN"},
         { FILTER_DOWN,  "FILTERDOWN"},
         { FILTER_UP,    "FILTERUP"},
-       { LOCK,         "LOCK"},
+       { MIDI_LOCK,    "LOCK"},
         { MIC_VOLUME,   "MICGAIN"},
        { MODE_DOWN,    "MODEDOWN"},
        { MODE_UP,      "MODEUP"},
-        { MOX,          "MOX"},
-       { NB,           "NOISEBLANKER"},
-       { NR,           "NOISEREDUCTION"},
+        { MIDI_MOX,     "MOX"},
+       { MIDI_NB,      "NOISEBLANKER"},
+       { MIDI_NR,      "NOISEREDUCTION"},
         { PAN_HIGH,     "PANHIGH"},
         { PAN_LOW,      "PANLOW"},
         { PRE,          "PREAMP"},
-       { PS,           "PURESIGNAL"},
-        { RIT_CLEAR,    "RITCLEAR"},
+       { MIDI_PS,      "PURESIGNAL"},
+        { MIDI_RIT_CLEAR,"RITCLEAR"},
         { RIT_VAL,      "RITVAL"},
-       { SPLIT,        "SPLIT"},
+       { MIDI_SPLIT,   "SPLIT"},
        { SWAP_VFO,     "SWAPVFO"},
-        { TUNE,         "TUNE"},
+        { MIDI_TUNE,    "TUNE"},
         { TX_DRIVE,     "RFPOWER"},
         { VFO,          "VFO"},
        { VFO_A2B,      "VFOA2B"},
diff --git a/midi3.c b/midi3.c
index d96cd798b31282e11a5e0d6544b19f986d503568..7bb8f0ccf272a192cdc90cc6667f94215269e6a9 100644 (file)
--- a/midi3.c
+++ b/midi3.c
@@ -40,13 +40,13 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
                g_idle_add(ext_vfo_step, GINT_TO_POINTER(val));
            }
            break;
-       case TUNE: // only key supported
+       case MIDI_TUNE: // only key supported
            if (type == MIDI_KEY) {
                new = !tune;
                g_idle_add(ext_tune_update, GINT_TO_POINTER(new));
            }
            break;    
-       case MOX: // only key supported
+       case MIDI_MOX: // only key supported
            if (type == MIDI_KEY) {
                new = !mox;
                g_idle_add(ext_mox_update, GINT_TO_POINTER(new));
@@ -77,7 +77,7 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
            *dp=dnew;
            g_idle_add(ext_set_mic_gain, (gpointer) dp);
            break;
-       case AGC: // knob or wheel supported
+       case MIDI_AGC: // knob or wheel supported
            if (type == MIDI_KNOB) {
                dnew = -20.0 + 1.4*val;
            } else if (type == MIDI_WHEEL) {
@@ -155,7 +155,7 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
                }
            }
            break;
-       case RIT_CLEAR:  // only key supported
+       case MIDI_RIT_CLEAR:  // only key supported
            if (type == MIDI_KEY) {
                // this clears the RIT value and disables RIT
                vfo[active_receiver->id].rit = new;
@@ -217,7 +217,7 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
                    if (filter_board == ALEX && active_receiver->adc == 0) {
                      new=active_receiver->alex_attenuation + 1;
                      if (new > 3) new=0;
-                     g_idle_add(ext_set_alex_attenuation, GINT_TO_PONTER(new));
+                     g_idle_add(ext_set_alex_attenuation, GINT_TO_POINTER(new));
                      g_idle_add(ext_update_att_preamp, NULL);
                    }
                    break;
@@ -254,7 +254,7 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
            if (dnew > 0.5) transmitter->compressor=1;
            g_idle_add(ext_set_compression, NULL);
            break;
-       case NB:
+       case MIDI_NB:
            // cycle through NoiseBlanker settings
            if (active_receiver->nb) {
                active_receiver->nb = 0;
@@ -268,7 +268,7 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
            }
            g_idle_add(ext_vfo_update, NULL);
            break;
-       case NR:
+       case MIDI_NR:
            // cycle through NoiseReduction settings
            if (active_receiver->nr) {
                active_receiver->nr = 0;
@@ -287,7 +287,7 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
            vox_enabled = !vox_enabled;
            g_idle_add(ext_vfo_update, NULL);
            break;
-       case CTUN:
+       case MIDI_CTUN:
            // toggle CTUN
            new=active_receiver->id;
            if(!vfo[new].ctun) {
@@ -300,14 +300,14 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
            set_offset(active_receiver,vfo[new].offset);
            g_idle_add(ext_vfo_update, NULL);
            break;
-       case PS:
+       case MIDI_PS:
 #ifdef PURESIGNAL
            // toggle PURESIGNAL
            new=!(transmitter->puresignal);
            g_idle_add(ext_tx_set_ps,GINT_TO_POINTER(new));
 #endif
            break;
-       case SPLIT:
+       case MIDI_SPLIT:
            // toggle split mode
            if(!split) {
                split=1;
@@ -324,7 +324,7 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
        case VFO_B2A:
            g_idle_add(ext_vfo_b_to_a, NULL);
            break;
-       case LOCK:
+       case MIDI_LOCK:
            locked=!locked;
            g_idle_add(ext_vfo_update, NULL);
            break;
diff --git a/radio.c b/radio.c
index affa912132657335cacbb0c1c69b9fb21a155d88..46f938285ead5dc1ac5b85b0a9883a82e10e37a9 100644 (file)
--- a/radio.c
+++ b/radio.c
@@ -313,6 +313,8 @@ double div_phase=0.0;          // phase for diversity (in degrees, 0 ... 360)
 double meter_calibration=0.0;
 double display_calibration=0.0;
 
+int can_transmit=0;
+
 void reconfigure_radio() {
   int i;
   int y;
@@ -347,7 +349,9 @@ void reconfigure_radio() {
     }
   }
 
-  reconfigure_transmitter(transmitter,rx_height);
+  if(can_transmit) {
+    reconfigure_transmitter(transmitter,rx_height);
+  }
 
 }
 
@@ -375,6 +379,20 @@ void start_radio() {
 
   int rc;
 
+  switch(radio->protocol) {
+    case ORIGINAL_PROTOCOL:
+    case NEW_PROTOCOL:
+      can_transmit=1;
+      break;
+#ifdef SOAPYSDR
+    case SOAPYSDR_PROTOCOL:
+      can_transmit=(radio->info.soapy.tx_channels!=0);
+      break;
+#endif
+  }
+
+  g_print("start_radio: can_transmit=%d tx_channels=%d\n",can_transmit,radio->info.soapy.tx_channels);
+
 #ifdef MIDI
   MIDIstartup();
 #endif
@@ -771,17 +789,18 @@ void start_radio() {
   active_receiver=receiver[0];
 
   //fprintf(stderr,"Create transmitter\n");
-  transmitter=create_transmitter(CHANNEL_TX, buffer_size, fft_size, updates_per_second, display_width, tx_height);
-  transmitter->x=0;
-  transmitter->y=VFO_HEIGHT;
-  //gtk_fixed_put(GTK_FIXED(fixed),transmitter->panel,0,VFO_HEIGHT);
+  if(can_transmit) {
+    transmitter=create_transmitter(CHANNEL_TX, buffer_size, fft_size, updates_per_second, display_width, tx_height);
+    transmitter->x=0;
+    transmitter->y=VFO_HEIGHT;
 
 #ifdef PURESIGNAL
-  tx_set_ps_sample_rate(transmitter,protocol==NEW_PROTOCOL?192000:active_receiver->sample_rate);
-  receiver[PS_TX_FEEDBACK]=create_pure_signal_receiver(PS_TX_FEEDBACK, buffer_size,protocol==ORIGINAL_PROTOCOL?active_receiver->sample_rate:192000,display_width);
-  receiver[PS_RX_FEEDBACK]=create_pure_signal_receiver(PS_RX_FEEDBACK, buffer_size,protocol==ORIGINAL_PROTOCOL?active_receiver->sample_rate:192000,display_width);
-  SetPSHWPeak(transmitter->id, protocol==ORIGINAL_PROTOCOL? 0.4067 : 0.2899);
+    tx_set_ps_sample_rate(transmitter,protocol==NEW_PROTOCOL?192000:active_receiver->sample_rate);
+    receiver[PS_TX_FEEDBACK]=create_pure_signal_receiver(PS_TX_FEEDBACK, buffer_size,protocol==ORIGINAL_PROTOCOL?active_receiver->sample_rate:192000,display_width);
+    receiver[PS_RX_FEEDBACK]=create_pure_signal_receiver(PS_RX_FEEDBACK, buffer_size,protocol==ORIGINAL_PROTOCOL?active_receiver->sample_rate:192000,display_width);
+    SetPSHWPeak(transmitter->id, protocol==ORIGINAL_PROTOCOL? 0.4067 : 0.2899);
 #endif
+  }
 
 #ifdef AUDIO_WATERFALL
   audio_waterfall=audio_waterfall_init(200,100);
@@ -871,10 +890,11 @@ void start_radio() {
     launch_rigctl();
   }
 
-  calcDriveLevel();
-
-  if(transmitter->puresignal) {
-    tx_set_ps(transmitter,transmitter->puresignal);
+  if(can_transmit) {
+    calcDriveLevel();
+    if(transmitter->puresignal) {
+      tx_set_ps(transmitter,transmitter->puresignal);
+    }
   }
 
   if(protocol==NEW_PROTOCOL) {
@@ -885,7 +905,7 @@ void start_radio() {
   if(protocol==SOAPYSDR_PROTOCOL) {
     RECEIVER *rx=receiver[0];
     soapy_protocol_create_receiver(rx);
-    if(transmitter!=NULL) {
+    if(can_transmit) {
       soapy_protocol_create_transmitter(transmitter);
       soapy_protocol_set_tx_antenna(transmitter,dac[0].antenna);
       for(int i=0;i<radio->info.soapy.tx_gains;i++) {
@@ -1049,6 +1069,7 @@ static void rxtx(int state) {
 }
 
 void setMox(int state) {
+  if(!can_transmit) return;
   vox_cancel();  // remove time-out
   if(mox!=state) {
     if (state && vox) {
@@ -1136,6 +1157,8 @@ void frequency_changed(RECEIVER *rx) {
 void setTune(int state) {
   int i;
 
+  if(!can_transmit) return;
+
   // if state==tune, this function is a no-op
 
   if(tune!=state) {
@@ -1870,7 +1893,9 @@ fprintf(stderr,"sem_wait: returned\n");
     // the alex_antenna an the adc
     receiver_save_state(receiver[PS_RX_FEEDBACK]);
 #endif
-    transmitter_save_state(transmitter);
+    if(can_transmit) {
+      transmitter_save_state(transmitter);
+    }
 #ifdef FREEDV
     freedv_save_state();
 #endif
diff --git a/radio.h b/radio.h
index 85a7431320722b5f04da5be53636ec1980865a13..7a7f80161e85dfef90eb76d7cfa33d5e3f7432b8 100644 (file)
--- a/radio.h
+++ b/radio.h
@@ -261,6 +261,8 @@ extern double div_gain, div_phase;
 extern double meter_calibration;
 extern double display_calibration;
 
+extern int can_transmit;
+
 extern void reconfigure_radio();
 extern void start_radio();
 //extern void init_radio();
index 57bbb8e67c7ab977b7553c4572cc9a8772213e5f..26d5ab3b2d7943ac26080efbd4aa1e0ba32facb3 100644 (file)
@@ -581,16 +581,18 @@ void radio_menu(GtkWidget *parent) {
       gtk_grid_attach(GTK_GRID(grid),agc,col,row,1,1);
       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(agc),adc[0].agc);
       g_signal_connect(agc,"toggled",G_CALLBACK(agc_changed_cb),&adc[0]);
-      col++;
+      row++;
     }
 
     row=temp_row;
 
-    if(radio->info.soapy.tx_gains>0) {
-      col=2;
-      GtkWidget *tx_gain=gtk_label_new("Tx Gains:");
-      gtk_grid_attach(GTK_GRID(grid),tx_gain,col,row,1,1);
-      row++;
+    if(can_transmit) {
+      if(radio->info.soapy.tx_gains>0) {
+        col=2;
+        GtkWidget *tx_gain=gtk_label_new("Tx Gains:");
+        gtk_grid_attach(GTK_GRID(grid),tx_gain,col,row,1,1);
+        row++;
+      }
     }
 
     temp_row=row;
@@ -615,21 +617,23 @@ void radio_menu(GtkWidget *parent) {
 
     row=temp_row;
 
-    for(i=0;i<radio->info.soapy.tx_gains;i++) {
-      col=2;
-      GtkWidget *tx_gain_label=gtk_label_new(radio->info.soapy.tx_gain[i]);
-      gtk_grid_attach(GTK_GRID(grid),tx_gain_label,col,row,1,1);
-      col++;
-      SoapySDRRange range=radio->info.soapy.tx_range[i];
-      if(range.step==0.0) {
-        range.step=1.0;
+    if(can_transmit) {
+      for(i=0;i<radio->info.soapy.tx_gains;i++) {
+        col=2;
+        GtkWidget *tx_gain_label=gtk_label_new(radio->info.soapy.tx_gain[i]);
+        gtk_grid_attach(GTK_GRID(grid),tx_gain_label,col,row,1,1);
+        col++;
+        SoapySDRRange range=radio->info.soapy.tx_range[i];
+        if(range.step==0.0) {
+          range.step=1.0;
+        }
+        GtkWidget *tx_gain_b=gtk_spin_button_new_with_range(range.minimum,range.maximum,range.step);
+        gtk_widget_set_name (tx_gain_b, radio->info.soapy.tx_gain[i]);
+        gtk_spin_button_set_value(GTK_SPIN_BUTTON(tx_gain_b),(double)dac[0].tx_gain[i]);
+        gtk_grid_attach(GTK_GRID(grid),tx_gain_b,col,row,1,1);
+        g_signal_connect(tx_gain_b,"value_changed",G_CALLBACK(tx_gain_value_changed_cb),&dac[0]);
+        row++;
       }
-      GtkWidget *tx_gain_b=gtk_spin_button_new_with_range(range.minimum,range.maximum,range.step);
-      gtk_widget_set_name (tx_gain_b, radio->info.soapy.tx_gain[i]);
-      gtk_spin_button_set_value(GTK_SPIN_BUTTON(tx_gain_b),(double)dac[0].tx_gain[i]);
-      gtk_grid_attach(GTK_GRID(grid),tx_gain_b,col,row,1,1);
-      g_signal_connect(tx_gain_b,"value_changed",G_CALLBACK(tx_gain_value_changed_cb),&dac[0]);
-      row++;
     }
 
   }
index 54c64fdc61909cb56d7c5a6901b7910b7da02456..7c46202c2ed5d3f83842f7a7b6ecfd02d292c115 100644 (file)
@@ -32,11 +32,20 @@ static void get_info(char *driver) {
   size_t rx_rates_length, tx_rates_length, rx_gains_length, tx_gains_length, ranges_length, rx_antennas_length, tx_antennas_length, rx_bandwidth_length, tx_bandwidth_length;
   int i;
   SoapySDRKwargs args={};
-  int version=0;
+  int software_version=0;
   int rtlsdr_val=0;
+  char fw_version[64];
+  char gw_version[64];
+  char hw_version[64];
+  char p_version[64];
 
   fprintf(stderr,"soapy_discovery: get_info: %s\n", driver);
 
+  strcpy(fw_version,"");
+  strcpy(gw_version,"");
+  strcpy(hw_version,"");
+  strcpy(p_version,"");
+
   SoapySDRKwargs_set(&args, "driver", driver);
   if(strcmp(driver,"rtlsdr")==0) {
     char count[16];
@@ -47,7 +56,7 @@ static void get_info(char *driver) {
   }
   SoapySDRDevice *sdr = SoapySDRDevice_make(&args);
   SoapySDRKwargs_clear(&args);
-  version=0;
+  software_version=0;
 
   char *driverkey=SoapySDRDevice_getDriverKey(sdr);
   fprintf(stderr,"DriverKey=%s\n",driverkey);
@@ -59,13 +68,17 @@ static void get_info(char *driver) {
   for(i=0;i<info.size;i++) {
     fprintf(stderr,"soapy_discovery: hardware info key=%s val=%s\n",info.keys[i], info.vals[i]);
     if(strcmp(info.keys[i],"firmwareVersion")==0) {
-      version+=atoi(info.vals[i])*100;
+      strcpy(fw_version,info.vals[i]);
+    }
+    if(strcmp(info.keys[i],"gatewareVersion")==0) {
+      strcpy(gw_version,info.vals[i]);
+      software_version=(int)(atof(info.vals[i])*100.0);
     }
     if(strcmp(info.keys[i],"hardwareVersion")==0) {
-      version+=atoi(info.vals[i])*10;
+      strcpy(hw_version,info.vals[i]);
     }
     if(strcmp(info.keys[i],"protocolVersion")==0) {
-      version+=atoi(info.vals[i]);
+      strcpy(p_version,info.vals[i]);
     }
   }
 
@@ -178,8 +191,9 @@ static void get_info(char *driver) {
     discovered[devices].supported_receivers=rx_channels;
     discovered[devices].supported_transmitters=tx_channels;
     discovered[devices].adcs=rx_channels;
+    discovered[devices].dacs=tx_channels;
     discovered[devices].status=STATE_AVAILABLE;
-    discovered[devices].software_version=version;
+    discovered[devices].software_version=software_version;
     discovered[devices].frequency_min=ranges[0].minimum;
     discovered[devices].frequency_max=ranges[0].maximum;
     discovered[devices].info.soapy.sample_rate=sample_rate;
@@ -188,6 +202,11 @@ static void get_info(char *driver) {
     } else {
       discovered[devices].info.soapy.rtlsdr_count=0;
     }
+    if(strcmp(driver,"lime")==0) {
+      sprintf(discovered[devices].info.soapy.version,"fw=%s gw=%s hw=%s p=%s", fw_version, gw_version, hw_version, p_version);
+    } else {
+      strcpy(discovered[devices].info.soapy.version,"");
+    }
     discovered[devices].info.soapy.rx_channels=rx_channels;
     discovered[devices].info.soapy.rx_gains=rx_gains_length;
     discovered[devices].info.soapy.rx_gain=rx_gains;
index 1104bb817ec738300c64737712bfe2facd7990e3..b66e28fd2defdf6733124cfb1ba057ac0fbb69b5 100644 (file)
@@ -243,10 +243,12 @@ fprintf(stderr,"soapy_protocol_init: SoapySDRDevice_make\n");
   }
   SoapySDRKwargs_clear(&args);
 
-  if(transmitter->local_microphone) {
-    if(audio_open_input()!=0) {
-      fprintf(stderr,"audio_open_input failed\n");
-      transmitter->local_microphone=0;
+  if(can_transmit) {
+    if(transmitter->local_microphone) {
+      if(audio_open_input()!=0) {
+        fprintf(stderr,"audio_open_input failed\n");
+        transmitter->local_microphone=0;
+      }
     }
   }
 
index f7674868563f9f3972cda56045d50d13ef2021bf..a79f5a758d5363d46f800d182ecf59b2010c182c 100644 (file)
@@ -576,6 +576,7 @@ TRANSMITTER *create_transmitter(int id, int buffer_size, int fft_size, int fps,
       tx->iq_output_rate=radio_sample_rate;
       tx->buffer_size=1024;
       tx->output_samples=1024*(tx->iq_output_rate/tx->mic_sample_rate);
+      tx->pixels=width*8; // to allow 384k to 24k conversion
       break;
 #endif
 
diff --git a/vfo.c b/vfo.c
index 7f558ef390625a20fbd701f5cef7f6c58bfa67d6..38555daa23b75b2ce2722ac0e06bddf25d554ef8 100644 (file)
--- a/vfo.c
+++ b/vfo.c
@@ -200,7 +200,11 @@ void vfo_restore_state() {
 
     vfo[i].band=band20;
     vfo[i].bandstack=0;
-    vfo[i].frequency=14010000;
+    if(radio->protocol==SOAPYSDR_PROTOCOL) {
+      vfo[i].frequency=144010000;
+    } else {
+      vfo[i].frequency=14010000;
+    }
     vfo[i].mode=modeCWU;
     vfo[i].filter=6;
     vfo[i].lo=0;
@@ -293,7 +297,9 @@ void vfo_band_changed(int b) {
       receiver_vfo_changed(receiver[id]);
       BAND *band=band_get_band(vfo[id].band);
       set_alex_rx_antenna(band->alexRxAntenna);
-      set_alex_tx_antenna(band->alexTxAntenna);
+      if(can_transmit) {
+        set_alex_tx_antenna(band->alexTxAntenna);
+      }
       set_alex_attenuation(band->alexAttenuation);
       receiver_vfo_changed(receiver[0]);
       break;
@@ -304,17 +310,19 @@ void vfo_band_changed(int b) {
       break;
   }
 
-  if(split) {
-    tx_set_mode(transmitter,vfo[VFO_B].mode);
-  } else {
-    tx_set_mode(transmitter,vfo[VFO_A].mode);
+  if(can_transmit) {
+    if(split) {
+      tx_set_mode(transmitter,vfo[VFO_B].mode);
+    } else {
+      tx_set_mode(transmitter,vfo[VFO_A].mode);
+    }
+    //
+    // If the band has changed, it is necessary to re-calculate
+    // the drive level. Furthermore, possibly the "PA disable"
+    // status has changed.
+    //
+    calcDriveLevel();  // sends HighPrio packet if in new protocol
   }
-  //
-  // If the band has changed, it is necessary to re-calculate
-  // the drive level. Furthermore, possibly the "PA disable"
-  // status has changed.
-  //
-  calcDriveLevel();  // sends HighPrio packet if in new protocol
   if (protocol == NEW_PROTOCOL) {
     schedule_general();
   }
@@ -351,10 +359,12 @@ void vfo_bandstack_changed(int b) {
       break;
   }
 
-  if(split) {
-    tx_set_mode(transmitter,vfo[VFO_B].mode);
-  } else {
-    tx_set_mode(transmitter,vfo[VFO_A].mode);
+  if(can_transmit) {
+    if(split) {
+      tx_set_mode(transmitter,vfo[VFO_B].mode);
+    } else {
+      tx_set_mode(transmitter,vfo[VFO_A].mode);
+    }
   }
   //
   // I do not think the band can change within this function.
@@ -396,10 +406,12 @@ void vfo_mode_changed(int m) {
       }
       break;
   }
-  if(split) {
-    tx_set_mode(transmitter,vfo[VFO_B].mode);
-  } else {
-    tx_set_mode(transmitter,vfo[VFO_A].mode);
+  if(can_transmit) {
+    if(split) {
+      tx_set_mode(transmitter,vfo[VFO_B].mode);
+    } else {
+      tx_set_mode(transmitter,vfo[VFO_A].mode);
+    }
   }
   //
   // changing modes may change BFO frequency
@@ -447,8 +459,10 @@ void vfo_a_to_b() {
   if(receivers==2) {
     receiver_vfo_changed(receiver[1]);
   }
-  if(split) {
-    tx_set_mode(transmitter,vfo[VFO_B].mode);
+  if(can_transmit) {
+    if(split) {
+      tx_set_mode(transmitter,vfo[VFO_B].mode);
+    }
   }
   g_idle_add(ext_vfo_update,NULL);
 }
@@ -464,8 +478,10 @@ void vfo_b_to_a() {
   vfo[VFO_A].rit_enabled=vfo[VFO_B].rit_enabled;
   vfo[VFO_A].rit=vfo[VFO_B].rit;
   receiver_vfo_changed(receiver[0]);
-  if(!split) {
-    tx_set_mode(transmitter,vfo[VFO_B].mode);
+  if(can_transmit) {
+    if(!split) {
+      tx_set_mode(transmitter,vfo[VFO_B].mode);
+    }
   }
   g_idle_add(ext_vfo_update,NULL);
 }
@@ -515,10 +531,12 @@ void vfo_a_swap_b() {
   if(receivers==2) {
     receiver_vfo_changed(receiver[1]);
   }
-  if(split) {
-    tx_set_mode(transmitter,vfo[VFO_B].mode);
-  } else {
-    tx_set_mode(transmitter,vfo[VFO_A].mode);
+  if(can_transmit) {
+    if(split) {
+      tx_set_mode(transmitter,vfo[VFO_B].mode);
+    } else {
+      tx_set_mode(transmitter,vfo[VFO_A].mode);
+    }
   }
   g_idle_add(ext_vfo_update,NULL);
 }
@@ -840,15 +858,17 @@ void vfo_update() {
        // Since we can now change it by a MIDI controller,
        // we should display the compressor (level)
        //
-        cairo_move_to(cr, 400, 50);  
-       if (transmitter->compressor) {
-           sprintf(temp_text,"CMPR %d dB",(int) transmitter->compressor_level);
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
-            cairo_show_text(cr, temp_text);
-       } else {
-            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
-            cairo_show_text(cr, "CMPR OFF");
-       }
+        if(can_transmit) {
+          cairo_move_to(cr, 400, 50);  
+         if (transmitter->compressor) {
+             sprintf(temp_text,"CMPR %d dB",(int) transmitter->compressor_level);
+              cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+              cairo_show_text(cr, temp_text);
+         } else {
+              cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+              cairo_show_text(cr, "CMPR OFF");
+         }
+        }
 
         cairo_move_to(cr, 500, 50);  
         if(diversity_enabled) {
@@ -914,13 +934,15 @@ void vfo_update() {
         cairo_show_text(cr, "Split");
 
 #ifdef PURESIGNAL
-        cairo_move_to(cr, 105, 50);
-        if(transmitter->puresignal) {
-          cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
-        } else {
-          cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+        if(can_transmit) {
+          cairo_move_to(cr, 105, 50);
+          if(transmitter->puresignal) {
+            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+          } else {
+            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+          }
+          cairo_show_text(cr, "PS");
         }
-        cairo_show_text(cr, "PS");
 #endif