]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Some cosmetics to facilitate merging.
authorc vw <dl1ycf@darc.de>
Thu, 25 Nov 2021 08:30:12 +0000 (09:30 +0100)
committerc vw <dl1ycf@darc.de>
Thu, 25 Nov 2021 08:30:12 +0000 (09:30 +0100)
new_menu.c
new_protocol.c
old_protocol.c
radio_menu.c
receiver.c

index 2f29aaeec487091fda164a3805979af2bf69f204..164e837b1bd5d49bc485219a79bee37d93e2040a 100644 (file)
@@ -492,9 +492,8 @@ void new_menu()
     gtk_grid_attach(GTK_GRID(grid),close_b,0,0,2,1);
 
     //
-    // The "Restart" restarts the protocol
+    // The "Restart" button restarts the protocol
     // This may help to recover from certain error conditions
-    // At the moment I do not know how to do this for SOAPY
     //
 #ifdef SOAPYSDR
     if (protocol != SOAPYSDR_PROTOCOL)
index 0341ccadbf465520d287458ad88631d12d925b4e..9b855f56fd90d3a827bc3ec31e3cd194e9deb749 100644 (file)
@@ -75,8 +75,8 @@
 #define RXACTION_PS     2    // deliver 2*119 samples to PS engine
 #define RXACTION_DIV    3    // take 2*119 samples, mix them, deliver to a receiver
 
-static int rxcase[8];
-static int rxid  [8];
+static int rxcase[7/*MAX_DDC*/];
+static int rxid  [7/*MAX_DDC*/];
 
 int data_socket=-1;
 
@@ -109,8 +109,8 @@ static int audio_addr_length;
 static struct sockaddr_in iq_addr;
 static int iq_addr_length;
 
-static struct sockaddr_in data_addr[8];
-static int data_addr_length[8];
+static struct sockaddr_in data_addr[7/*MAX_DDC*/];
+static int data_addr_length[7/*MAX_DDC*/];
 
 static GThread *new_protocol_thread_id;
 static GThread *new_protocol_timer_thread_id;
@@ -119,7 +119,7 @@ static long high_priority_sequence = 0;
 static long general_sequence = 0;
 static long rx_specific_sequence = 0;
 static long tx_specific_sequence = 0;
-static long ddc_sequence[8];
+static long ddc_sequence[7/*MAX_DDC*/];
 
 //static int buffer_size=BUFFER_SIZE;
 //static int fft_size=4096;
@@ -175,13 +175,13 @@ static sem_t mic_line_sem_buffer;
 #endif
 static GThread *mic_line_thread_id;
 #ifdef __APPLE__
-static sem_t *iq_sem_ready[8];
-static sem_t *iq_sem_buffer[8];
+static sem_t *iq_sem_ready[7/*MAX_DDC*/];
+static sem_t *iq_sem_buffer[7/*MAX_DDC*/];
 #else
-static sem_t iq_sem_ready[8];
-static sem_t iq_sem_buffer[8];
+static sem_t iq_sem_ready[7/*MAX_DDC*/];
+static sem_t iq_sem_buffer[7/*MAX_DDC*/];
 #endif
-static GThread *iq_thread_id[8];
+static GThread *iq_thread_id[7/*MAX_DDC*/];
 
 #ifdef INCLUDED
 static int outputsamples;
@@ -241,7 +241,7 @@ static mybuffer *buflist = NULL;
 //
 // The buffers used by new_protocol_thread
 //
-static mybuffer *iq_buffer[8];
+static mybuffer *iq_buffer[7/*MAX_DDC*/];
 static mybuffer *command_response_buffer;
 static mybuffer *high_priority_buffer;
 static mybuffer *mic_line_buffer;
@@ -265,7 +265,7 @@ static pthread_mutex_t rx_spec_mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t tx_spec_mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t hi_prio_mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t general_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t audio_mutex   = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t audio_buffer_mutex  = PTHREAD_MUTEX_INITIALIZER;
 
 static int local_ptt=0;
 
@@ -2002,7 +2002,7 @@ void new_protocol_cw_audio_samples(short left_audio_sample,short right_audio_sam
     //
     // Only process samples if transmitting in CW
     //
-    pthread_mutex_lock(&audio_mutex);
+    pthread_mutex_lock(&audio_buffer_mutex);
     // insert the samples
     audiobuffer[audioindex++]=left_audio_sample>>8;
     audiobuffer[audioindex++]=left_audio_sample;
@@ -2024,7 +2024,7 @@ void new_protocol_cw_audio_samples(short left_audio_sample,short right_audio_sam
       audioindex=4;
       audiosequence++;
     }
-    pthread_mutex_unlock(&audio_mutex);
+    pthread_mutex_unlock(&audio_buffer_mutex);
   }
 }
 
