Browse Source

removed debug in rds decoder, added exception handling in CT (group 4A) decoding

master
Clemens Richter 9 years ago
parent
commit
b590ee2479
  1. 14
      lib/rds_decoder_redsea_impl.cc
  2. 24
      python/rds_parser_table_qt.py

14
lib/rds_decoder_redsea_impl.cc

@ -57,15 +57,15 @@ namespace gr {
dout << "constructing error lookup table"<<std::endl; dout << "constructing error lookup table"<<std::endl;
kErrorLookup = makeErrorLookupTable(); kErrorLookup = makeErrorLookupTable();
dout<< kErrorLookup.count({(uint16_t)7, 'A'})<< std::endl; //dout<< kErrorLookup.count({(uint16_t)7, 'A'})<< std::endl;
dout<< kErrorLookup.count({(uint16_t)7, 'B'})<< std::endl; //dout<< kErrorLookup.count({(uint16_t)7, 'B'})<< std::endl;
//dout<< kErrorLookup.count({(uint16_t)7, 'A'})<< std::endl; //dout<< kErrorLookup.count({(uint16_t)7, 'A'})<< std::endl;
//dout<< kErrorLookup.at({704, 'A'})<< std::endl; //dout<< kErrorLookup.at({704, 'A'})<< std::endl;
//~ if (kErrorLookup.count({(uint16_t)14, (char)'A'}) > 0) { //~ if (kErrorLookup.count({(uint16_t)14, (char)'A'}) > 0) {
//~ dout<<"found sy 14 offset A in table"<<std::endl; //~ dout<<"found sy 14 offset A in table"<<std::endl;
//~ } //~ }
std::cout<< "i am new"<< std::endl; dout<< "i am new"<< std::endl;
//dout<< kErrorLookup.at({704, 'A'})<< std::endl; //dout<< kErrorLookup.at({704, 'A'})<< std::endl;
} }
@ -256,7 +256,7 @@ int rds_decoder_redsea_impl::work (int noutput_items,
dataword=(corrected_block>>10) & 0xffff; dataword=(corrected_block>>10) & 0xffff;
checkword=corrected_block & 0x3ff; checkword=corrected_block & 0x3ff;
offset_char = 'C'; offset_char = 'C';
lout << "corrected error"<<std::endl; //dout << "corrected error"<<std::endl;
} }
else{ else{
block_received_crc=checkword^offset_word[4]; block_received_crc=checkword^offset_word[4];
@ -284,7 +284,11 @@ int rds_decoder_redsea_impl::work (int noutput_items,
good_block=true; good_block=true;
dataword=(corrected_block>>10) & 0xffff; dataword=(corrected_block>>10) & 0xffff;
checkword=corrected_block & 0x3ff; checkword=corrected_block & 0x3ff;
lout << "corrected error"<<std::endl; //dout << "corrected error"<<std::endl;
//dout << "old: rx:"<<block_received_crc<<"\tcalc:"<<block_calculated_crc<<std::endl;
//block_received_crc=checkword^offset_word[block_number];
//block_calculated_crc=calc_syndrome(dataword,16);
//dout << "new: rx:"<<block_received_crc<<"\tcalc:"<<block_calculated_crc<<std::endl;
offset_char=expected_offset_char[block_number]; offset_char=expected_offset_char[block_number];
} }
else{ else{

24
python/rds_parser_table_qt.py

@ -639,20 +639,20 @@ class rds_parser_table_qt(gr.sync_block):#START
#local_time_offset=0.5*((array[7])&0x1F) #local_time_offset=0.5*((array[7])&0x1F)
if(offsetdir==1): if(offsetdir==1):
local_time_offset*=-1 local_time_offset*=-1
date=datetime(1858,11,17)+timedelta(days=int(datecode))#convert from MJD (modified julian date)
timestring="%02i:%02i (%+.1fh)" % (hours,minutes,local_time_offset)
datestring=date.strftime("%d.%m.%Y")
ctcol=self.colorder.index('time')
self.signals.DataUpdateEvent.emit({'col':ctcol,'row':port,'PI':PI,'string':timestring,'tooltip':datestring})
t=(str(datetime.now()),PI,self.RDS_data[PI]["PSN"],"CT",datestring+" "+timestring+"; datecode(MJD):"+str(datecode))
self.RDS_data[PI]["time"]["timestring"]=timestring
self.RDS_data[PI]["time"]["datestring"]=datestring
try: try:
date=datetime(1858,11,17)+timedelta(days=int(datecode))#convert from MJD (modified julian date)
timestring="%02i:%02i (%+.1fh)" % (hours,minutes,local_time_offset)
datestring=date.strftime("%d.%m.%Y")
ctcol=self.colorder.index('time')
self.signals.DataUpdateEvent.emit({'col':ctcol,'row':port,'PI':PI,'string':timestring,'tooltip':datestring})
t=(str(datetime.now()),PI,self.RDS_data[PI]["PSN"],"CT",datestring+" "+timestring+"; datecode(MJD):"+str(datecode))
self.RDS_data[PI]["time"]["timestring"]=timestring
self.RDS_data[PI]["time"]["datestring"]=datestring
self.RDS_data[PI]["time"]["datetime"]=datetime(date.year,date.month,date.day,hours,minutes)+timedelta(hours=local_time_offset) self.RDS_data[PI]["time"]["datetime"]=datetime(date.year,date.month,date.day,hours,minutes)+timedelta(hours=local_time_offset)
except ValueError: except ValueError as e:
print("ERROR: could not interpret time or date:"+datestring+" "+timestring) print("ERROR: could not interpret time or date:")
print(e)
if self.writeDB: if self.writeDB:
db.execute("INSERT INTO data (time,PI,PSN,dataType,data) VALUES (?,?,?,?,?)",t) db.execute("INSERT INTO data (time,PI,PSN,dataType,data) VALUES (?,?,?,?,?)",t)
elif (groupType == "6A"):#IH inhouse data -> save for analysis elif (groupType == "6A"):#IH inhouse data -> save for analysis

Loading…
Cancel
Save