FreeCalypso > hg > fc-rfcal-tools
changeset 61:0bf853d1b68e
fc-rfcal-rxband: almost finished
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 28 May 2017 00:10:16 +0000 |
parents | 81e8f7e99d89 |
children | a98873b713c3 |
files | autocal/rxband.c autocal/rxupload.c |
diffstat | 2 files changed, 23 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/autocal/rxband.c Sat May 27 23:35:06 2017 +0000 +++ b/autocal/rxband.c Sun May 28 00:10:16 2017 +0000 @@ -67,6 +67,7 @@ }; struct rxcal_band *rxcal_band; +int Gmagic, rx_calchan_values[10]; finish_cmdline(argc, argv) char **argv; @@ -122,7 +123,7 @@ do_gmagic() { - int pm, Gmagic; + int pm; char Gmagic_db[64]; printf("Calibrating GMagic\n"); @@ -130,6 +131,6 @@ Gmagic = pm - RXCAL_SIGGEN_LEVEL - RXCAL_AGC_DB * 2; halfdb_to_string(Gmagic, Gmagic_db); printf("GMagic=%d (%s dB)\n", Gmagic, Gmagic_db); - upload_gmagic(Gmagic); + upload_gmagic(); return(0); }
--- a/autocal/rxupload.c Sat May 27 23:35:06 2017 +0000 +++ b/autocal/rxupload.c Sun May 28 00:10:16 2017 +0000 @@ -12,9 +12,9 @@ #include "rxtables.h" extern struct rxcal_band *rxcal_band; +extern int Gmagic, rx_calchan_values[]; -upload_gmagic(Gmagic) - unsigned Gmagic; +upload_gmagic() { struct rx_agc_params agcparams; @@ -23,3 +23,21 @@ do_rftw(RX_AGC_PARAMS, &agcparams, sizeof agcparams); return(0); } + +upload_rx_calchan() +{ + unsigned n; + struct rx_calchan_entry calchan_table[RX_CALCHAN_ENTRIES]; + + for (n = 0; n < rxcal_band->num_calchan_ranges; n++) { + calchan_table[n].upper_bound = + htole16(rxcal_band->calchan_ranges[n].upper_bound); + calchan_table[n].agc_calib = htole16(rx_calchan_values[n]); + } + for (; n < RX_CALCHAN_ENTRIES; n++) { + calchan_table[n].upper_bound = 0; + calchan_table[n].agc_calib = 0; + } + do_rftw(RX_CAL_CHAN, calchan_table, sizeof calchan_table); + return(0); +}