From: c vw Date: Mon, 19 Oct 2020 17:50:19 +0000 (+0200) Subject: Calculate AGC panadapter lines upon radio start, and whenever X-Git-Url: https://git.rkrishnan.org/simplejson/htmlfontify-example.html?a=commitdiff_plain;h=a8b6883b4bda95c4e18ff20d886cb99d1f1fdcb8;p=pihpsdr.git Calculate AGC panadapter lines upon radio start, and whenever they may change (changing sample rate or Hang threshold) --- diff --git a/dsp_menu.c b/dsp_menu.c index c02b631..ca03670 100644 --- a/dsp_menu.c +++ b/dsp_menu.c @@ -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); } } diff --git a/receiver.c b/receiver.c index 3fd94e4..ee485bf 100644 --- a/receiver.c +++ b/receiver.c @@ -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); }