]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Calculate AGC panadapter lines upon radio start, and whenever
authorc vw <dl1ycf@darc.de>
Mon, 19 Oct 2020 17:50:19 +0000 (19:50 +0200)
committerc vw <dl1ycf@darc.de>
Mon, 19 Oct 2020 17:50:19 +0000 (19:50 +0200)
they may change (changing sample rate or Hang threshold)

dsp_menu.c
receiver.c

index c02b631e7ff1e4927286fe2ca689186241b9b3e0..ca036705e97489d73889661bac88cc35c1d788e3 100644 (file)
@@ -60,6 +60,10 @@ static void agc_hang_threshold_value_changed_cb(GtkWidget *widget, gpointer data
   active_receiver->agc_hang_threshold=(int)gtk_range_get_value(GTK_RANGE(widget));
   if(active_receiver->agc==AGC_LONG || active_receiver->agc==AGC_SLOW) {
     SetRXAAGCHangThreshold(active_receiver->id, (int)active_receiver->agc_hang_threshold);
+    //
+    // recalculate position of hang line for panadapter
+    //
+    GetRXAAGCHangLevel(active_receiver->id, &active_receiver->agc_hang);
   }
 }
 
index 3fd94e49a06b29fe3eac7a5c35ffedfc0a50a589..ee485bfeb7c5431b56d2591d7bdffa4477c37862 100644 (file)
@@ -716,6 +716,13 @@ void set_agc(RECEIVER *rx, int agc) {
       SetRXAAGCHangThreshold(rx->id,100);
       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.
+  // 
+  GetRXAAGCHangLevel(rx->id, &rx->agc_hang);
+  GetRXAAGCThresh(rx->id, &rx->agc_thresh, 4096.0, (double)rx->sample_rate);
 }
 
 void set_offset(RECEIVER *rx,long long offset) {
@@ -1203,6 +1210,10 @@ g_print("receiver_change_sample_rate: id=%d rate=%d scale=%d buffer_size=%d outp
     return;
   }
 #endif
+  //
+  // re-calculate AGC line for panadapter since it depends on sample rate
+  //
+  GetRXAAGCThresh(rx->id, &rx->agc_thresh, 4096.0, (double)rx->sample_rate);
   if (rx->audio_output_buffer != NULL) {
     g_free(rx->audio_output_buffer);
   }