]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
move the nb time conversion multipliers elsewhere
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Sun, 21 Aug 2022 10:56:27 +0000 (16:26 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Sun, 21 Aug 2022 10:56:27 +0000 (16:26 +0530)
nb_menu.c
noise_menu.c
radio.c

index 3b070ed40ee4aa537a2be6b5361b8d6f6ab4f976..077bcde9353f01cfcc44718a8bad44c77c8459f5 100644 (file)
--- a/nb_menu.c
+++ b/nb_menu.c
@@ -64,26 +64,26 @@ static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_d
 }
 
 static void nb_lag_time_value_changed_cb(GtkWidget *widget, gpointer data) {
-    nb_lag_time = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
-    nb_lag_time *= 0.001; // convert ms to sec
+    nb_lag_time = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
+    //nb_lag_time *= 0.001; // convert ms to sec
     nb_changed();
 }
 
 static void nb_lead_time_value_changed_cb(GtkWidget *widget, gpointer data) {
-    nb_lead_time = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
-    nb_lead_time *= 0.001;
+    nb_lead_time = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
+    //nb_lead_time *= 0.001;
     nb_changed();
 }
 
 static void nb_transition_time_value_changed_cb(GtkWidget *widget, gpointer data) {
-    nb_transition_time = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
-    nb_transition_time *= 0.001; // ms to s
+    nb_transition_time = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
+    //nb_transition_time *= 0.001; // ms to s
     nb_changed();
 }
 
 static void nb_threshold_value_changed_cb(GtkWidget *widget, gpointer data) {
-    nb_threshold_value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
-    nb_threshold_value *= 0.165;
+    nb_threshold_value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
+    // nb_threshold_value *= 0.165;
     nb_changed();
 }
 
index 2cf97a35201a63d065712e9c4fe4c2bf8c485a99..c23859037ff147695bdcd55a12b58b653f19d7fc 100644 (file)
@@ -63,10 +63,10 @@ static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_d
 }
 
 void update_nb() {
-    SetEXTANBHangtime(active_receiver->id, nb_lag_time);
-    SetEXTANBAdvtime(active_receiver->id, nb_lead_time);
-    SetEXTANBTau(active_receiver->id, nb_transition_time);
-    SetEXTANBThreshold(active_receiver->id, nb_threshold_value);
+    SetEXTANBHangtime(active_receiver->id, nb_lag_time*0.001);
+    SetEXTANBAdvtime(active_receiver->id, nb_lead_time*0.001);
+    SetEXTANBTau(active_receiver->id, nb_transition_time*0.001);
+    SetEXTANBThreshold(active_receiver->id, nb_threshold_value*0.165);
 }
 
 void update_nb2() {
diff --git a/radio.c b/radio.c
index 1252e2758674cd2787081ba17751a9a555b5c3f4..2ae50219fd6600d2914af43fc6a191142b065c12 100644 (file)
--- a/radio.c
+++ b/radio.c
@@ -2764,13 +2764,19 @@ void radioSaveState() {
 #endif
 
   // nb values
-  sprintf(value, "%f", nb_lag_time);
+  sprintf(value, "%1.4f", nb_lag_time);
+  fprintf(stderr, "saving nb_lag_time: %s\n", value);
   setProperty("nb_lag_time", value);
-  sprintf(value, "%f", nb_lead_time);
+
+  sprintf(value, "%1.4f", nb_lead_time);
+  fprintf(stderr, "saving nb_lead_time: %s\n", value);
   setProperty("nb_lead_time", value);
-  sprintf(value, "%f", nb_transition_time);
+
+  sprintf(value, "%1.4f", nb_transition_time);
+  fprintf(stderr, "saving nb_transition_time: %s\n", value);
   setProperty("nb_transition_time", value);
-  sprintf(value, "%f", (nb_threshold_value/0.165));
+
+  sprintf(value, "%1.4f", (nb_threshold_value));
   setProperty("nb_threshold_value", value);
 
   sprintf(value, "%d", nb2_mode);