From f3de63caf37640244812dfce0513ecee3fb40da5 Mon Sep 17 00:00:00 2001 From: Manolis Surligas Date: Thu, 20 Jul 2017 22:37:14 +0300 Subject: [PATCH] Add support for passing manually various device parameters All flowgraphs now support user defined parameters for most of their configuration capabilities. These include: * RF gain * IF gain * BB gain * Custom device arguments for setups with multiple SDRs. These coresponds to the 'Device arguments' field of the Osmocom source block. * Antenna selection for devices with multiple antennas (USRPs, etc) Changing sampling rate is not supported (yet). For listing the arguments just execute --help in a terminal window. --- apps/flowgraphs/apt_demod.grc | 243 ++++++++++++++- apps/flowgraphs/bpsk_demod.grc | 247 +++++++++++++-- apps/flowgraphs/cw_demod.grc | 247 +++++++++++++-- apps/flowgraphs/fm_demod.grc | 253 ++++++++++++++-- apps/flowgraphs/generic_iq_receiver.grc | 280 +++++++++++++++++- .../satellites/noaa_apt_decoder.grc | 229 +++++++++++++- .../satellites/satnogs_noaa_apt_decoder.py | 78 ++++- apps/flowgraphs/satnogs_apt_demod.py | 78 ++++- apps/flowgraphs/satnogs_cw_demod.py | 88 ++++-- apps/flowgraphs/satnogs_fm_demod.py | 78 ++++- .../flowgraphs/satnogs_generic_iq_receiver.py | 105 +++++-- python/hw_settings.py | 81 +++++ 12 files changed, 1842 insertions(+), 165 deletions(-) diff --git a/apps/flowgraphs/apt_demod.grc b/apps/flowgraphs/apt_demod.grc index b5a39f8..7814357 100644 --- a/apps/flowgraphs/apt_demod.grc +++ b/apps/flowgraphs/apt_demod.grc @@ -178,7 +178,7 @@ SDR received samples _coordinate - (1480, 988) + (805, 857) _rotation @@ -392,6 +392,92 @@ TX sampling rate 0 + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (382, 937) + + + _rotation + 0 + + + id + antenna + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_antenna + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (295, 937) + + + _rotation + 0 + + + id + bb_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_bb_gain + + rational_resampler_xxx @@ -467,7 +553,50 @@ TX sampling rate _coordinate - (64, 984) + (47, 937) + + + _rotation + 0 + + + id + dev_args + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_dev_args + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (47, 857) _rotation @@ -510,7 +639,7 @@ TX sampling rate _coordinate - (744, 988) + (494, 857) _rotation @@ -596,6 +725,49 @@ TX sampling rate ccc + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (215, 937) + + + _rotation + 0 + + + id + if_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_if_gain + + parameter @@ -648,11 +820,11 @@ we shift the LO a little further ant0 - satnogs.hw_rx_settings[rx_sdr_device]['antenna'] + satnogs.handle_rx_antenna(rx_sdr_device, antenna) bb_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'] + satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain) bw0 @@ -676,7 +848,7 @@ we shift the LO a little further if_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['if_gain'] + satnogs.handle_rx_if_gain(rx_sdr_device, if_gain) iq_balance_mode0 @@ -684,7 +856,7 @@ we shift the LO a little further gain0 - satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'] + satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain) ant10 @@ -1936,7 +2108,7 @@ we shift the LO a little further args - satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) _enabled @@ -1944,7 +2116,7 @@ we shift the LO a little further _coordinate - (16, 376) + (15, 311) _rotation @@ -2063,7 +2235,7 @@ we shift the LO a little further _coordinate - (1104, 996) + (734, 857) _rotation @@ -2165,7 +2337,50 @@ we shift the LO a little further _coordinate - (472, 984) + (143, 937) + + + _rotation + 0 + + + id + rf_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_rf_gain + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (327, 857) _rotation @@ -2208,7 +2423,7 @@ we shift the LO a little further _coordinate - (616, 984) + (414, 857) _rotation @@ -2251,7 +2466,7 @@ we shift the LO a little further _coordinate - (312, 984) + (215, 857) _rotation @@ -2498,7 +2713,7 @@ we shift the LO a little further _coordinate - (872, 988) + (598, 857) _rotation diff --git a/apps/flowgraphs/bpsk_demod.grc b/apps/flowgraphs/bpsk_demod.grc index f878bd3..eb2f03e 100644 --- a/apps/flowgraphs/bpsk_demod.grc +++ b/apps/flowgraphs/bpsk_demod.grc @@ -178,7 +178,7 @@ SDR received samples _coordinate - (1480, 988) + (845, 985) _rotation @@ -475,6 +475,92 @@ TX sampling rate analog.GR_COS_WAVE + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (398, 1065) + + + _rotation + 0 + + + id + antenna + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_antenna + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (311, 1065) + + + _rotation + 0 + + + id + bb_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_bb_gain + + rational_resampler_xxx @@ -673,6 +759,49 @@ tone. This tone is typically 500-800 Hz. 1500 + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (63, 1065) + + + _rotation + 0 + + + id + dev_args + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_dev_args + + parameter @@ -732,7 +861,7 @@ tone. This tone is typically 500-800 Hz. _coordinate - (744, 988) + (534, 985) _rotation @@ -818,6 +947,49 @@ tone. This tone is typically 500-800 Hz. ccc + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (231, 1065) + + + _rotation + 0 + + + id + if_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_if_gain + + parameter @@ -945,11 +1117,11 @@ we shift the LO a little further ant0 - satnogs.hw_rx_settings[rx_sdr_device]['antenna'] + satnogs.handle_rx_antenna(rx_sdr_device, antenna) bb_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'] + satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain) bw0 @@ -973,7 +1145,7 @@ we shift the LO a little further if_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['if_gain'] + satnogs.handle_rx_if_gain(rx_sdr_device, if_gain) iq_balance_mode0 @@ -981,7 +1153,7 @@ we shift the LO a little further gain0 - satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'] + satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain) ant10 @@ -2233,7 +2405,7 @@ we shift the LO a little further args - satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) _enabled @@ -2241,7 +2413,7 @@ we shift the LO a little further _coordinate - (16, 376) + (15, 359) _rotation @@ -2360,7 +2532,7 @@ we shift the LO a little further _coordinate - (1104, 996) + (773, 985) _rotation @@ -2403,7 +2575,50 @@ we shift the LO a little further _coordinate - (472, 984) + (159, 1065) + + + _rotation + 0 + + + id + rf_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_rf_gain + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (351, 985) _rotation @@ -2446,7 +2661,7 @@ we shift the LO a little further _coordinate - (616, 984) + (446, 985) _rotation @@ -2489,7 +2704,7 @@ we shift the LO a little further _coordinate - (312, 984) + (231, 985) _rotation @@ -2787,7 +3002,7 @@ we shift the LO a little further _coordinate - (872, 988) + (638, 985) _rotation @@ -2868,12 +3083,6 @@ we shift the LO a little further 0 0 - - osmosdr_source_0 - satnogs_doppler_correction_cc_0 - 0 - 0 - satnogs_coarse_doppler_correction_cc_0 freq_xlating_fir_filter_xxx_0 diff --git a/apps/flowgraphs/cw_demod.grc b/apps/flowgraphs/cw_demod.grc index c39334e..a0c14da 100644 --- a/apps/flowgraphs/cw_demod.grc +++ b/apps/flowgraphs/cw_demod.grc @@ -178,7 +178,7 @@ SDR received samples _coordinate - (1480, 988) + (805, 985) _rotation @@ -475,6 +475,92 @@ TX sampling rate analog.GR_COS_WAVE + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (398, 1081) + + + _rotation + 0 + + + id + antenna + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_antenna + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (311, 1081) + + + _rotation + 0 + + + id + bb_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_bb_gain + + rational_resampler_xxx @@ -673,6 +759,49 @@ tone. This tone is typically 500-800 Hz. 700 + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (63, 1081) + + + _rotation + 0 + + + id + dev_args + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_dev_args + + parameter @@ -732,7 +861,7 @@ tone. This tone is typically 500-800 Hz. _coordinate - (744, 988) + (494, 985) _rotation @@ -818,6 +947,49 @@ tone. This tone is typically 500-800 Hz. ccc + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (231, 1081) + + + _rotation + 0 + + + id + if_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_if_gain + + parameter @@ -945,11 +1117,11 @@ we shift the LO a little further ant0 - satnogs.hw_rx_settings[rx_sdr_device]['antenna'] + satnogs.handle_rx_antenna(rx_sdr_device, antenna) bb_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'] + satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain) bw0 @@ -973,7 +1145,7 @@ we shift the LO a little further if_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['if_gain'] + satnogs.handle_rx_if_gain(rx_sdr_device, if_gain) iq_balance_mode0 @@ -981,7 +1153,7 @@ we shift the LO a little further gain0 - satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'] + satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain) ant10 @@ -2233,7 +2405,7 @@ we shift the LO a little further args - satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) _enabled @@ -2241,7 +2413,7 @@ we shift the LO a little further _coordinate - (16, 376) + (15, 335) _rotation @@ -2360,7 +2532,7 @@ we shift the LO a little further _coordinate - (1104, 996) + (726, 985) _rotation @@ -2403,7 +2575,50 @@ we shift the LO a little further _coordinate - (472, 984) + (159, 1081) + + + _rotation + 0 + + + id + rf_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_rf_gain + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (327, 985) _rotation @@ -2446,7 +2661,7 @@ we shift the LO a little further _coordinate - (616, 984) + (414, 985) _rotation @@ -2489,7 +2704,7 @@ we shift the LO a little further _coordinate - (312, 984) + (223, 985) _rotation @@ -2787,7 +3002,7 @@ we shift the LO a little further _coordinate - (872, 988) + (590, 985) _rotation @@ -2868,12 +3083,6 @@ we shift the LO a little further 0 0 - - osmosdr_source_0 - satnogs_doppler_correction_cc_0 - 0 - 0 - satnogs_coarse_doppler_correction_cc_0 freq_xlating_fir_filter_xxx_0 diff --git a/apps/flowgraphs/fm_demod.grc b/apps/flowgraphs/fm_demod.grc index 77dea37..98fa73c 100644 --- a/apps/flowgraphs/fm_demod.grc +++ b/apps/flowgraphs/fm_demod.grc @@ -95,7 +95,7 @@ SDR received samples _coordinate - (1704, 796) + (1069, 865) _rotation @@ -178,7 +178,7 @@ SDR received samples _coordinate - (1480, 988) + (781, 865) _rotation @@ -260,7 +260,7 @@ TX sampling rate _coordinate - (1704, 956) + (1196, 865) _rotation @@ -369,7 +369,7 @@ TX sampling rate _coordinate - (1088, 564) + (1085, 410) _rotation @@ -392,6 +392,92 @@ TX sampling rate 0 + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (382, 945) + + + _rotation + 0 + + + id + antenna + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_antenna + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (295, 945) + + + _rotation + 0 + + + id + bb_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_bb_gain + + rational_resampler_xxx @@ -420,7 +506,7 @@ TX sampling rate _coordinate - (1272, 268) + (1196, 263) _rotation @@ -467,7 +553,50 @@ TX sampling rate _coordinate - (64, 984) + (47, 945) + + + _rotation + 0 + + + id + dev_args + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_dev_args + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (47, 865) _rotation @@ -510,7 +639,7 @@ TX sampling rate _coordinate - (744, 988) + (478, 865) _rotation @@ -596,6 +725,49 @@ TX sampling rate ccc + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (215, 945) + + + _rotation + 0 + + + id + if_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_if_gain + + parameter @@ -613,7 +785,7 @@ we shift the LO a little further _coordinate - (1704, 608) + (869, 865) _rotation @@ -648,11 +820,11 @@ we shift the LO a little further ant0 - satnogs.hw_rx_settings[rx_sdr_device]['antenna'] + satnogs.handle_rx_antenna(rx_sdr_device, antenna) bb_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'] + satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain) bw0 @@ -676,7 +848,7 @@ we shift the LO a little further if_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['if_gain'] + satnogs.handle_rx_if_gain(rx_sdr_device, if_gain) iq_balance_mode0 @@ -684,7 +856,7 @@ we shift the LO a little further gain0 - satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'] + satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain) ant10 @@ -1936,7 +2108,7 @@ we shift the LO a little further args - satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) _enabled @@ -2063,7 +2235,7 @@ we shift the LO a little further _coordinate - (1104, 996) + (710, 865) _rotation @@ -2106,7 +2278,50 @@ we shift the LO a little further _coordinate - (472, 984) + (143, 945) + + + _rotation + 0 + + + id + rf_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_rf_gain + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (311, 865) _rotation @@ -2149,7 +2364,7 @@ we shift the LO a little further _coordinate - (616, 984) + (398, 865) _rotation @@ -2192,7 +2407,7 @@ we shift the LO a little further _coordinate - (312, 984) + (207, 865) _rotation @@ -2290,7 +2505,7 @@ we shift the LO a little further _coordinate - (920, 548) + (877, 394) _rotation @@ -2439,7 +2654,7 @@ we shift the LO a little further _coordinate - (872, 988) + (574, 865) _rotation diff --git a/apps/flowgraphs/generic_iq_receiver.grc b/apps/flowgraphs/generic_iq_receiver.grc index b0b91e0..4fdc82b 100644 --- a/apps/flowgraphs/generic_iq_receiver.grc +++ b/apps/flowgraphs/generic_iq_receiver.grc @@ -1,5 +1,5 @@ - + Thu May 5 00:22:45 2016 @@ -358,6 +358,92 @@ TX sampling rate analog.GR_COS_WAVE + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (398, 937) + + + _rotation + 0 + + + id + antenna + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_antenna + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (311, 937) + + + _rotation + 0 + + + id + bb_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_bb_gain + + blocks_file_sink @@ -460,6 +546,49 @@ TX sampling rate 1 + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (63, 937) + + + _rotation + 0 + + + id + dev_args + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_dev_args + + parameter @@ -605,6 +734,49 @@ TX sampling rate ccc + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (231, 937) + + + _rotation + 0 + + + id + if_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_if_gain + + parameter @@ -657,11 +829,11 @@ we shift the LO a little further ant0 - satnogs.hw_rx_settings[rx_sdr_device]['antenna'] + satnogs.handle_rx_antenna(rx_sdr_device, antenna) bb_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'] + satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain) bw0 @@ -673,7 +845,7 @@ we shift the LO a little further corr0 - 0 + ppm freq0 @@ -685,7 +857,7 @@ we shift the LO a little further if_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['if_gain'] + satnogs.handle_rx_if_gain(rx_sdr_device, if_gain) iq_balance_mode0 @@ -693,7 +865,7 @@ we shift the LO a little further gain0 - satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'] + satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain) ant10 @@ -1945,7 +2117,7 @@ we shift the LO a little further args - satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) _enabled @@ -1953,7 +2125,7 @@ we shift the LO a little further _coordinate - (24, 256) + (23, 271) _rotation @@ -2056,6 +2228,49 @@ we shift the LO a little further + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (183, 769) + + + _rotation + 0 + + + id + ppm + + + label + + + + short_id + + + + type + intx + + + value + 0 + + qtgui_freq_sink_x @@ -2355,6 +2570,49 @@ we shift the LO a little further dB + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (159, 937) + + + _rotation + 0 + + + id + rf_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_rf_gain + + parameter @@ -2608,12 +2866,6 @@ we shift the LO a little further 0 0 - - osmosdr_source_0 - blocks_multiply_xx_0 - 0 - 1 - osmosdr_source_0 satnogs_coarse_doppler_correction_cc_0 diff --git a/apps/flowgraphs/satellites/noaa_apt_decoder.grc b/apps/flowgraphs/satellites/noaa_apt_decoder.grc index 44876bd..bd605e0 100644 --- a/apps/flowgraphs/satellites/noaa_apt_decoder.grc +++ b/apps/flowgraphs/satellites/noaa_apt_decoder.grc @@ -336,6 +336,49 @@ TX sampling rate samp_rate_rx/ ( first_stage_decimation * int(samp_rate_rx/ first_stage_decimation / initial_bandwidth)) + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (518, 634) + + + _rotation + 0 + + + id + antenna + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_antenna + + band_pass_filter @@ -415,6 +458,49 @@ TX sampling rate firdes.WIN_HAMMING + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (430, 634) + + + _rotation + 0 + + + id + bb_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_bb_gain + + blocks_complex_to_mag @@ -458,6 +544,49 @@ TX sampling rate 1 + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (183, 634) + + + _rotation + 0 + + + id + dev_args + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_dev_args + + parameter @@ -639,7 +768,7 @@ TX sampling rate _coordinate - (296, 312) + (295, 295) _rotation @@ -721,6 +850,49 @@ TX sampling rate firdes.WIN_HAMMING + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (351, 634) + + + _rotation + 0 + + + id + if_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_if_gain + + parameter @@ -816,11 +988,11 @@ we shift the LO a little further ant0 - satnogs.hw_rx_settings[rx_sdr_device]['antenna'] + satnogs.handle_rx_antenna(rx_sdr_device, antenna) bb_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'] + satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain) bw0 @@ -844,7 +1016,7 @@ we shift the LO a little further if_gain0 - satnogs.hw_rx_settings[rx_sdr_device]['if_gain'] + satnogs.handle_rx_if_gain(rx_sdr_device, if_gain) iq_balance_mode0 @@ -852,7 +1024,7 @@ we shift the LO a little further gain0 - satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'] + satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain) ant10 @@ -2104,7 +2276,7 @@ we shift the LO a little further args - satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) _enabled @@ -2112,7 +2284,7 @@ we shift the LO a little further _coordinate - (55, 243) + (15, 223) _rotation @@ -2376,6 +2548,49 @@ we shift the LO a little further fff + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (279, 634) + + + _rotation + 0 + + + id + rf_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_rf_gain + + parameter diff --git a/apps/flowgraphs/satellites/satnogs_noaa_apt_decoder.py b/apps/flowgraphs/satellites/satnogs_noaa_apt_decoder.py index 4d4d2f3..00e2a1b 100755 --- a/apps/flowgraphs/satellites/satnogs_noaa_apt_decoder.py +++ b/apps/flowgraphs/satellites/satnogs_noaa_apt_decoder.py @@ -5,7 +5,7 @@ # Title: NOAA APT Decoder # Author: Manolis Surligas, George Vardakis # Description: A NOAA APT Decoder with automatic image synchronization -# Generated: Fri Jun 23 15:41:33 2017 +# Generated: Thu Jul 20 22:29:00 2017 ################################################## from gnuradio import analog @@ -23,7 +23,7 @@ import time class satnogs_noaa_apt_decoder(gr.top_block): - def __init__(self, doppler_correction_per_sec=1000, image_file_path='/tmp/noaa.png', lo_offset=100e3, ppm=0, rigctl_port=4532, rx_freq=90.4e6, rx_sdr_device='usrpb200'): + def __init__(self, doppler_correction_per_sec=1000, image_file_path='/tmp/noaa.png', lo_offset=100e3, ppm=0, rigctl_port=4532, rx_freq=90.4e6, rx_sdr_device='usrpb200', if_gain=satnogs.not_set_rx_if_gain, rf_gain=satnogs.not_set_rx_rf_gain, dev_args=satnogs.not_set_dev_args, bb_gain=satnogs.not_set_rx_bb_gain, antenna=satnogs.not_set_antenna): gr.top_block.__init__(self, "NOAA APT Decoder") ################################################## @@ -36,6 +36,11 @@ class satnogs_noaa_apt_decoder(gr.top_block): self.rigctl_port = rigctl_port self.rx_freq = rx_freq self.rx_sdr_device = rx_sdr_device + self.if_gain = if_gain + self.rf_gain = rf_gain + self.dev_args = dev_args + self.bb_gain = bb_gain + self.antenna = antenna ################################################## # Variables @@ -69,17 +74,17 @@ class satnogs_noaa_apt_decoder(gr.top_block): taps=None, fractional_bw=None, ) - self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] ) + self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) ) self.osmosdr_source_0.set_sample_rate(samp_rate_rx) self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0) self.osmosdr_source_0.set_freq_corr(ppm, 0) self.osmosdr_source_0.set_dc_offset_mode(2, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) - self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'], 0) - self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[rx_sdr_device]['if_gain'], 0) - self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'], 0) - self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[rx_sdr_device]['antenna'], 0) + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0) + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0) + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0) + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0) self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0) self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76) @@ -159,10 +164,44 @@ class satnogs_noaa_apt_decoder(gr.top_block): def set_rx_sdr_device(self, rx_sdr_device): self.rx_sdr_device = rx_sdr_device self.set_samp_rate_rx(satnogs.hw_rx_settings[self.rx_sdr_device]['samp_rate']) - self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['rf_gain'], 0) - self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['if_gain'], 0) - self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['bb_gain'], 0) - self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[self.rx_sdr_device]['antenna'], 0) + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(self.rx_sdr_device, self.rf_gain), 0) + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(self.rx_sdr_device, self.if_gain), 0) + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(self.rx_sdr_device, self.bb_gain), 0) + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(self.rx_sdr_device, self.antenna), 0) + + def get_if_gain(self): + return self.if_gain + + def set_if_gain(self, if_gain): + self.if_gain = if_gain + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(self.rx_sdr_device, self.if_gain), 0) + + def get_rf_gain(self): + return self.rf_gain + + def set_rf_gain(self, rf_gain): + self.rf_gain = rf_gain + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(self.rx_sdr_device, self.rf_gain), 0) + + def get_dev_args(self): + return self.dev_args + + def set_dev_args(self, dev_args): + self.dev_args = dev_args + + def get_bb_gain(self): + return self.bb_gain + + def set_bb_gain(self, bb_gain): + self.bb_gain = bb_gain + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(self.rx_sdr_device, self.bb_gain), 0) + + def get_antenna(self): + return self.antenna + + def set_antenna(self, antenna): + self.antenna = antenna + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(self.rx_sdr_device, self.antenna), 0) def get_samp_rate_rx(self): return self.samp_rate_rx @@ -233,6 +272,21 @@ def argument_parser(): parser.add_option( "", "--rx-sdr-device", dest="rx_sdr_device", type="string", default='usrpb200', help="Set rx_sdr_device [default=%default]") + parser.add_option( + "", "--if-gain", dest="if_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_if_gain), + help="Set if_gain [default=%default]") + parser.add_option( + "", "--rf-gain", dest="rf_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_rf_gain), + help="Set rf_gain [default=%default]") + parser.add_option( + "", "--dev-args", dest="dev_args", type="string", default=satnogs.not_set_dev_args, + help="Set dev_args [default=%default]") + parser.add_option( + "", "--bb-gain", dest="bb_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_bb_gain), + help="Set bb_gain [default=%default]") + parser.add_option( + "", "--antenna", dest="antenna", type="string", default=satnogs.not_set_antenna, + help="Set antenna [default=%default]") return parser @@ -240,7 +294,7 @@ def main(top_block_cls=satnogs_noaa_apt_decoder, options=None): if options is None: options, _ = argument_parser().parse_args() - tb = top_block_cls(doppler_correction_per_sec=options.doppler_correction_per_sec, image_file_path=options.image_file_path, lo_offset=options.lo_offset, ppm=options.ppm, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device) + tb = top_block_cls(doppler_correction_per_sec=options.doppler_correction_per_sec, image_file_path=options.image_file_path, lo_offset=options.lo_offset, ppm=options.ppm, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device, if_gain=options.if_gain, rf_gain=options.rf_gain, dev_args=options.dev_args, bb_gain=options.bb_gain, antenna=options.antenna) tb.start() tb.wait() diff --git a/apps/flowgraphs/satnogs_apt_demod.py b/apps/flowgraphs/satnogs_apt_demod.py index 65e7cc6..e382d2b 100755 --- a/apps/flowgraphs/satnogs_apt_demod.py +++ b/apps/flowgraphs/satnogs_apt_demod.py @@ -5,7 +5,7 @@ # Title: APT Generic Demodulation # Author: Manolis Surligas (surligas@gmail.com) # Description: A generic APT demodulation block -# Generated: Thu Jul 6 18:29:16 2017 +# Generated: Thu Jul 20 22:24:59 2017 ################################################## from gnuradio import analog @@ -23,7 +23,7 @@ import time class satnogs_apt_demod(gr.top_block): - def __init__(self, doppler_correction_per_sec=1000, file_path='test.wav', lo_offset=100e3, ppm=0, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', waterfall_file_path='/tmp/waterfall.dat'): + def __init__(self, doppler_correction_per_sec=1000, file_path='test.wav', lo_offset=100e3, ppm=0, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', waterfall_file_path='/tmp/waterfall.dat', if_gain=satnogs.not_set_rx_if_gain, rf_gain=satnogs.not_set_rx_rf_gain, dev_args=satnogs.not_set_dev_args, bb_gain=satnogs.not_set_rx_bb_gain, antenna=satnogs.not_set_antenna): gr.top_block.__init__(self, "APT Generic Demodulation") ################################################## @@ -37,6 +37,11 @@ class satnogs_apt_demod(gr.top_block): self.rx_freq = rx_freq self.rx_sdr_device = rx_sdr_device self.waterfall_file_path = waterfall_file_path + self.if_gain = if_gain + self.rf_gain = rf_gain + self.dev_args = dev_args + self.bb_gain = bb_gain + self.antenna = antenna ################################################## # Variables @@ -64,17 +69,17 @@ class satnogs_apt_demod(gr.top_block): taps=None, fractional_bw=None, ) - self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] ) + self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) ) self.osmosdr_source_0.set_sample_rate(samp_rate_rx) self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0) self.osmosdr_source_0.set_freq_corr(ppm, 0) self.osmosdr_source_0.set_dc_offset_mode(2, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) - self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'], 0) - self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[rx_sdr_device]['if_gain'], 0) - self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'], 0) - self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[rx_sdr_device]['antenna'], 0) + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0) + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0) + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0) + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0) self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(int(samp_rate_rx/filter_rate), (xlate_filter_taps), lo_offset, samp_rate_rx) @@ -145,10 +150,10 @@ class satnogs_apt_demod(gr.top_block): def set_rx_sdr_device(self, rx_sdr_device): self.rx_sdr_device = rx_sdr_device self.set_samp_rate_rx(satnogs.hw_rx_settings[self.rx_sdr_device]['samp_rate']) - self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['rf_gain'], 0) - self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['if_gain'], 0) - self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['bb_gain'], 0) - self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[self.rx_sdr_device]['antenna'], 0) + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(self.rx_sdr_device, self.rf_gain), 0) + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(self.rx_sdr_device, self.if_gain), 0) + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(self.rx_sdr_device, self.bb_gain), 0) + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(self.rx_sdr_device, self.antenna), 0) self.set_audio_gain(satnogs.fm_demod_settings[self.rx_sdr_device]['audio_gain']) def get_waterfall_file_path(self): @@ -157,6 +162,40 @@ class satnogs_apt_demod(gr.top_block): def set_waterfall_file_path(self, waterfall_file_path): self.waterfall_file_path = waterfall_file_path + def get_if_gain(self): + return self.if_gain + + def set_if_gain(self, if_gain): + self.if_gain = if_gain + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(self.rx_sdr_device, self.if_gain), 0) + + def get_rf_gain(self): + return self.rf_gain + + def set_rf_gain(self, rf_gain): + self.rf_gain = rf_gain + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(self.rx_sdr_device, self.rf_gain), 0) + + def get_dev_args(self): + return self.dev_args + + def set_dev_args(self, dev_args): + self.dev_args = dev_args + + def get_bb_gain(self): + return self.bb_gain + + def set_bb_gain(self, bb_gain): + self.bb_gain = bb_gain + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(self.rx_sdr_device, self.bb_gain), 0) + + def get_antenna(self): + return self.antenna + + def set_antenna(self, antenna): + self.antenna = antenna + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(self.rx_sdr_device, self.antenna), 0) + def get_samp_rate_rx(self): return self.samp_rate_rx @@ -232,6 +271,21 @@ def argument_parser(): parser.add_option( "", "--waterfall-file-path", dest="waterfall_file_path", type="string", default='/tmp/waterfall.dat', help="Set waterfall_file_path [default=%default]") + parser.add_option( + "", "--if-gain", dest="if_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_if_gain), + help="Set if_gain [default=%default]") + parser.add_option( + "", "--rf-gain", dest="rf_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_rf_gain), + help="Set rf_gain [default=%default]") + parser.add_option( + "", "--dev-args", dest="dev_args", type="string", default=satnogs.not_set_dev_args, + help="Set dev_args [default=%default]") + parser.add_option( + "", "--bb-gain", dest="bb_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_bb_gain), + help="Set bb_gain [default=%default]") + parser.add_option( + "", "--antenna", dest="antenna", type="string", default=satnogs.not_set_antenna, + help="Set antenna [default=%default]") return parser @@ -239,7 +293,7 @@ def main(top_block_cls=satnogs_apt_demod, options=None): if options is None: options, _ = argument_parser().parse_args() - tb = top_block_cls(doppler_correction_per_sec=options.doppler_correction_per_sec, file_path=options.file_path, lo_offset=options.lo_offset, ppm=options.ppm, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device, waterfall_file_path=options.waterfall_file_path) + tb = top_block_cls(doppler_correction_per_sec=options.doppler_correction_per_sec, file_path=options.file_path, lo_offset=options.lo_offset, ppm=options.ppm, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device, waterfall_file_path=options.waterfall_file_path, if_gain=options.if_gain, rf_gain=options.rf_gain, dev_args=options.dev_args, bb_gain=options.bb_gain, antenna=options.antenna) tb.start() tb.wait() diff --git a/apps/flowgraphs/satnogs_cw_demod.py b/apps/flowgraphs/satnogs_cw_demod.py index 1b2975f..5c4b76e 100755 --- a/apps/flowgraphs/satnogs_cw_demod.py +++ b/apps/flowgraphs/satnogs_cw_demod.py @@ -2,10 +2,10 @@ # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph -# Title: FM Generic Demodulation +# Title: BPSK Generic Demodulation # Author: surligas, cshields, csete -# Description: A generic CW demodulation block -# Generated: Thu Jul 6 18:29:34 2017 +# Description: A generic BPSK demodulation block +# Generated: Thu Jul 20 22:23:27 2017 ################################################## from gnuradio import analog @@ -23,8 +23,8 @@ import time class satnogs_cw_demod(gr.top_block): - def __init__(self, cw_offset=700, doppler_correction_per_sec=1000, file_path='test.wav', lo_offset=100e3, ppm=0, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', waterfall_file_path='/tmp/waterfall.dat'): - gr.top_block.__init__(self, "FM Generic Demodulation") + def __init__(self, cw_offset=1500, doppler_correction_per_sec=1000, file_path='test.wav', lo_offset=100e3, ppm=0, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', waterfall_file_path='/tmp/waterfall.dat', if_gain=satnogs.not_set_rx_if_gain, rf_gain=satnogs.not_set_rx_rf_gain, dev_args=satnogs.not_set_dev_args, bb_gain=satnogs.not_set_rx_bb_gain, antenna=satnogs.not_set_antenna): + gr.top_block.__init__(self, "BPSK Generic Demodulation") ################################################## # Parameters @@ -38,6 +38,11 @@ class satnogs_cw_demod(gr.top_block): self.rx_freq = rx_freq self.rx_sdr_device = rx_sdr_device self.waterfall_file_path = waterfall_file_path + self.if_gain = if_gain + self.rf_gain = rf_gain + self.dev_args = dev_args + self.bb_gain = bb_gain + self.antenna = antenna ################################################## # Variables @@ -59,17 +64,17 @@ class satnogs_cw_demod(gr.top_block): self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000, 1500) self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(file_path, audio_samp_rate, 1.0) self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx) - self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] ) + self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) ) self.osmosdr_source_0.set_sample_rate(samp_rate_rx) self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0) self.osmosdr_source_0.set_freq_corr(ppm, 0) self.osmosdr_source_0.set_dc_offset_mode(2, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) - self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'], 0) - self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[rx_sdr_device]['if_gain'], 0) - self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'], 0) - self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[rx_sdr_device]['antenna'], 0) + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0) + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0) + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0) + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0) self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0) self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass( @@ -156,10 +161,10 @@ class satnogs_cw_demod(gr.top_block): def set_rx_sdr_device(self, rx_sdr_device): self.rx_sdr_device = rx_sdr_device self.set_samp_rate_rx(satnogs.hw_rx_settings[self.rx_sdr_device]['samp_rate']) - self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['rf_gain'], 0) - self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['if_gain'], 0) - self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['bb_gain'], 0) - self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[self.rx_sdr_device]['antenna'], 0) + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(self.rx_sdr_device, self.rf_gain), 0) + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(self.rx_sdr_device, self.if_gain), 0) + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(self.rx_sdr_device, self.bb_gain), 0) + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(self.rx_sdr_device, self.antenna), 0) self.set_audio_gain(satnogs.fm_demod_settings[self.rx_sdr_device]['audio_gain']) def get_waterfall_file_path(self): @@ -168,6 +173,40 @@ class satnogs_cw_demod(gr.top_block): def set_waterfall_file_path(self, waterfall_file_path): self.waterfall_file_path = waterfall_file_path + def get_if_gain(self): + return self.if_gain + + def set_if_gain(self, if_gain): + self.if_gain = if_gain + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(self.rx_sdr_device, self.if_gain), 0) + + def get_rf_gain(self): + return self.rf_gain + + def set_rf_gain(self, rf_gain): + self.rf_gain = rf_gain + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(self.rx_sdr_device, self.rf_gain), 0) + + def get_dev_args(self): + return self.dev_args + + def set_dev_args(self, dev_args): + self.dev_args = dev_args + + def get_bb_gain(self): + return self.bb_gain + + def set_bb_gain(self, bb_gain): + self.bb_gain = bb_gain + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(self.rx_sdr_device, self.bb_gain), 0) + + def get_antenna(self): + return self.antenna + + def set_antenna(self, antenna): + self.antenna = antenna + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(self.rx_sdr_device, self.antenna), 0) + def get_samp_rate_rx(self): return self.samp_rate_rx @@ -218,10 +257,10 @@ class satnogs_cw_demod(gr.top_block): def argument_parser(): - description = 'A generic CW demodulation block' + description = 'A generic BPSK demodulation block' parser = OptionParser(usage="%prog: [options]", option_class=eng_option, description=description) parser.add_option( - "", "--cw-offset", dest="cw_offset", type="eng_float", default=eng_notation.num_to_str(700), + "", "--cw-offset", dest="cw_offset", type="eng_float", default=eng_notation.num_to_str(1500), help="Set cw_offset [default=%default]") parser.add_option( "", "--doppler-correction-per-sec", dest="doppler_correction_per_sec", type="intx", default=1000, @@ -247,6 +286,21 @@ def argument_parser(): parser.add_option( "", "--waterfall-file-path", dest="waterfall_file_path", type="string", default='/tmp/waterfall.dat', help="Set waterfall_file_path [default=%default]") + parser.add_option( + "", "--if-gain", dest="if_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_if_gain), + help="Set if_gain [default=%default]") + parser.add_option( + "", "--rf-gain", dest="rf_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_rf_gain), + help="Set rf_gain [default=%default]") + parser.add_option( + "", "--dev-args", dest="dev_args", type="string", default=satnogs.not_set_dev_args, + help="Set dev_args [default=%default]") + parser.add_option( + "", "--bb-gain", dest="bb_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_bb_gain), + help="Set bb_gain [default=%default]") + parser.add_option( + "", "--antenna", dest="antenna", type="string", default=satnogs.not_set_antenna, + help="Set antenna [default=%default]") return parser @@ -254,7 +308,7 @@ def main(top_block_cls=satnogs_cw_demod, options=None): if options is None: options, _ = argument_parser().parse_args() - tb = top_block_cls(cw_offset=options.cw_offset, doppler_correction_per_sec=options.doppler_correction_per_sec, file_path=options.file_path, lo_offset=options.lo_offset, ppm=options.ppm, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device, waterfall_file_path=options.waterfall_file_path) + tb = top_block_cls(cw_offset=options.cw_offset, doppler_correction_per_sec=options.doppler_correction_per_sec, file_path=options.file_path, lo_offset=options.lo_offset, ppm=options.ppm, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device, waterfall_file_path=options.waterfall_file_path, if_gain=options.if_gain, rf_gain=options.rf_gain, dev_args=options.dev_args, bb_gain=options.bb_gain, antenna=options.antenna) tb.start() tb.wait() diff --git a/apps/flowgraphs/satnogs_fm_demod.py b/apps/flowgraphs/satnogs_fm_demod.py index 62e0f06..77eacd7 100755 --- a/apps/flowgraphs/satnogs_fm_demod.py +++ b/apps/flowgraphs/satnogs_fm_demod.py @@ -5,7 +5,7 @@ # Title: FM Generic Demodulation # Author: Manolis Surligas (surligas@gmail.com) # Description: A generic FM demodulation block -# Generated: Thu Jul 6 18:28:13 2017 +# Generated: Thu Jul 20 22:29:23 2017 ################################################## from gnuradio import analog @@ -23,16 +23,21 @@ import time class satnogs_fm_demod(gr.top_block): - def __init__(self, doppler_correction_per_sec=1000, file_path='test.wav', lo_offset=100e3, ppm=0, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', waterfall_file_path='/tmp/waterfall.dat'): + def __init__(self, antenna=satnogs.not_set_antenna, bb_gain=satnogs.not_set_rx_bb_gain, dev_args=satnogs.not_set_dev_args, doppler_correction_per_sec=1000, file_path='test.wav', if_gain=satnogs.not_set_rx_if_gain, lo_offset=100e3, ppm=0, rf_gain=satnogs.not_set_rx_rf_gain, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', waterfall_file_path='/tmp/waterfall.dat'): gr.top_block.__init__(self, "FM Generic Demodulation") ################################################## # Parameters ################################################## + self.antenna = antenna + self.bb_gain = bb_gain + self.dev_args = dev_args self.doppler_correction_per_sec = doppler_correction_per_sec self.file_path = file_path + self.if_gain = if_gain self.lo_offset = lo_offset self.ppm = ppm + self.rf_gain = rf_gain self.rigctl_port = rigctl_port self.rx_freq = rx_freq self.rx_sdr_device = rx_sdr_device @@ -58,17 +63,17 @@ class satnogs_fm_demod(gr.top_block): self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000, 1500) self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(file_path, audio_samp_rate, 1.0) self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx) - self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] ) + self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) ) self.osmosdr_source_0.set_sample_rate(samp_rate_rx) self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0) self.osmosdr_source_0.set_freq_corr(ppm, 0) self.osmosdr_source_0.set_dc_offset_mode(2, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) - self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'], 0) - self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[rx_sdr_device]['if_gain'], 0) - self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'], 0) - self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[rx_sdr_device]['antenna'], 0) + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0) + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0) + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0) + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0) self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0) self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(int(samp_rate_rx/filter_rate), (xlate_filter_taps), lo_offset, samp_rate_rx) @@ -91,6 +96,26 @@ class satnogs_fm_demod(gr.top_block): self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0)) self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) + def get_antenna(self): + return self.antenna + + def set_antenna(self, antenna): + self.antenna = antenna + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(self.rx_sdr_device, self.antenna), 0) + + def get_bb_gain(self): + return self.bb_gain + + def set_bb_gain(self, bb_gain): + self.bb_gain = bb_gain + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(self.rx_sdr_device, self.bb_gain), 0) + + def get_dev_args(self): + return self.dev_args + + def set_dev_args(self, dev_args): + self.dev_args = dev_args + def get_doppler_correction_per_sec(self): return self.doppler_correction_per_sec @@ -103,6 +128,13 @@ class satnogs_fm_demod(gr.top_block): def set_file_path(self, file_path): self.file_path = file_path + def get_if_gain(self): + return self.if_gain + + def set_if_gain(self, if_gain): + self.if_gain = if_gain + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(self.rx_sdr_device, self.if_gain), 0) + def get_lo_offset(self): return self.lo_offset @@ -118,6 +150,13 @@ class satnogs_fm_demod(gr.top_block): self.ppm = ppm self.osmosdr_source_0.set_freq_corr(self.ppm, 0) + def get_rf_gain(self): + return self.rf_gain + + def set_rf_gain(self, rf_gain): + self.rf_gain = rf_gain + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(self.rx_sdr_device, self.rf_gain), 0) + def get_rigctl_port(self): return self.rigctl_port @@ -138,10 +177,10 @@ class satnogs_fm_demod(gr.top_block): def set_rx_sdr_device(self, rx_sdr_device): self.rx_sdr_device = rx_sdr_device self.set_samp_rate_rx(satnogs.hw_rx_settings[self.rx_sdr_device]['samp_rate']) - self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['rf_gain'], 0) - self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['if_gain'], 0) - self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['bb_gain'], 0) - self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[self.rx_sdr_device]['antenna'], 0) + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(self.rx_sdr_device, self.rf_gain), 0) + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(self.rx_sdr_device, self.if_gain), 0) + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(self.rx_sdr_device, self.bb_gain), 0) + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(self.rx_sdr_device, self.antenna), 0) self.set_audio_gain(satnogs.fm_demod_settings[self.rx_sdr_device]['audio_gain']) def get_waterfall_file_path(self): @@ -202,18 +241,33 @@ class satnogs_fm_demod(gr.top_block): def argument_parser(): description = 'A generic FM demodulation block' parser = OptionParser(usage="%prog: [options]", option_class=eng_option, description=description) + parser.add_option( + "", "--antenna", dest="antenna", type="string", default=satnogs.not_set_antenna, + help="Set antenna [default=%default]") + parser.add_option( + "", "--bb-gain", dest="bb_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_bb_gain), + help="Set bb_gain [default=%default]") + parser.add_option( + "", "--dev-args", dest="dev_args", type="string", default=satnogs.not_set_dev_args, + help="Set dev_args [default=%default]") parser.add_option( "", "--doppler-correction-per-sec", dest="doppler_correction_per_sec", type="intx", default=1000, help="Set doppler_correction_per_sec [default=%default]") parser.add_option( "", "--file-path", dest="file_path", type="string", default='test.wav', help="Set file_path [default=%default]") + parser.add_option( + "", "--if-gain", dest="if_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_if_gain), + help="Set if_gain [default=%default]") parser.add_option( "", "--lo-offset", dest="lo_offset", type="eng_float", default=eng_notation.num_to_str(100e3), help="Set lo_offset [default=%default]") parser.add_option( "", "--ppm", dest="ppm", type="intx", default=0, help="Set ppm [default=%default]") + parser.add_option( + "", "--rf-gain", dest="rf_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_rf_gain), + help="Set rf_gain [default=%default]") parser.add_option( "", "--rigctl-port", dest="rigctl_port", type="intx", default=4532, help="Set rigctl_port [default=%default]") @@ -233,7 +287,7 @@ def main(top_block_cls=satnogs_fm_demod, options=None): if options is None: options, _ = argument_parser().parse_args() - tb = top_block_cls(doppler_correction_per_sec=options.doppler_correction_per_sec, file_path=options.file_path, lo_offset=options.lo_offset, ppm=options.ppm, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device, waterfall_file_path=options.waterfall_file_path) + tb = top_block_cls(antenna=options.antenna, bb_gain=options.bb_gain, dev_args=options.dev_args, doppler_correction_per_sec=options.doppler_correction_per_sec, file_path=options.file_path, if_gain=options.if_gain, lo_offset=options.lo_offset, ppm=options.ppm, rf_gain=options.rf_gain, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device, waterfall_file_path=options.waterfall_file_path) tb.start() tb.wait() diff --git a/apps/flowgraphs/satnogs_generic_iq_receiver.py b/apps/flowgraphs/satnogs_generic_iq_receiver.py index 5f1b296..3cae81a 100755 --- a/apps/flowgraphs/satnogs_generic_iq_receiver.py +++ b/apps/flowgraphs/satnogs_generic_iq_receiver.py @@ -5,7 +5,7 @@ # Title: Generic IQ samples receiver # Author: Manolis Surligas (surligas@gmail.com) # Description: A generic FM demodulation block -# Generated: Mon Nov 7 19:49:15 2016 +# Generated: Thu Jul 20 22:27:27 2017 ################################################## from gnuradio import blocks @@ -22,7 +22,7 @@ import time class satnogs_generic_iq_receiver(gr.top_block): - def __init__(self, doppler_correction_per_sec=1000, file_path='test.wav', lo_offset=100e3, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200'): + def __init__(self, doppler_correction_per_sec=1000, file_path='test.wav', lo_offset=100e3, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', if_gain=satnogs.not_set_rx_if_gain, rf_gain=satnogs.not_set_rx_rf_gain, dev_args=satnogs.not_set_dev_args, bb_gain=satnogs.not_set_rx_bb_gain, antenna=satnogs.not_set_antenna, ppm=0): gr.top_block.__init__(self, "Generic IQ samples receiver") ################################################## @@ -34,15 +34,21 @@ class satnogs_generic_iq_receiver(gr.top_block): self.rigctl_port = rigctl_port self.rx_freq = rx_freq self.rx_sdr_device = rx_sdr_device + self.if_gain = if_gain + self.rf_gain = rf_gain + self.dev_args = dev_args + self.bb_gain = bb_gain + self.antenna = antenna + self.ppm = ppm ################################################## # Variables ################################################## self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[rx_sdr_device]['samp_rate'] self.decimation_rx = decimation_rx = satnogs.fm_demod_settings[rx_sdr_device]['decimation_rx'] - + self.taps = taps = firdes.low_pass(12.0, samp_rate_rx, 100e3, 60000, firdes.WIN_HAMMING, 6.76) - + self.quadrature_rate = quadrature_rate = samp_rate_rx / decimation_rx self.audio_samp_rate = audio_samp_rate = 44100 self.audio_gain = audio_gain = satnogs.fm_demod_settings[rx_sdr_device]['audio_gain'] @@ -53,19 +59,19 @@ class satnogs_generic_iq_receiver(gr.top_block): ################################################## self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000, 1500) self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx) - self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] ) + self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) ) self.osmosdr_source_0.set_sample_rate(samp_rate_rx) self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0) - self.osmosdr_source_0.set_freq_corr(0, 0) + self.osmosdr_source_0.set_freq_corr(ppm, 0) self.osmosdr_source_0.set_dc_offset_mode(2, 0) self.osmosdr_source_0.set_iq_balance_mode(0, 0) self.osmosdr_source_0.set_gain_mode(False, 0) - self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[rx_sdr_device]['rf_gain'], 0) - self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[rx_sdr_device]['if_gain'], 0) - self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[rx_sdr_device]['bb_gain'], 0) - self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[rx_sdr_device]['antenna'], 0) + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0) + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0) + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0) + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0) self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0) - + self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(decimation_rx, (taps), lo_offset, samp_rate_rx) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, file_path, False) self.blocks_file_sink_0.set_unbuffered(True) @@ -73,10 +79,10 @@ class satnogs_generic_iq_receiver(gr.top_block): ################################################## # Connections ################################################## - self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq')) - self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_file_sink_0, 0)) - self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0)) - self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) + self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq')) + self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_file_sink_0, 0)) + self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0)) + self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) def get_doppler_correction_per_sec(self): return self.doppler_correction_per_sec @@ -120,12 +126,53 @@ class satnogs_generic_iq_receiver(gr.top_block): self.rx_sdr_device = rx_sdr_device self.set_samp_rate_rx(satnogs.hw_rx_settings[self.rx_sdr_device]['samp_rate']) self.set_decimation_rx(satnogs.fm_demod_settings[self.rx_sdr_device]['decimation_rx']) - self.osmosdr_source_0.set_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['rf_gain'], 0) - self.osmosdr_source_0.set_if_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['if_gain'], 0) - self.osmosdr_source_0.set_bb_gain(satnogs.hw_rx_settings[self.rx_sdr_device]['bb_gain'], 0) - self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[self.rx_sdr_device]['antenna'], 0) + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(self.rx_sdr_device, self.rf_gain), 0) + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(self.rx_sdr_device, self.if_gain), 0) + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(self.rx_sdr_device, self.bb_gain), 0) + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(self.rx_sdr_device, self.antenna), 0) self.set_audio_gain(satnogs.fm_demod_settings[self.rx_sdr_device]['audio_gain']) + def get_if_gain(self): + return self.if_gain + + def set_if_gain(self, if_gain): + self.if_gain = if_gain + self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(self.rx_sdr_device, self.if_gain), 0) + + def get_rf_gain(self): + return self.rf_gain + + def set_rf_gain(self, rf_gain): + self.rf_gain = rf_gain + self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(self.rx_sdr_device, self.rf_gain), 0) + + def get_dev_args(self): + return self.dev_args + + def set_dev_args(self, dev_args): + self.dev_args = dev_args + + def get_bb_gain(self): + return self.bb_gain + + def set_bb_gain(self, bb_gain): + self.bb_gain = bb_gain + self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(self.rx_sdr_device, self.bb_gain), 0) + + def get_antenna(self): + return self.antenna + + def set_antenna(self, antenna): + self.antenna = antenna + self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(self.rx_sdr_device, self.antenna), 0) + + def get_ppm(self): + return self.ppm + + def set_ppm(self, ppm): + self.ppm = ppm + self.osmosdr_source_0.set_freq_corr(self.ppm, 0) + def get_samp_rate_rx(self): return self.samp_rate_rx @@ -195,6 +242,24 @@ def argument_parser(): parser.add_option( "", "--rx-sdr-device", dest="rx_sdr_device", type="string", default='usrpb200', help="Set rx_sdr_device [default=%default]") + parser.add_option( + "", "--if-gain", dest="if_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_if_gain), + help="Set if_gain [default=%default]") + parser.add_option( + "", "--rf-gain", dest="rf_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_rf_gain), + help="Set rf_gain [default=%default]") + parser.add_option( + "", "--dev-args", dest="dev_args", type="string", default=satnogs.not_set_dev_args, + help="Set dev_args [default=%default]") + parser.add_option( + "", "--bb-gain", dest="bb_gain", type="eng_float", default=eng_notation.num_to_str(satnogs.not_set_rx_bb_gain), + help="Set bb_gain [default=%default]") + parser.add_option( + "", "--antenna", dest="antenna", type="string", default=satnogs.not_set_antenna, + help="Set antenna [default=%default]") + parser.add_option( + "", "--ppm", dest="ppm", type="intx", default=0, + help="Set ppm [default=%default]") return parser @@ -202,7 +267,7 @@ def main(top_block_cls=satnogs_generic_iq_receiver, options=None): if options is None: options, _ = argument_parser().parse_args() - tb = top_block_cls(doppler_correction_per_sec=options.doppler_correction_per_sec, file_path=options.file_path, lo_offset=options.lo_offset, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device) + tb = top_block_cls(doppler_correction_per_sec=options.doppler_correction_per_sec, file_path=options.file_path, lo_offset=options.lo_offset, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device, if_gain=options.if_gain, rf_gain=options.rf_gain, dev_args=options.dev_args, bb_gain=options.bb_gain, antenna=options.antenna, ppm=options.ppm) tb.start() tb.wait() diff --git a/python/hw_settings.py b/python/hw_settings.py index 130cf3c..dca1ae1 100644 --- a/python/hw_settings.py +++ b/python/hw_settings.py @@ -49,3 +49,84 @@ hw_rx_settings = {'usrpb200' : {'rf_gain' : 50.0, 'if_gain' : 0.0, 'rtlsdr' : {'rf_gain' : 32.8, 'if_gain' : 0.0, 'bb_gain' : 0.0, 'samp_rate' : 1e6, 'antenna' : '', 'dev_arg' : 'rtl,buffers=32,buflen=16384' }} + +#=============================================================================== +# Default values indicating that the user does not passed any custom value +#=============================================================================== +not_set_rx_rf_gain = -1.0 +not_set_rx_if_gain = -1.0 +not_set_rx_bb_gain = -1.0 +not_set_antenna = '' +not_set_dev_args = '' + +def handle_rx_dev_args(device, dev_args): + """ + Handles the RX device arguments. + :param device: the device name + :type device: string + :param dev_args: the device arguments. Emtpy string for no or default + device arguements + :type dev_args: string + """ + if(len(dev_args) == 0): + return hw_rx_settings[device]['dev_arg'] + else: + return dev_args + +def handle_rx_rf_gain(device, gain): + """ + Handles the RX RF gain. If this parameter is not set from the user + the default settings are returned, otherwise the user setting itself + :param device: the device name + :type device: string + :param gain: the user defined gain value + :type gain: float + """ + if(gain == not_set_rx_rf_gain): + return hw_rx_settings[device]['rf_gain'] + else: + return gain + +def handle_rx_if_gain(device, gain): + """ + Handles the IF RF gain. If this parameter is not set from the user + the default settings are returned, otherwise the user setting itself + :param device: the device name + :type device: string + :param gain: the user defined gain value + :type gain: float + """ + if(gain == not_set_rx_if_gain): + return hw_rx_settings[device]['if_gain'] + else: + return gain + + +def handle_rx_bb_gain(device, gain): + """ + Handles the RX BB gain. If this parameter is not set from the user + the default settings are returned, otherwise the user setting itself + :param device: the device name + :type device: string + :param gain: the user defined gain value + :type gain: float + """ + if(gain == not_set_rx_bb_gain): + return hw_rx_settings[device]['bb_gain'] + else: + return gain + +def handle_rx_antenna(device, antenna): + """ + Handles the RX antenna. If this parameter is not set from the user + the default settings are returned, otherwise the user setting itself + :param device: the device name + :type device: string + :param gain: the user defined antenna + :type gain: string + """ + if(len(antenna) == 0): + return hw_rx_settings[device]['antenna'] + else: + return antenna + \ No newline at end of file