Manual bandwidth input improvements

- Prevent out-of-range bandwidths
- Display device name and known min/max rate
This commit is contained in:
Charles J. Cliffe 2015-10-21 17:39:44 -04:00
parent cd82ecb15b
commit fcbe2723e6

View File

@ -531,8 +531,32 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
switch (event.GetId()) {
case wxID_BANDWIDTH_MANUAL:
long bw = wxGetNumberFromUser("Set the bandwidth manually", "Sample Rate (Hz), i.e. 2560000 for 2.56M",
"Manual Bandwidth Entry", wxGetApp().getSampleRate(), 250000, 25000000, this);
int rateHigh, rateLow;
SDRDeviceInfo *dev = wxGetApp().getDevice();
if (dev == NULL) {
break;
}
SDRDeviceChannel *chan = dev->getRxChannel();
rateLow = 2000000;
rateHigh = 30000000;
if (chan->getSampleRates().size()) {
rateLow = chan->getSampleRates()[0];
rateHigh = chan->getSampleRates()[chan->getSampleRates().size()-1];
}
long bw = wxGetNumberFromUser("\n" + dev->getName() + "\n\n "
+ "min: " + std::to_string(rateLow) + " Hz"
+ ", max: " + std::to_string(rateHigh) + " Hz\n",
"Sample Rate in Hz",
"Manual Bandwidth Entry",
wxGetApp().getSampleRate(),
rateLow,
rateHigh,
this);
if (bw != -1) {
wxGetApp().setSampleRate(bw);
}