changeset 81:83b24a1dfd4a

fc-rfcal-txband: implemented the slope computations after basis run
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 15 Jul 2017 21:34:29 +0000
parents b0da2db4e36b
children a094db1453b1
files autocal/txbandmain.c autocal/txbasis.c
diffstat 2 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/autocal/txbandmain.c	Sat Jul 15 21:22:38 2017 +0000
+++ b/autocal/txbandmain.c	Sat Jul 15 21:34:29 2017 +0000
@@ -120,6 +120,8 @@
 	upload_tx_calchan();
 	/* run the basis measurements */
 	txcal_basis_run();
+	/* analytical follow-up */
+	txcal_basis_compute();
 
 
 }
--- a/autocal/txbasis.c	Sat Jul 15 21:22:38 2017 +0000
+++ b/autocal/txbasis.c	Sat Jul 15 21:34:29 2017 +0000
@@ -29,7 +29,7 @@
 		do_txpw(TX_APC_DAC, tx_basis[n].apc);
 		usleep(20000);
 		meas = tx_power_meas();
-		printf("APC DAC=%d: %.2f dBm\n", tx_basis[n].apc, meas);
+		printf("APC DAC=%u: %.2f dBm\n", tx_basis[n].apc, meas);
 		tx_basis[n].vout = dbm_to_vout(meas);
 	}
 
@@ -37,3 +37,20 @@
 	do_rfe(STOP_ALL);
 	return(0);
 }
+
+txcal_basis_compute()
+{
+	unsigned n;
+
+	for (n = 0; n < num_basis_points - 1; n++) {
+		if (tx_basis[n+1].vout <= tx_basis[n].vout) {
+			fprintf(stderr,
+			"error: Vout at APC=%u is not greater than at APC=%u\n",
+				tx_basis[n+1].apc, tx_basis[n].apc);
+			exit(ERROR_RFTEST);
+		}
+		tx_basis[n].slope = (tx_basis[n+1].vout - tx_basis[n].vout) /
+				    (tx_basis[n+1].apc - tx_basis[n].apc);
+	}
+	return(0);
+}