Add a read-only TX antenna menu entry showing the active one, closing #559

This commit is contained in:
vsonnier 2017-08-25 07:27:30 +02:00
parent 8993121fc6
commit a018a36100
4 changed files with 46 additions and 5 deletions

View File

@ -811,8 +811,18 @@ void AppFrame::updateDeviceParams() {
}
}
//Runtime settings part
//Add an informative, read-only menu entry to display the current TX selected antenna, if any.
if (devInfo->getAntennaNames(SOAPY_SDR_TX, 0).size() > 1) {
currentTXantennaName = devInfo->getAntennaName(SOAPY_SDR_TX, 0);
newSettingsMenu->AppendSeparator();
antennaMenuItems[wxID_ANTENNA_CURRENT_TX] = newSettingsMenu->Append(wxID_ANTENNA_CURRENT_TX, getSettingsLabel("TX Antenna", currentTXantennaName));
antennaMenuItems[wxID_ANTENNA_CURRENT_TX]->Enable(false);
}
//Runtime settings part
SoapySDR::ArgInfoList::const_iterator args_i;
settingArgs = soapyDev->getSettingInfo();
@ -1689,6 +1699,16 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
updateDeviceParams();
}
//Refresh the current TX antenna on, if any:
if (devInfo) {
std::string actualTxAntenna = devInfo->getAntennaName(SOAPY_SDR_TX, 0);
if (currentTXantennaName != actualTxAntenna) {
currentTXantennaName = actualTxAntenna;
antennaMenuItems[wxID_ANTENNA_CURRENT_TX]->SetItemLabel(getSettingsLabel("TX Antenna", currentTXantennaName));
}
}
//try to garbage collect the retired demodulators.
wxGetApp().getDemodMgr().garbageCollect();

View File

@ -65,7 +65,8 @@
#define wxID_SETTINGS_BASE 2300
#define wxID_ANTENNA_CURRENT 2500
#define wxID_ANTENNAS_BASE 2501
#define wxID_ANTENNA_CURRENT_TX 2501
#define wxID_ANTENNAS_BASE 2502
#define wxID_DEVICE_ID 3500
@ -223,6 +224,8 @@ private:
std::vector<std::string> antennaNames;
std::string currentTXantennaName;
std::string currentSessionFile;
FFTVisualDataThread *waterfallDataThread;

View File

@ -191,9 +191,25 @@ std::vector<long> SDRDeviceInfo::getSampleRates(int direction, size_t channel) {
}
std::vector<std::string> SDRDeviceInfo::getAntennaNames(int direction, size_t channel) {
SoapySDR::Device *dev = getSoapyDevice();
if (dev) {
return dev->listAntennas(direction, channel);
}
return std::vector<std::string>();
}
std::string SDRDeviceInfo::getAntennaName(int direction, size_t channel) {
SoapySDR::Device *dev = getSoapyDevice();
if (dev) {
return dev->getAntenna(direction, channel);
}
return std::string("");
}

View File

@ -86,6 +86,8 @@ public:
std::vector<std::string> getAntennaNames(int direction, size_t channel);
std::string getAntennaName(int direction, size_t channel);
long getSampleRateNear(int direction, size_t channel, long sampleRate_in);
SDRRangeMap getGains(int direction, size_t channel);