]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Improved operation of the "frames per second" setting.
authorsq8mvy <sq8mvy@gmail.com>
Wed, 18 Mar 2020 00:06:16 +0000 (01:06 +0100)
committersq8mvy <sq8mvy@gmail.com>
Wed, 18 Mar 2020 00:06:16 +0000 (01:06 +0100)
display_menu.c
radio.c
receiver.c

index 995ff72f977fad705afd5b0aa44dbae2ae1809c3..2097ffbb6ba59207d114e5909dd269911fe43ae4 100644 (file)
@@ -79,7 +79,9 @@ static void filled_cb(GtkWidget *widget, gpointer data) {
 
 static void frames_per_second_value_changed_cb(GtkWidget *widget, gpointer data) {
   updates_per_second=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+  active_receiver->fps=updates_per_second;
   calculate_display_average(active_receiver);
+  set_displaying(active_receiver, 1);
 }
 
 static void panadapter_high_value_changed_cb(GtkWidget *widget, gpointer data) {
diff --git a/radio.c b/radio.c
index 1b822109c5639d3ed78c7f65e3e3cef5a13bed13..e4536f7507ce1c3ceaf09291f7cd84a2602cecc8 100644 (file)
--- a/radio.c
+++ b/radio.c
@@ -2325,7 +2325,7 @@ void calculate_display_average(RECEIVER *rx) {
 
   double t=0.001*display_average_time;
   display_avb = exp(-1.0 / ((double)rx->fps * t));
-  display_average = max(2, (int)min(60, (double)rx->fps * t));
+  display_average = max(2, (int)fmin(60, (double)rx->fps * t));
   SetDisplayAvBackmult(rx->id, 0, display_avb);
   SetDisplayNumAverage(rx->id, 0, display_average);
 }
index 583cc325dcc05c307edef9d32fbe0e5e55834229..dc6694ed451cf04764bc4df4231c018135d6d977 100644 (file)
@@ -589,7 +589,8 @@ static gint update_display(gpointer data) {
 void set_displaying(RECEIVER *rx,int state) {
   rx->displaying=state;
   if(state) {
-    rx->update_timer_id=gdk_threads_add_timeout_full(G_PRIORITY_HIGH_IDLE,1000/rx->fps, update_display, rx, NULL);
+    if(rx->update_timer_id>=0) g_source_remove(rx->update_timer_id);
+    rx->update_timer_id=g_timeout_add_full(G_PRIORITY_HIGH_IDLE,1000/rx->fps, update_display, rx, NULL);
   } else {
     rx->update_timer_id=-1;
   }
@@ -690,7 +691,7 @@ static void init_analyzer(RECEIVER *rx) {
 
     int max_w = fft_size + (int) min(keep_time * (double) rx->fps, keep_time * (double) fft_size * (double) rx->fps);
 
-    overlap = (int)max(0.0, ceil(fft_size - (double)rx->sample_rate / (double)rx->fps));
+    overlap = (int)fmax(0.0, ceil(fft_size - (double)rx->sample_rate / (double)rx->fps));
 
     //g_print("SetAnalyzer id=%d buffer_size=%d overlap=%d\n",rx->id,rx->buffer_size,overlap);