@@ -2037,7 +2037,7 @@ void new_protocol_audio_samples(RECEIVER *rx,short left_audio_sample,short right
   //
   if (isTransmitting() && (txmode==modeCWU || txmode==modeCWL)) return;
 
-  pthread_mutex_lock(&audio_mutex);
+  pthread_mutex_lock(&audio_buffer_mutex);
   // insert the samples
   audiobuffer[audioindex++]=left_audio_sample>>8;
   audiobuffer[audioindex++]=left_audio_sample;
@@ -2061,7 +2061,7 @@ void new_protocol_audio_samples(RECEIVER *rx,short left_audio_sample,short right
     audioindex=4;
     audiosequence++;
   }
-  pthread_mutex_unlock(&audio_mutex);
+  pthread_mutex_unlock(&audio_buffer_mutex);
 }
 
 void new_protocol_flush_iq_samples() {
index 1c80355edd22f92dd75bf5ff62a497c4015bdd88..72e581b712b521ef93ca5f061fa9e2af0e92e53b 100644 (file)
@@ -1147,13 +1147,6 @@ static void process_ozy_input_buffer(unsigned char  *buffer) {
 // that are called both by the RX and TX thread, and are filling and sending the
 // output buffer.
 //
-// In 99% if the cases, the check on isTransmitting() controls that only one
-// of the functions becomes active, but at the moment of a RX/TX transition
-// this may fail.
-//
-// So "blocking" can only occur very rarely, such that the lock/unlock
-// should cost only few CPU cycles.
-//
 
 static pthread_mutex_t send_buffer_mutex   = PTHREAD_MUTEX_INITIALIZER;
 
index c0acbcb83c6486daac39b391e61b4c70af71ceb1..f142b1729d10b55777333d2db29e7b5921b819d1 100644 (file)
@@ -845,20 +845,20 @@ void radio_menu(GtkWidget *parent) {
     GtkWidget *rx_gain_label=gtk_label_new(NULL);
     gtk_label_set_markup(GTK_LABEL(rx_gain_label), "<b>RX Gain Calibration:</b>");
     gtk_grid_attach(GTK_GRID(grid),rx_gain_label,col,row,1,1);
+
     col++;
-    
     GtkWidget *rx_gain_calibration_b=gtk_spin_button_new_with_range(-50.0,50.0,1.0);
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(rx_gain_calibration_b),(double)rx_gain_calibration);
     gtk_grid_attach(GTK_GRID(grid),rx_gain_calibration_b,col,row,1,1);
     g_signal_connect(rx_gain_calibration_b,"value_changed",G_CALLBACK(rx_gain_calibration_value_changed_cb),NULL);
-    col++;
+  }
 
-    GtkWidget *PA_enable_b=gtk_check_button_new_with_label("PA enable");
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (PA_enable_b), pa_enabled);
-    gtk_grid_attach(GTK_GRID(grid),PA_enable_b,col,row,1,1);
-    g_signal_connect(PA_enable_b,"toggled",G_CALLBACK(PA_enable_cb),NULL);
+  col++;
+  GtkWidget *PA_enable_b=gtk_check_button_new_with_label("PA enable");
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (PA_enable_b), pa_enabled);
+  gtk_grid_attach(GTK_GRID(grid),PA_enable_b,col,row,1,1);
+  g_signal_connect(PA_enable_b,"toggled",G_CALLBACK(PA_enable_cb),NULL);
 
-  }
   row++;
 
   if(row>temp_row) temp_row=row;
index e51d18b8c949d33f89799943535fa4f00d6bc8f5..1b29c733994b3d1f5287f6f41d8ca8a9ee5c8c6a 100644 (file)
@@ -738,10 +738,8 @@ void set_agc(RECEIVER *rx) {
       break;
   }
   //
-  // Determine the "panadapter" AGC line positions. These are re-calculated
-  // the first time the AGC slider is moved, but we need correct values 
-  // until then.
-  // 
+  // Recalculate the "panadapter" AGC line positions.
+  //
   GetRXAAGCHangLevel(rx->id, &rx->agc_hang);
   GetRXAAGCThresh(rx->id, &rx->agc_thresh, 4096.0, (double)rx->sample_rate);
 }