diff --git a/plugins/channelrx/demodbfm/rdsparser.cpp b/plugins/channelrx/demodbfm/rdsparser.cpp index 66ed7f058..a3a581c37 100644 --- a/plugins/channelrx/demodbfm/rdsparser.cpp +++ b/plugins/channelrx/demodbfm/rdsparser.cpp @@ -262,7 +262,6 @@ void RDSParser::clearUpdateFlags() m_g14_updated = false; m_g14_data_available = false; m_g15_updated = false; - radiotext_AB_flag = false; debug = false; log = false; } @@ -697,16 +696,16 @@ void RDSParser::decode_type2(unsigned int *group, bool B) m_g2_updated = true; m_g2_count++; + bool radiotext_AB_flag = ((group[1] >> 4) & 0x01); - // when the A/B flag is toggled, flush your current radiotext - if (radiotext_AB_flag != ((group[1] >> 4) & 0x01)) + // when the flag goes from B to A (false -> true), flush your current radiotext + if (!m_radiotext_AB_flag && radiotext_AB_flag) { + // qDebug("RDSParser::decode_type2: ---------"); std::memset(m_g2_radiotext, ' ', sizeof(m_g2_radiotext)); m_g2_radiotext[sizeof(m_g2_radiotext) - 1] = '\0'; } - radiotext_AB_flag = (group[1] >> 4) & 0x01; - if (!B) { m_g2_radiotext[text_segment_address_code * 4 ] = (group[2] >> 8) & 0xff; @@ -720,9 +719,8 @@ void RDSParser::decode_type2(unsigned int *group, bool B) m_g2_radiotext[text_segment_address_code * 2 + 1] = group[3] & 0xff; } - /* - qDebug() << "RDSParser::decode_type2: " << "Radio Text " << (radiotext_AB_flag ? 'B' : 'A') - << ": " << std::string(m_g2_radiotext, sizeof(m_g2_radiotext)).c_str();*/ + // qDebug("RDSParser::decode_type2: %x Radio Text %s: '%s'", group[1], radiotext_AB_flag ? "A" : "B", m_g2_radiotext); + m_radiotext_AB_flag = radiotext_AB_flag; } void RDSParser::decode_type3(unsigned int *group, bool B) diff --git a/plugins/channelrx/demodbfm/rdsparser.h b/plugins/channelrx/demodbfm/rdsparser.h index 430ce2c41..0e9008c6e 100644 --- a/plugins/channelrx/demodbfm/rdsparser.h +++ b/plugins/channelrx/demodbfm/rdsparser.h @@ -193,7 +193,7 @@ private: unsigned char pi_country_identification; unsigned char pi_program_reference_number; - bool radiotext_AB_flag; + bool m_radiotext_AB_flag; bool debug; bool log;