Save offset, direct sampling mode and i/q swap per device

This commit is contained in:
Charles J. Cliffe
2015-07-08 01:07:39 -04:00
parent dbc85d4f29
commit b762d4d118
7 changed files with 151 additions and 36 deletions
+30 -4
View File
@@ -151,9 +151,9 @@ AppFrame::AppFrame() :
wxMenu *dsMenu = new wxMenu;
dsMenu->AppendRadioItem(wxID_SET_DS_OFF, "Off");
dsMenu->AppendRadioItem(wxID_SET_DS_I, "I-ADC");
dsMenu->AppendRadioItem(wxID_SET_DS_Q, "Q-ADC");
directSamplingMenuItems[0] = dsMenu->AppendRadioItem(wxID_SET_DS_OFF, "Off");
directSamplingMenuItems[1] = dsMenu->AppendRadioItem(wxID_SET_DS_I, "I-ADC");
directSamplingMenuItems[2] = dsMenu->AppendRadioItem(wxID_SET_DS_Q, "Q-ADC");
menu->AppendSubMenu(dsMenu, "Direct Sampling");
@@ -319,6 +319,20 @@ AppFrame::AppFrame() :
wxAcceleratorTable accel(3, entries);
SetAcceleratorTable(accel);
SDRDeviceInfo *dev = (*wxGetApp().getDevices())[wxGetApp().getDevice()];
DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(dev->getDeviceId());
int dsMode = devConfig->getDirectSampling();
if (dsMode > 0 && dsMode <= 2) {
directSamplingMenuItems[devConfig->getDirectSampling()]->Check();
}
if (devConfig->getIQSwap()) {
iqSwapMenuItem->Check();
}
// static const int attribs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
// wxLogStatus("Double-buffered display %s supported", wxGLCanvas::IsDisplaySupported(attribs) ? "is" : "not");
// ShowFullScreen(true);
@@ -448,7 +462,19 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
std::vector<SDRDeviceInfo *> *devs = wxGetApp().getDevices();
if (event.GetId() >= wxID_DEVICE_ID && event.GetId() <= wxID_DEVICE_ID + devs->size()) {
wxGetApp().setDevice(event.GetId() - wxID_DEVICE_ID);
int devId = event.GetId() - wxID_DEVICE_ID;
wxGetApp().setDevice(devId);
SDRDeviceInfo *dev = (*wxGetApp().getDevices())[devId];
DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(dev->getDeviceId());
int dsMode = devConfig->getDirectSampling();
if (dsMode >= 0 && dsMode <= 2) {
directSamplingMenuItems[devConfig->getDirectSampling()]->Check();
}
iqSwapMenuItem->Check(devConfig->getIQSwap());
}
if (event.GetId() >= wxID_AUDIO_BANDWIDTH_BASE) {