From f399b15be9ffdc6a38792c121b66e031b52d6306 Mon Sep 17 00:00:00 2001 From: c vw Date: Mon, 3 May 2021 20:03:59 +0200 Subject: [PATCH] Cleaned up code around "compute_power", and net ext interface to set_drive --- transmitter.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/transmitter.c b/transmitter.c index e2c2503..6f41524 100644 --- a/transmitter.c +++ b/transmitter.c @@ -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; } -- 2.45.2