Skip to content

Commit

Permalink
Merge pull request #36 from OpenHD/consti-dev
Browse files Browse the repository at this point in the history
Consti dev
  • Loading branch information
Consti10 authored Sep 27, 2023
2 parents 1dd1488 + 17c10f0 commit 9b8ac3f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/WBStreamTx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void WBStreamTx::loop_process_data() {
if(options.dequeue_thread_max_realtime){
SchedulingHelper::setThreadParamsMaxRealtime();
}
const std::int64_t timeout_usecs=std::chrono::duration_cast<std::chrono::microseconds>(options.dequeue_timeout).count();
static constexpr std::int64_t timeout_usecs=100*1000;
if(options.enable_fec){
std::shared_ptr<EnqueuedBlock> frame= nullptr;
while (m_process_data_thread_run){
Expand Down Expand Up @@ -159,10 +159,6 @@ void WBStreamTx::loop_process_data() {
m_queue_time_calculator.reset();
}
process_enqueued_packet(*packet);
}else{
if(options.dequeue_timeout_cb){
options.dequeue_timeout_cb(*this);
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/WBStreamTx.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
class WBStreamTx {
public:
typedef std::function<void(WBStreamTx& self)> DEQUEUE_TIMEOUT_CB;
struct Options {
// needs to match the radio port of the corresponding rx
uint8_t radio_port = 0;
Expand All @@ -46,10 +45,6 @@ class WBStreamTx {
std::shared_ptr<spdlog::logger> opt_console=nullptr;
// set sched_param = max realtime on the thread that dequeues and injects the packets
bool dequeue_thread_max_realtime= true;
// Dirty, for openhd - function that is called from the dequeue thread every time the
// de-queueing of a packet timed out (no packet was fed for timeout ms)
std::chrono::microseconds dequeue_timeout=std::chrono::milliseconds(100);
DEQUEUE_TIMEOUT_CB dequeue_timeout_cb= nullptr;
};
WBStreamTx(std::shared_ptr<WBTxRx> txrx,Options options,std::shared_ptr<RadiotapHeaderHolder> radiotap_header_holder);
WBStreamTx(const WBStreamTx&) = delete;
Expand Down
4 changes: 3 additions & 1 deletion src/WBTxRx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,10 @@ void WBTxRx::recalculate_pollution_perc() {
double perc_non_openhd_packets=(double)non_openhd_packets/(double)m_pollution_total_rx_packets*100.0;
//m_console->debug("Link pollution: {}% [{}:{}]",perc_non_openhd_packets,non_openhd_packets,m_pollution_total_rx_packets);
m_rx_stats.curr_link_pollution_perc=std::ceil(perc_non_openhd_packets);
//curr_link_pollution_perc=std::ceil()
//curr_link_pollution_perc=std::ceil();
}
const int elapsed_ms=static_cast<int>(std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count());
m_rx_stats.curr_n_foreign_packets_pps=(int)non_openhd_packets * 1000 / elapsed_ms;
m_pollution_total_rx_packets=0;
m_pollution_openhd_rx_packets=0;
}
Expand Down
2 changes: 2 additions & 0 deletions src/WBTxRx.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ class WBTxRx {
int16_t curr_big_gaps_counter=-1;
// Percentage of non openhd packets over total n of packets
int curr_link_pollution_perc=0;
// N of non openhd packets in the last second
int curr_n_foreign_packets_pps=0;
// Usefully for channel scan - n packets that are quite likely coming from an openhd air / ground unit (respective depending on if air/gnd mode)
// But not validated - e.g. on a channel scan, session key packet(s) have not been received yet
int curr_n_likely_openhd_packets=0;
Expand Down

0 comments on commit 9b8ac3f

Please sign in to comment.