changeset 62:a98873b713c3

fc-rfcal-rxband: channel calibration implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 28 May 2017 00:33:10 +0000
parents 0bf853d1b68e
children 131abadbd74d
files autocal/rxband.c
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/autocal/rxband.c	Sun May 28 00:10:16 2017 +0000
+++ b/autocal/rxband.c	Sun May 28 00:33:10 2017 +0000
@@ -118,6 +118,7 @@
 	l1tm_setup_for_rxcal();
 
 	do_gmagic();
+	do_rx_calchan();
 	exit(0);
 }
 
@@ -134,3 +135,23 @@
 	upload_gmagic();
 	return(0);
 }
+
+do_rx_calchan()
+{
+	unsigned n;
+	int pm;
+
+	printf("Calibrating RSSI channel compensation\n");
+	for (n = 0; n < rxcal_band->num_calchan_ranges; n++) {
+		pm = rx_measure(rxcal_band->calchan_ranges[n].test_arfcn);
+		rx_calchan_values[n] = RXCAL_SIGGEN_LEVEL - pm +
+					RXCAL_AGC_DB * 2 + Gmagic;
+	}
+	for (n = 0; n < rxcal_band->num_calchan_ranges; n++)
+		printf("ARFCN %u-%u: correction=%d\n",
+			rxcal_band->calchan_ranges[n].lower_bound,
+			rxcal_band->calchan_ranges[n].upper_bound,
+			rx_calchan_values[n]);
+	upload_rx_calchan();
+	return(0);
+}