]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
save/restore nb menu values
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Sun, 21 Aug 2022 09:58:43 +0000 (15:28 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Sun, 21 Aug 2022 09:58:43 +0000 (15:28 +0530)
nb_menu.c
radio.c

index d5d100acdbc2104f4591b1b8fa1b1bb4451ff0b8..1aa09186ee4bc727eb28bd30f7f06ef9ec38690c 100644 (file)
--- a/nb_menu.c
+++ b/nb_menu.c
@@ -34,10 +34,10 @@ static GtkWidget *menu_b = NULL;
 static GtkWidget *dialog = NULL;
 
 // all the time are in ms
-double nb_lag_time = 0.01;
-double nb_lead_time = 0.01;
-double nb_transition_time = 0.01;
-double nb_threshold_value = 20.0;
+double nb_lag_time = 0.001;
+double nb_lead_time = 0.001;
+double nb_transition_time = 0.001;
+double nb_threshold_value = 18.0;
 
 void nb_changed() {
     SetEXTANBHangtime(0, nb_lag_time);
diff --git a/radio.c b/radio.c
index 1a6dc23d535a57e751e1868918e35cb236ab5bb4..1dc6dd049d2daf0ca5caa0416739a9494f1f53d7 100644 (file)
--- a/radio.c
+++ b/radio.c
@@ -133,6 +133,12 @@ static GtkWidget *audio_waterfall;
 // RX and TX calibration
 long long calibration = 0LL;
 
+// nb values defined in nb_menu.c
+extern double nb_lag_time;
+extern double nb_lead_time;
+extern double nb_transition_time;
+extern double nb_threshold_value;
+
 /*
 #ifdef GPIO
 static GtkWidget *encoders;
@@ -2400,6 +2406,23 @@ void radioRestoreState() {
     listen_port = atoi(value);
 #endif
 
+  // restore NB values
+  value = getProperty("nb_lead_time");
+  if (value)
+      nb_lead_time = atof(value);
+
+  value = getProperty("nb_lag_time");
+  if (value)
+      nb_lag_time = atof(value);
+
+  value = getProperty("nb_transition_time");
+  if (value)
+      nb_transition_time = atof(value);
+
+  value = getProperty("nb_threshold_value");
+  if (value)
+      nb_threshold_value = atof(value);
+
   g_mutex_unlock(&property_mutex);
 }
 
@@ -2741,6 +2764,16 @@ void radioSaveState() {
   midi_save_state();
 #endif
 
+  // nb values
+  sprintf(value, "%f", nb_lag_time);
+  setProperty("nb_lag_time", value);
+  sprintf(value, "%f", nb_lead_time);
+  setProperty("nb_lead_time", value);
+  sprintf(value, "%f", nb_transition_time);
+  setProperty("nb_transition_time", value);
+  sprintf(value, "%f", nb_threshold_value);
+  setProperty("nb_threshold_value", value);
+
   saveProperties(property_path);
   g_mutex_unlock(&property_mutex);
 }