diff --git a/lib/rds_decoder_redsea_impl.cc b/lib/rds_decoder_redsea_impl.cc index 91f6dcb..003807f 100644 --- a/lib/rds_decoder_redsea_impl.cc +++ b/lib/rds_decoder_redsea_impl.cc @@ -30,6 +30,7 @@ #include "rds_decoder_redsea_impl.h" #include #include +#include namespace gr { namespace multirds { @@ -100,6 +101,8 @@ void rds_decoder_redsea_impl::enter_sync(uint16_t sync_block_number) { block_bit_counter = 0; block_number = (sync_block_number + 1) % 4; group_assembly_started = false; + last_pi =0x0000; + group_corrected_blocks_counter =0; d_state = SYNC; } /* see Annex B, page 64 of the standard */ @@ -137,7 +140,7 @@ static const char * const offset_name[]={"A","B","C","D","c"};*/ // Kopitz & Marks 1999: "RDS: The Radio Data System", p. 224 //for (uint32_t e=0x1;e <= 0x3;e+=0x2) {//for (uint32_t e : {0x1, 0x3}) { //for (uint32_t e : {0x1, 0x3, 0x7,0x15,0x31}) {//fix up to 5 bit burst errors (as code should support) - for (uint32_t e : {0x1, 0x3}) {//fix up to 2 bit burst errors (as book says) + for (uint32_t e : {0x1,0x3}) {//fix up to 2-bit burst errors (as book says) for (int shift=0; shift < 26; shift++) { uint32_t errvec = ((e << shift) & kBitmask26); uint16_t sy = calc_syndrome(errvec ^ offset_word[offset_num],26); @@ -157,7 +160,9 @@ uint32_t rds_decoder_redsea_impl::correctBurstErrors(uint32_t block, char offset if (kErrorLookup.count({(uint16_t)syndrome, (char)offset}) > 0) { uint32_t err = kErrorLookup.at({(uint16_t)syndrome, (char)offset}); //dout << "correcting"<>10) & 0xffff; checkword=corrected_block & 0x3ff; + + //dout << "corrected error"<>1); + uint16_t diff2=(dataword>>1)^(last_pi); + unsigned int num_diff_bits = std::bitset<16>(diff).count(); + unsigned int num_diff_bits2 = std::bitset<16>(diff2).count(); + if (num_diff_bits<2 or num_diff_bits2<2){ + dout << "clockslip detection:"<(dataword)<<"\tlast_pi:"<(last_pi)<>10) & 0xffff; checkword=corrected_block & 0x3ff; + //dout << "corrected error"< read group type variant variant=(dataword>>11)& 0x1; -// uint8_t group=(dataword>>12)& 0xf; -// dout << "group:"<< unsigned(group); -// dout << "\tvariant:" << unsigned(variant); + uint8_t group=(dataword>>12)& 0xf; +// dout << "group:"<. +# +# This is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +from gnuradio import blocks +from rds_parser_table_qt import rds_parser_table_qt + +class qa_rds_parser_table_qt (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test_001_t (self): + # set up fg + self.tb.run () + # check data + + +if __name__ == '__main__': + gr_unittest.run(qa_rds_parser_table_qt, "qa_rds_parser_table_qt.xml") diff --git a/python/rds_parser_table_qt.py b/python/rds_parser_table_qt.py index ce2863b..82c86ae 100644 --- a/python/rds_parser_table_qt.py +++ b/python/rds_parser_table_qt.py @@ -1272,7 +1272,7 @@ class rds_parser_table_qt_Widget(QtGui.QWidget): #self.tableobj.decoders[port]['PI'] inport=pmt.from_long(port) outport=pmt.from_long(audio_channel) - print("sending chan:%i"%audio_channel) + #print("sending chan:%i"%audio_channel) send_pmt=pmt.cons(inport, outport) #make PDU: (metadata, data) pair self.tableobj.message_port_pub(pmt.intern('ctrl'), send_pmt)