fixed USRP channel name bug

This commit is contained in:
AlexandreRouma 2022-10-23 20:11:35 +02:00
parent d74ea13878
commit c72c8d056d

View File

@ -119,7 +119,7 @@ public:
auto subdevs = dev->get_rx_subdev_spec(); auto subdevs = dev->get_rx_subdev_spec();
for (int i = 0; i < subdevs.size(); i++) { for (int i = 0; i < subdevs.size(); i++) {
std::string slot = subdevs[i].db_name; std::string slot = subdevs[i].db_name;
sprintf(buf, "%s [%s]", dev->get_rx_subdev_name(i), slot.c_str()); sprintf(buf, "%s [%s]", dev->get_rx_subdev_name(i).c_str(), slot.c_str());
channels.define(buf, buf, slot); channels.define(buf, buf, slot);
} }
@ -310,32 +310,34 @@ private:
_this->select(ser); _this->select(ser);
} }
// TODO: Hide if only one channel if (_this->channels.size() > 1) {
SmGui::LeftLabel("Channel"); SmGui::LeftLabel("Channel");
SmGui::FillWidth(); SmGui::FillWidth();
SmGui::ForceSync(); SmGui::ForceSync();
if (SmGui::Combo(CONCAT("##_usrp_ch_sel_", _this->name), &_this->chanId, _this->channels.txt)) { if (SmGui::Combo(CONCAT("##_usrp_ch_sel_", _this->name), &_this->chanId, _this->channels.txt)) {
if (!_this->selectedSer.empty()) { if (!_this->selectedSer.empty()) {
config.acquire(); config.acquire();
config.conf["devices"][_this->selectedSer]["channel"] = _this->channels.key(_this->chanId); config.conf["devices"][_this->selectedSer]["channel"] = _this->channels.key(_this->chanId);
config.release(true); config.release(true);
}
_this->select(_this->devices.key(_this->devId));
} }
_this->select(_this->devices.key(_this->devId));
} }
if (_this->running) { SmGui::EndDisabled(); } if (_this->running) { SmGui::EndDisabled(); }
// TODO: Hide if only one antenna if (_this->antennas.size() > 1) {
SmGui::LeftLabel("Antenna"); SmGui::LeftLabel("Antenna");
SmGui::FillWidth(); SmGui::FillWidth();
if (SmGui::Combo(CONCAT("##_usrp_ant_sel_", _this->name), &_this->antId, _this->antennas.txt)) { if (SmGui::Combo(CONCAT("##_usrp_ant_sel_", _this->name), &_this->antId, _this->antennas.txt)) {
if (_this->running) { if (_this->running) {
_this->dev->set_rx_antenna(_this->antennas.key(_this->antId), _this->chanId); _this->dev->set_rx_antenna(_this->antennas.key(_this->antId), _this->chanId);
} }
if (!_this->selectedSer.empty() && !_this->selectedChan.empty()) { if (!_this->selectedSer.empty() && !_this->selectedChan.empty()) {
config.acquire(); config.acquire();
config.conf["devices"][_this->selectedSer]["channels"][_this->selectedChan]["antenna"] = _this->antennas.key(_this->antId); config.conf["devices"][_this->selectedSer]["channels"][_this->selectedChan]["antenna"] = _this->antennas.key(_this->antId);
config.release(true); config.release(true);
}
} }
} }