diff --git a/apps/flowgraphs/cw_decoder.grc b/apps/flowgraphs/cw_decoder.grc index a3dbf71..72539a9 100644 --- a/apps/flowgraphs/cw_decoder.grc +++ b/apps/flowgraphs/cw_decoder.grc @@ -93,7 +93,34 @@ _coordinate - (821, 857) + (430, 777) + + + _rotation + 0 + + + id + audio_samp_rate + + + value + 48000 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (574, 546) _rotation @@ -120,7 +147,7 @@ _coordinate - (271, 905) + (175, 546) _rotation @@ -148,7 +175,7 @@ TX sampling rate _coordinate - (382, 865) + (247, 546) _rotation @@ -183,7 +210,7 @@ TX sampling rate _coordinate - (63, 837) + (31, 542) _rotation @@ -249,7 +276,7 @@ TX sampling rate _coordinate - (694, 857) + (446, 546) _rotation @@ -328,7 +355,7 @@ TX sampling rate - audio_sink + parameter alias @@ -337,21 +364,13 @@ TX sampling rate comment - - affinity - - - - device_name - - _enabled - 0 + True _coordinate - (1603, 123) + (263, 769) _rotation @@ -359,19 +378,66 @@ TX sampling rate id - audio_sink_0 + antenna - num_inputs - 1 + label + - ok_to_block + short_id + + + + type + string + + + value + satnogs.not_set_antenna + + + + parameter + + alias + + + + comment + + + + _enabled True - samp_rate - 48000 + _coordinate + (183, 769) + + + _rotation + 0 + + + id + bb_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_bb_gain @@ -433,11 +499,11 @@ TX sampling rate _enabled - 0 + 1 _coordinate - (1220, 127) + (1069, 199) _rotation @@ -535,7 +601,7 @@ TX sampling rate _coordinate - (1779, 474) + (1883, 394) _rotation @@ -551,7 +617,7 @@ TX sampling rate max_iter - 4000 + 40 maxoutbuf @@ -630,7 +696,7 @@ CW beacon to be audable. _coordinate - (925, 857) + (678, 546) _rotation @@ -673,7 +739,93 @@ CW beacon to be audable. _coordinate - (64, 984) + (789, 777) + + + _rotation + 0 + + + id + decoded_data_file_path + + + label + + + + short_id + + + + type + string + + + value + /tmp/.satnogs/data/data + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (351, 769) + + + _rotation + 0 + + + id + dev_args + + + label + + + + short_id + + + + type + string + + + value + satnogs.not_set_dev_args + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (31, 690) _rotation @@ -716,7 +868,50 @@ CW beacon to be audable. _coordinate - (582, 985) + (670, 777) + + + _rotation + 0 + + + id + enable_iq_dump + + + label + + + + short_id + + + + type + intx + + + value + 0 + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (550, 690) _rotation @@ -857,6 +1052,49 @@ CW beacon to be audable. ccc + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (103, 769) + + + _rotation + 0 + + + id + if_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_if_gain + + import @@ -888,6 +1126,49 @@ CW beacon to be audable. import satnogs + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (558, 777) + + + _rotation + 0 + + + id + iq_file_path + + + label + + + + short_id + + + + type + string + + + value + /tmp/iq.dat + + parameter @@ -905,7 +1186,7 @@ we shift the LO a little further _coordinate - (494, 857) + (351, 546) _rotation @@ -1015,11 +1296,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 @@ -1043,7 +1324,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 @@ -1051,7 +1332,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 @@ -2303,7 +2584,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 @@ -2311,7 +2592,7 @@ we shift the LO a little further _coordinate - (16, 376) + (15, 311) _rotation @@ -2430,7 +2711,7 @@ we shift the LO a little further _coordinate - (821, 985) + (789, 690) _rotation @@ -2457,668 +2738,6 @@ we shift the LO a little further 0 - - qtgui_freq_sink_x - - autoscale - False - - - average - 1.0 - - - axislabels - True - - - bw - samp_rate_rx/xlating_decimation - - - alias - - - - fc - 0 - - - comment - - - - ctrlpanel - False - - - affinity - - - - _enabled - True - - - fftsize - 1024 - - - _coordinate - (702, 470) - - - gui_hint - - - - _rotation - 0 - - - grid - False - - - id - qtgui_freq_sink_x_0 - - - legend - True - - - alpha1 - 1.0 - - - color1 - "blue" - - - label1 - - - - width1 - 1 - - - alpha10 - 1.0 - - - color10 - "dark blue" - - - label10 - - - - width10 - 1 - - - alpha2 - 1.0 - - - color2 - "red" - - - label2 - - - - width2 - 1 - - - alpha3 - 1.0 - - - color3 - "green" - - - label3 - - - - width3 - 1 - - - alpha4 - 1.0 - - - color4 - "black" - - - label4 - - - - width4 - 1 - - - alpha5 - 1.0 - - - color5 - "cyan" - - - label5 - - - - width5 - 1 - - - alpha6 - 1.0 - - - color6 - "magenta" - - - label6 - - - - width6 - 1 - - - alpha7 - 1.0 - - - color7 - "yellow" - - - label7 - - - - width7 - 1 - - - alpha8 - 1.0 - - - color8 - "dark red" - - - label8 - - - - width8 - 1 - - - alpha9 - 1.0 - - - color9 - "dark green" - - - label9 - - - - width9 - 1 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - name - "" - - - nconnections - 1 - - - showports - True - - - freqhalf - True - - - tr_chan - 0 - - - tr_level - 0.0 - - - tr_mode - qtgui.TRIG_MODE_FREE - - - tr_tag - "" - - - type - complex - - - update_time - 0.10 - - - wintype - firdes.WIN_BLACKMAN_hARRIS - - - label - Relative Gain - - - ymax - 10 - - - ymin - -140 - - - units - dB - - - - qtgui_time_sink_x - - autoscale - False - - - axislabels - True - - - alias - - - - comment - - - - ctrlpanel - False - - - affinity - - - - entags - True - - - _enabled - True - - - _coordinate - (1739, 610) - - - gui_hint - - - - _rotation - 0 - - - grid - False - - - id - qtgui_time_sink_x_0 - - - legend - True - - - alpha1 - 1.0 - - - color1 - "blue" - - - label1 - - - - marker1 - -1 - - - style1 - 1 - - - width1 - 1 - - - alpha10 - 1.0 - - - color10 - "blue" - - - label10 - - - - marker10 - -1 - - - style10 - 1 - - - width10 - 1 - - - alpha2 - 1.0 - - - color2 - "red" - - - label2 - - - - marker2 - -1 - - - style2 - 1 - - - width2 - 1 - - - alpha3 - 1.0 - - - color3 - "green" - - - label3 - - - - marker3 - -1 - - - style3 - 1 - - - width3 - 1 - - - alpha4 - 1.0 - - - color4 - "black" - - - label4 - - - - marker4 - -1 - - - style4 - 1 - - - width4 - 1 - - - alpha5 - 1.0 - - - color5 - "cyan" - - - label5 - - - - marker5 - -1 - - - style5 - 1 - - - width5 - 1 - - - alpha6 - 1.0 - - - color6 - "magenta" - - - label6 - - - - marker6 - -1 - - - style6 - 1 - - - width6 - 1 - - - alpha7 - 1.0 - - - color7 - "yellow" - - - label7 - - - - marker7 - -1 - - - style7 - 1 - - - width7 - 1 - - - alpha8 - 1.0 - - - color8 - "dark red" - - - label8 - - - - marker8 - -1 - - - style8 - 1 - - - width8 - 1 - - - alpha9 - 1.0 - - - color9 - "dark green" - - - label9 - - - - marker9 - -1 - - - style9 - 1 - - - width9 - 1 - - - name - "" - - - nconnections - 1 - - - size - 1024 - - - srate - int((samp_rate_rx/xlating_decimation)/lpf_decimation) - - - tr_chan - 0 - - - tr_delay - 0 - - - tr_level - 0.0 - - - tr_mode - qtgui.TRIG_MODE_FREE - - - tr_slope - qtgui.TRIG_SLOPE_POS - - - tr_tag - "" - - - type - float - - - update_time - 0.10 - - - ylabel - Amplitude - - - yunit - "" - - - ymax - 1 - - - ymin - -1 - - rational_resampler_xxx @@ -3139,7 +2758,7 @@ we shift the LO a little further _enabled - 0 + 1 fbw @@ -3147,7 +2766,7 @@ we shift the LO a little further _coordinate - (1420, 103) + (845, 103) _rotation @@ -3159,7 +2778,7 @@ we shift the LO a little further interp - 48000 + audio_samp_rate maxoutbuf @@ -3175,7 +2794,7 @@ we shift the LO a little further type - fff + ccc @@ -3194,7 +2813,50 @@ we shift the LO a little further _coordinate - (390, 985) + (31, 769) + + + _rotation + 0 + + + id + rf_gain + + + label + + + + short_id + + + + type + eng_float + + + value + satnogs.not_set_rx_rf_gain + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (359, 690) _rotation @@ -3237,7 +2899,7 @@ we shift the LO a little further _coordinate - (494, 985) + (462, 690) _rotation @@ -3280,7 +2942,7 @@ we shift the LO a little further _coordinate - (271, 985) + (239, 690) _rotation @@ -3327,7 +2989,7 @@ we shift the LO a little further _coordinate - (279, 263) + (303, 263) _rotation @@ -3360,10 +3022,6 @@ we shift the LO a little further threshold 300000 - - auto_config - False - alias @@ -3386,7 +3044,7 @@ we shift the LO a little further _coordinate - (1412, 494) + (1627, 406) _rotation @@ -3413,6 +3071,92 @@ we shift the LO a little further wpm + + satnogs_frame_file_sink + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (1093, 450) + + + _rotation + 180 + + + id + satnogs_frame_file_sink_0_0 + + + output_type + 0 + + + prefix_name + decoded_data_file_path + + + + satnogs_iq_sink + + append + False + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + filename + iq_file_path + + + _coordinate + (1069, 123) + + + _rotation + 0 + + + id + satnogs_iq_sink_0 + + + scale + 16768 + + + status + enable_iq_dump + + satnogs_morse_decoder @@ -3433,7 +3177,7 @@ we shift the LO a little further _coordinate - (1172, 522) + (1396, 426) _rotation @@ -3457,7 +3201,7 @@ we shift the LO a little further - satnogs_multi_format_msg_sink + satnogs_ogg_encoder alias @@ -3472,35 +3216,31 @@ we shift the LO a little further _enabled - 1 + True filename - test.txt + file_path _coordinate - (941, 506) + (1244, 179) _rotation - 180 + 0 id - satnogs_multi_format_msg_sink_0 + satnogs_ogg_encoder_0 - outstream - True + quality + 1.0 - timestamp - True - - - format - 0 + samp_rate + audio_samp_rate @@ -3562,6 +3302,61 @@ we shift the LO a little further 1000 + + satnogs_waterfall_sink + + alias + + + + center_freq + 0.0 + + + comment + + + + affinity + + + + _enabled + True + + + fft_size + 1024 + + + filename + waterfall_file_path + + + _coordinate + (1069, 7) + + + _rotation + 0 + + + id + satnogs_waterfall_sink_0 + + + mode + 1 + + + pps + 10 + + + samp_rate + (samp_rate_rx/xlating_decimation) + + parameter @@ -3578,7 +3373,7 @@ we shift the LO a little further _coordinate - (686, 985) + (654, 690) _rotation @@ -3621,7 +3416,7 @@ we shift the LO a little further _coordinate - (893, 985) + (861, 690) _rotation @@ -3648,12 +3443,6 @@ we shift the LO a little further 20 - - analog_agc2_xx_0 - blocks_complex_to_real_0 - 0 - 0 - analog_agc2_xx_0 blocks_delay_0 @@ -3674,7 +3463,7 @@ we shift the LO a little further blocks_complex_to_real_0 - rational_resampler_xxx_0 + satnogs_ogg_encoder_0 0 0 @@ -3684,12 +3473,6 @@ we shift the LO a little further 0 1 - - blocks_moving_average_xx_0 - qtgui_time_sink_x_0 - 0 - 0 - blocks_moving_average_xx_0 satnogs_cw_to_symbol_0 @@ -3722,7 +3505,7 @@ we shift the LO a little further low_pass_filter_0 - qtgui_freq_sink_x_0 + rational_resampler_xxx_0 0 0 @@ -3734,7 +3517,19 @@ we shift the LO a little further rational_resampler_xxx_0 - audio_sink_0 + blocks_complex_to_real_0 + 0 + 0 + + + rational_resampler_xxx_0 + satnogs_iq_sink_0 + 0 + 0 + + + rational_resampler_xxx_0 + satnogs_waterfall_sink_0 0 0 @@ -3752,9 +3547,9 @@ we shift the LO a little further satnogs_morse_decoder_0 - satnogs_multi_format_msg_sink_0 + satnogs_frame_file_sink_0_0 out - in + frame satnogs_tcp_rigctl_msg_source_0 diff --git a/apps/flowgraphs/satnogs_cw_decoder.py b/apps/flowgraphs/satnogs_cw_decoder.py index 703fc04..dde15d5 100755 --- a/apps/flowgraphs/satnogs_cw_decoder.py +++ b/apps/flowgraphs/satnogs_cw_decoder.py @@ -5,7 +5,7 @@ # Title: CW Decoder # Author: Manolis Surligas (surligas@gmail.com) # Description: A CW (Morse) Decoder -# Generated: Tue Apr 25 21:28:22 2017 +# Generated: Wed Nov 1 21:56:56 2017 ################################################## if __name__ == '__main__': @@ -24,13 +24,11 @@ from gnuradio import blocks from gnuradio import eng_notation from gnuradio import filter from gnuradio import gr -from gnuradio import qtgui from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from optparse import OptionParser import osmosdr import satnogs -import sip import sys import time from gnuradio import qtgui @@ -38,7 +36,7 @@ from gnuradio import qtgui class satnogs_cw_decoder(gr.top_block, Qt.QWidget): - def __init__(self, cw_offset=700, doppler_correction_per_sec=1000, file_path='test.txt', lo_offset=100e3, ppm=0, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', waterfall_file_path='/tmp/waterfall.dat', wpm=20): + def __init__(self, antenna=satnogs.not_set_antenna, bb_gain=satnogs.not_set_rx_bb_gain, cw_offset=700, decoded_data_file_path='/tmp/.satnogs/data/data', dev_args=satnogs.not_set_dev_args, doppler_correction_per_sec=1000, enable_iq_dump=0, file_path='test.txt', if_gain=satnogs.not_set_rx_if_gain, iq_file_path='/tmp/iq.dat', 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', wpm=20): gr.top_block.__init__(self, "CW Decoder") Qt.QWidget.__init__(self) self.setWindowTitle("CW Decoder") @@ -65,11 +63,19 @@ class satnogs_cw_decoder(gr.top_block, Qt.QWidget): ################################################## # Parameters ################################################## + self.antenna = antenna + self.bb_gain = bb_gain self.cw_offset = cw_offset + self.decoded_data_file_path = decoded_data_file_path + self.dev_args = dev_args self.doppler_correction_per_sec = doppler_correction_per_sec + self.enable_iq_dump = enable_iq_dump self.file_path = file_path + self.if_gain = if_gain + self.iq_file_path = iq_file_path 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 @@ -87,116 +93,36 @@ class satnogs_cw_decoder(gr.top_block, Qt.QWidget): self.ndelay = ndelay = 250 self.lpf_decimation = lpf_decimation = 5 + self.audio_samp_rate = audio_samp_rate = 48000 ################################################## # Blocks ################################################## + self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink((samp_rate_rx/xlating_decimation), 0.0, 10, 1024, waterfall_file_path, 1) self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000, 1500) - self.satnogs_multi_format_msg_sink_0 = satnogs.multi_format_msg_sink(0, True, True, 'test.txt') + self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(file_path, audio_samp_rate, 1.0) self.satnogs_morse_decoder_0 = satnogs.morse_decoder(ord('#')) - self.satnogs_cw_to_symbol_0 = satnogs.cw_to_symbol(int((samp_rate_rx/xlating_decimation)/lpf_decimation), 300000, 0.9, wpm, False) + self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, iq_file_path, False, enable_iq_dump) + self.satnogs_frame_file_sink_0_0 = satnogs.frame_file_sink(decoded_data_file_path, 0) + self.satnogs_cw_to_symbol_0 = satnogs.cw_to_symbol(int((samp_rate_rx/xlating_decimation)/lpf_decimation), 300000, 0.9, wpm) self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx) - self.qtgui_time_sink_x_0 = qtgui.time_sink_f( - 1024, #size - int((samp_rate_rx/xlating_decimation)/lpf_decimation), #samp_rate - "", #name - 1 #number of inputs + self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( + interpolation=audio_samp_rate, + decimation=int((samp_rate_rx/xlating_decimation)/lpf_decimation), + taps=None, + fractional_bw=None, ) - self.qtgui_time_sink_x_0.set_update_time(0.10) - self.qtgui_time_sink_x_0.set_y_axis(-1, 1) - - self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") - - self.qtgui_time_sink_x_0.enable_tags(-1, True) - self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") - self.qtgui_time_sink_x_0.enable_autoscale(False) - self.qtgui_time_sink_x_0.enable_grid(False) - self.qtgui_time_sink_x_0.enable_axis_labels(True) - self.qtgui_time_sink_x_0.enable_control_panel(False) - - if not True: - self.qtgui_time_sink_x_0.disable_legend() - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "blue"] - styles = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - markers = [-1, -1, -1, -1, -1, - -1, -1, -1, -1, -1] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in xrange(1): - if len(labels[i]) == 0: - self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) - self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) - self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) - self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) - self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) - self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) - self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) - self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( - 1024, #size - firdes.WIN_BLACKMAN_hARRIS, #wintype - 0, #fc - samp_rate_rx/xlating_decimation, #bw - "", #name - 1 #number of inputs - ) - self.qtgui_freq_sink_x_0.set_update_time(0.10) - self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) - self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') - self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") - self.qtgui_freq_sink_x_0.enable_autoscale(False) - self.qtgui_freq_sink_x_0.enable_grid(False) - self.qtgui_freq_sink_x_0.set_fft_average(1.0) - self.qtgui_freq_sink_x_0.enable_axis_labels(True) - self.qtgui_freq_sink_x_0.enable_control_panel(False) - - if not True: - self.qtgui_freq_sink_x_0.disable_legend() - - if "complex" == "float" or "complex" == "msg_float": - self.qtgui_freq_sink_x_0.set_plot_pos_half(not True) - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - for i in xrange(1): - if len(labels[i]) == 0: - self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) - self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) - self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) - self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) - self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win) - 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(lpf_decimation, firdes.low_pass( @@ -205,8 +131,9 @@ class satnogs_cw_decoder(gr.top_block, Qt.QWidget): self.fir_filter_xxx_0 = filter.fir_filter_ccc(1, ([1,] * ndelay)) self.fir_filter_xxx_0.declare_sample_delay(0) self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1) - self.blocks_moving_average_xx_0 = blocks.moving_average_ff(ndelay, 1, 4000) + self.blocks_moving_average_xx_0 = blocks.moving_average_ff(ndelay, 1, 40) self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, ndelay) + self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1) self.analog_agc2_xx_0 = analog.agc2_cc(0.1, 0.8, 0.6, 0.0) self.analog_agc2_xx_0.set_max_gain(1e3) @@ -215,20 +142,23 @@ class satnogs_cw_decoder(gr.top_block, Qt.QWidget): # Connections ################################################## self.msg_connect((self.satnogs_cw_to_symbol_0, 'out'), (self.satnogs_morse_decoder_0, 'in')) - self.msg_connect((self.satnogs_morse_decoder_0, 'out'), (self.satnogs_multi_format_msg_sink_0, 'in')) + self.msg_connect((self.satnogs_morse_decoder_0, 'out'), (self.satnogs_frame_file_sink_0_0, 'frame')) self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq')) self.connect((self.analog_agc2_xx_0, 0), (self.blocks_delay_0, 0)) self.connect((self.analog_agc2_xx_0, 0), (self.blocks_multiply_conjugate_cc_0, 0)) self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_moving_average_xx_0, 0)) + self.connect((self.blocks_complex_to_real_0, 0), (self.satnogs_ogg_encoder_0, 0)) self.connect((self.blocks_delay_0, 0), (self.blocks_multiply_conjugate_cc_0, 1)) - self.connect((self.blocks_moving_average_xx_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_moving_average_xx_0, 0), (self.satnogs_cw_to_symbol_0, 0)) self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.fir_filter_xxx_0, 0)) self.connect((self.fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.low_pass_filter_0, 0)) self.connect((self.low_pass_filter_0, 0), (self.analog_agc2_xx_0, 0)) - self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_0, 0)) + self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0)) self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0)) + self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_complex_to_real_0, 0)) + self.connect((self.rational_resampler_xxx_0, 0), (self.satnogs_iq_sink_0, 0)) + self.connect((self.rational_resampler_xxx_0, 0), (self.satnogs_waterfall_sink_0, 0)) self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) def closeEvent(self, event): @@ -236,6 +166,20 @@ class satnogs_cw_decoder(gr.top_block, Qt.QWidget): self.settings.setValue("geometry", self.saveGeometry()) event.accept() + 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_cw_offset(self): return self.cw_offset @@ -243,18 +187,49 @@ class satnogs_cw_decoder(gr.top_block, Qt.QWidget): self.cw_offset = cw_offset self.freq_xlating_fir_filter_xxx_0.set_center_freq(self.lo_offset - self.cw_offset) + def get_decoded_data_file_path(self): + return self.decoded_data_file_path + + def set_decoded_data_file_path(self, decoded_data_file_path): + self.decoded_data_file_path = decoded_data_file_path + + 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 def set_doppler_correction_per_sec(self, doppler_correction_per_sec): self.doppler_correction_per_sec = doppler_correction_per_sec + def get_enable_iq_dump(self): + return self.enable_iq_dump + + def set_enable_iq_dump(self, enable_iq_dump): + self.enable_iq_dump = enable_iq_dump + def get_file_path(self): return self.file_path 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_iq_file_path(self): + return self.iq_file_path + + def set_iq_file_path(self, iq_file_path): + self.iq_file_path = iq_file_path + def get_lo_offset(self): return self.lo_offset @@ -270,6 +245,13 @@ class satnogs_cw_decoder(gr.top_block, Qt.QWidget): 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 @@ -290,10 +272,10 @@ class satnogs_cw_decoder(gr.top_block, Qt.QWidget): 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_waterfall_file_path(self): return self.waterfall_file_path @@ -313,8 +295,6 @@ class satnogs_cw_decoder(gr.top_block, Qt.QWidget): def set_samp_rate_rx(self, samp_rate_rx): self.samp_rate_rx = samp_rate_rx self.set_xlate_filter_taps(firdes.low_pass(1, self.samp_rate_rx, 125000, 25000, firdes.WIN_HAMMING, 6.76)) - self.qtgui_time_sink_x_0.set_samp_rate(int((self.samp_rate_rx/self.xlating_decimation)/self.lpf_decimation)) - self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate_rx/self.xlating_decimation) self.osmosdr_source_0.set_sample_rate(self.samp_rate_rx) self.osmosdr_source_0.set_bandwidth(self.samp_rate_rx, 0) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate_rx/self.xlating_decimation, 2e3, 500, firdes.WIN_HAMMING, 6.76)) @@ -324,8 +304,6 @@ class satnogs_cw_decoder(gr.top_block, Qt.QWidget): def set_xlating_decimation(self, xlating_decimation): self.xlating_decimation = xlating_decimation - self.qtgui_time_sink_x_0.set_samp_rate(int((self.samp_rate_rx/self.xlating_decimation)/self.lpf_decimation)) - self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate_rx/self.xlating_decimation) self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate_rx/self.xlating_decimation, 2e3, 500, firdes.WIN_HAMMING, 6.76)) def get_xlate_filter_taps(self): @@ -355,27 +333,56 @@ class satnogs_cw_decoder(gr.top_block, Qt.QWidget): def set_lpf_decimation(self, lpf_decimation): self.lpf_decimation = lpf_decimation - self.qtgui_time_sink_x_0.set_samp_rate(int((self.samp_rate_rx/self.xlating_decimation)/self.lpf_decimation)) + + def get_audio_samp_rate(self): + return self.audio_samp_rate + + def set_audio_samp_rate(self, audio_samp_rate): + self.audio_samp_rate = audio_samp_rate def argument_parser(): description = 'A CW (Morse) Decoder' 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( "", "--cw-offset", dest="cw_offset", type="eng_float", default=eng_notation.num_to_str(700), help="Set cw_offset [default=%default]") + parser.add_option( + "", "--decoded-data-file-path", dest="decoded_data_file_path", type="string", default='/tmp/.satnogs/data/data', + help="Set decoded_data_file_path [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( + "", "--enable-iq-dump", dest="enable_iq_dump", type="intx", default=0, + help="Set enable_iq_dump [default=%default]") parser.add_option( "", "--file-path", dest="file_path", type="string", default='test.txt', 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( + "", "--iq-file-path", dest="iq_file_path", type="string", default='/tmp/iq.dat', + help="Set iq_file_path [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]") @@ -404,7 +411,7 @@ def main(top_block_cls=satnogs_cw_decoder, options=None): Qt.QApplication.setGraphicsSystem(style) qapp = Qt.QApplication(sys.argv) - 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, wpm=options.wpm) + tb = top_block_cls(antenna=options.antenna, bb_gain=options.bb_gain, cw_offset=options.cw_offset, decoded_data_file_path=options.decoded_data_file_path, dev_args=options.dev_args, doppler_correction_per_sec=options.doppler_correction_per_sec, enable_iq_dump=options.enable_iq_dump, file_path=options.file_path, if_gain=options.if_gain, iq_file_path=options.iq_file_path, 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, wpm=options.wpm) tb.start() tb.show() diff --git a/include/satnogs/config.h b/include/satnogs/config.h index d423fb3..5771e62 100644 --- a/include/satnogs/config.h +++ b/include/satnogs/config.h @@ -24,7 +24,7 @@ /*! * Enable debug messages for the module */ -#define ENABLE_DEBUG_MSG 1 +#define ENABLE_DEBUG_MSG 0 /*! * Enable debug messages for the CW decoding mechanism diff --git a/lib/cw_to_symbol_impl.cc b/lib/cw_to_symbol_impl.cc index 95b3f46..abcf226 100644 --- a/lib/cw_to_symbol_impl.cc +++ b/lib/cw_to_symbol_impl.cc @@ -55,7 +55,7 @@ namespace gr d_sampling_rate (sampling_rate), d_act_thrshld (threshold), d_confidence_level (conf_level), - d_dot_samples ((1.2 / wpm) / (1.0 / sampling_rate)), + d_dot_samples ((1.2 / wpm) * sampling_rate), d_window_size(0), d_window_cnt(0), d_dot_windows_num(0), @@ -103,8 +103,8 @@ namespace gr d_window_size++; } - LOG_DEBUG("Dot samples: %lu", d_dot_samples); - LOG_DEBUG("Window size: %lu", d_window_size); + LOG_WARN("Dot symbol samples: %lu", d_dot_samples); + LOG_WARN("Window size: %lu", d_window_size); /* Set the duration of each symbol in multiples of the window size */ d_dot_windows_num = d_dot_samples / d_window_size; @@ -236,6 +236,7 @@ namespace gr d_window_cnt++; if(d_window_cnt > d_dot_windows_num) { set_long_on(); + LOG_DEBUG("Going to search for long sequence"); } } else { @@ -243,6 +244,7 @@ namespace gr LOG_DEBUG("DOT"); send_symbol_msg(MORSE_DOT); } + LOG_DEBUG("Going to search for space: win cnt %lu", d_window_cnt); set_search_space (); } break; @@ -260,6 +262,7 @@ namespace gr send_symbol_msg(MORSE_DOT); } set_search_space (); + LOG_DEBUG("Going to search for space"); } break; case SEARCH_SPACE: @@ -273,6 +276,7 @@ namespace gr send_symbol_msg(MORSE_S_SPACE); } set_short_on(); + LOG_DEBUG("Going to search for dot"); } else{ d_window_cnt++; @@ -280,6 +284,7 @@ namespace gr LOG_DEBUG("LONG SPACE"); send_symbol_msg(MORSE_L_SPACE); set_idle(); + LOG_DEBUG("Going to idle"); return (i + 1) * d_window_size; } }