| 363 | } |
| 364 | |
| 365 | bool WBLink::request_set_frequency(int frequency) { |
| 366 | m_console->debug("request_set_frequency {}", frequency); |
| 367 | if (!openhd::wb::validate_frequency_change( |
| 368 | frequency, m_settings->get_settings().wb_air_tx_channel_width, |
| 369 | m_broadcast_cards, m_console)) { |
| 370 | return false; |
| 371 | } |
| 372 | if (OHDPlatform::instance().is_x20() && frequency < 5180) { |
| 373 | m_console->warn("X20 only supports 5G"); |
| 374 | return false; |
| 375 | } |
| 376 | auto work_item = std::make_shared<WorkItem>( |
| 377 | fmt::format("SET_FREQ:{}", frequency), |
| 378 | [this, frequency]() { |
| 379 | m_settings->unsafe_get_settings().wb_frequency = frequency; |
| 380 | m_settings->persist(); |
| 381 | if (m_profile.is_air) { |
| 382 | // temporarily disable video streaming to free up BW |
| 383 | m_air_close_video_in = true; |
| 384 | m_management_air->set_frequency(frequency); |
| 385 | // We need to delay the change to make sure at least one management |
| 386 | // packet goes through .. |
| 387 | std::this_thread::sleep_for(std::chrono::seconds(2)); |
| 388 | m_air_close_video_in = false; |
| 389 | } |
| 390 | apply_frequency_and_channel_width_from_settings(); |
| 391 | m_rate_adjustment_frequency_changed = true; |
| 392 | }, |
| 393 | std::chrono::steady_clock::now()); |
| 394 | return try_schedule_work_item(work_item); |
| 395 | } |
| 396 | |
| 397 | bool WBLink::request_set_air_tx_channel_width(int channel_width) { |
| 398 | assert(m_profile.is_air); // Channel width is only ever changed on air |
nothing calls this directly
no test coverage detected