diff --git a/src/WBTxRx.cpp b/src/WBTxRx.cpp index 87e0c6d0..db1e3c76 100644 --- a/src/WBTxRx.cpp +++ b/src/WBTxRx.cpp @@ -499,7 +499,7 @@ void WBTxRx::on_new_packet(const uint8_t wlan_idx,const uint8_t *pkt,const int p } this_wifi_card_calc.rf_aggregator.on_valid_openhd_packet(parsedPacket.value()); if(m_options.rx_radiotap_debug_level==3 || m_options.rx_radiotap_debug_level==4){ - m_console->debug("{}",RadiotapRxRfAggregator::card_key_rf_indicators_to_string(this_wifi_card_calc.rf_aggregator.get_current())); + this_wifi_card_calc.rf_aggregator.debug_every_one_second(); } this_wifi_card_stats.count_p_valid++; if(wlan_idx==0){ diff --git a/src/radiotap/RadiotapRxRfAggregator.cpp b/src/radiotap/RadiotapRxRfAggregator.cpp index 7f97ad14..50601dfc 100644 --- a/src/radiotap/RadiotapRxRfAggregator.cpp +++ b/src/radiotap/RadiotapRxRfAggregator.cpp @@ -64,6 +64,15 @@ std::string RadiotapRxRfAggregator::card_key_rf_indicators_to_string( indicators.antenna2.rssi_dbm,indicators.antenna2.noise_dbm,indicators.antenna2.card_signal_quality_perc); } +void RadiotapRxRfAggregator::debug_every_one_second() { + const auto now=std::chrono::steady_clock::now(); + if(now-m_last_debug_log>=std::chrono::seconds(1)){ + auto current=get_current(); + wifibroadcast::log::get_default()->debug("{}",RadiotapRxRfAggregator::card_key_rf_indicators_to_string(current)); + m_last_debug_log=now; + } +} + void RadiotapRxRfAggregator::KeyRfAggregators::reset() { rssi_dbm.reset(); noise_dbm.reset(); diff --git a/src/radiotap/RadiotapRxRfAggregator.h b/src/radiotap/RadiotapRxRfAggregator.h index b32d6bf2..51155404 100644 --- a/src/radiotap/RadiotapRxRfAggregator.h +++ b/src/radiotap/RadiotapRxRfAggregator.h @@ -8,6 +8,7 @@ #include "RadiotapHeaderRx.hpp" #include "RSSIAccumulator.hpp" #include "SignalQualityAccumulator.hpp" +#include /** * Aggregates all key rf metrics. @@ -40,6 +41,7 @@ class RadiotapRxRfAggregator { return m_current_rx_stats; } static std::string card_key_rf_indicators_to_string(const CardKeyRfIndicators& indicators); + void debug_every_one_second(); private: struct KeyRfAggregators{ RSSIAccumulator rssi_dbm; @@ -54,6 +56,7 @@ class RadiotapRxRfAggregator { KeyRfAggregators m_agg_antenna1; KeyRfAggregators m_agg_antenna2; CardKeyRfIndicators m_current_rx_stats{}; + std::chrono::steady_clock::time_point m_last_debug_log=std::chrono::steady_clock::now(); }; static std::ostream& operator<<(std::ostream& strm, const RadiotapRxRfAggregator::CardKeyRfIndicators& data){