MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / loop_do_work

Method loop_do_work

OpenHD/ohd_interface/src/wb_link.cpp:847–894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

845#pragma clang diagnostic pop
846
847void WBLink::loop_do_work() {
848 while (m_work_thread_run) {
849 // Perform any queued up work if it exists
850 {
851 m_work_item_queue_mutex.lock();
852 if (!m_work_item_queue.empty()) {
853 auto front = m_work_item_queue.front();
854 if (front->ready_to_be_executed()) {
855 m_console->debug("Start execute work item {}", front->TAG);
856 front->execute();
857 m_console->debug("Done executing work item {}", front->TAG);
858 m_work_item_queue.pop();
859 }
860 }
861 m_work_item_queue_mutex.unlock();
862 }
863 // If needed, apply the proper tx power (depending on armed / disarmed
864 // state).
865 bool tmp_true = true;
866 if (m_request_apply_tx_power.compare_exchange_strong(tmp_true, false)) {
867 apply_txpower();
868 }
869 wt_perform_mcs_via_rc_channel_if_enabled();
870 // wt_perform_bw_via_rc_channel_if_enabled();
871 wt_gnd_perform_channel_management();
872 // air_perform_reset_frequency();
873 // Perform thermal protection level calculation before rate adjustment !
874 wt_perform_update_thermal_protection();
875 wt_perform_rate_adjustment();
876 // After we've applied the rate, we update the tx header mcs index if
877 // necessary
878 tmp_true = true;
879 if (m_request_apply_air_mcs_index.compare_exchange_strong(tmp_true,
880 false)) {
881 const int mcs_index = m_settings->unsafe_get_settings().wb_air_mcs_index;
882 m_tx_header_1->update_mcs_index(mcs_index);
883 m_tx_header_2->update_mcs_index(mcs_index);
884 }
885 tmp_true = true;
886 /*if (m_request_apply_air_bw.compare_exchange_strong(tmp_true,
887 false)) {
888 apply_frequency_and_channel_width_from_settings();
889 }*/
890 // update statistics in regular intervals
891 wt_update_statistics();
892 std::this_thread::sleep_for(std::chrono::milliseconds(100));
893 }
894}
895
896void WBLink::wt_update_statistics() {
897 const auto elapsed_since_last =

Callers

nothing calls this directly

Calls 3

ready_to_be_executedMethod · 0.80
debugMethod · 0.80
executeMethod · 0.80

Tested by

no test coverage detected