]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Cleaned up code around "compute_power", and net ext interface to set_drive
authorc vw <dl1ycf@darc.de>
Mon, 3 May 2021 18:03:59 +0000 (20:03 +0200)
committerc vw <dl1ycf@darc.de>
Mon, 3 May 2021 18:03:59 +0000 (20:03 +0200)
transmitter.c

index e2c250371052bbd6114eba0c14d4b548feea304a..6f41524712f13d612441250e2c721d3e1c66e853 100644 (file)
@@ -647,18 +647,15 @@ static gboolean update_display(gpointer data) {
 #endif
     }
 
+//g_print("transmitter: meter_update: fwd:%f->%f rev:%f->%f ex_fwd=%d alex_fwd=%d alex_rev=%d\n",tx->fwd,compute_power(tx->fwd),tx->rev,compute_power(tx->rev),exciter_power,alex_forward_power,alex_reverse_power);
+
     //
-    // compute_power applies the interpolation table
-    // that corrects the power meter if it has been
-    // calibrated
+    // compute_power does an interpolation is user-supplied pairs of
+    // data points (measured by radio, measured by external watt meter)
+    // are available.
     //
-    double fwd=compute_power(tx->fwd);
-    double rev=compute_power(tx->rev);
-
-//g_print("transmitter: meter_update: fwd:%f->%f rev:%f->%f ex_fwd=%d alex_fwd=%d alex_rev=%d\n",tx->fwd,fwd,tx->rev,rev,exciter_power,alex_forward_power,alex_reverse_power);
-
-    tx->fwd=fwd;
-    tx->rev=rev;
+    tx->fwd=compute_power(tx->fwd);
+    tx->rev=compute_power(tx->rev);
 
     //
     // Calculate SWR and store as tx->swr.
@@ -687,9 +684,7 @@ static gboolean update_display(gpointer data) {
 //  set the drive slider to zero. Do not do this while tuning
 //
     if (tx->swr_protection && !getTune() && tx->swr >= tx->swr_alarm) {
-      double *dp = malloc(sizeof(double));
-      *dp = 0.0;
-      g_idle_add(ext_set_drive, (gpointer) dp);
+      g_idle_add(ext_set_drive, GINT_TO_POINTER(0));
       display_swr_protection = TRUE;
     }