Radio: do not use more radios than necessary

This commit is contained in:
Xavier Arteaga 2020-06-22 09:15:19 +02:00 committed by Xavier Arteaga
parent bcc6c3e449
commit d8eaa99132
1 changed files with 5 additions and 0 deletions

View File

@ -95,6 +95,11 @@ int radio::init(const rf_args_t& args, phy_interface_radio* phy_)
device_args_list.emplace_back("auto");
}
// Avoid opening more RF devices than necessary
if (nof_channels < device_args_list.size()) {
device_args_list.resize(nof_channels);
}
// Makes sure it is possible to have the same number of RF channels in each RF device
if (nof_channels % device_args_list.size() != 0) {
log_h->console(