reduce excessive re-saving of config

This commit is contained in:
Charles J. Cliffe 2015-07-19 12:56:54 -04:00
parent db434348a4
commit 927de58e4e
2 changed files with 5 additions and 4 deletions

View File

@ -376,16 +376,21 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
"Frequency Offset", wxGetApp().getOffset(), -2000000000, 2000000000, this);
if (ofs != -1) {
wxGetApp().setOffset(ofs);
wxGetApp().saveConfig();
}
} else if (event.GetId() == wxID_SET_DS_OFF) {
wxGetApp().setDirectSampling(0);
wxGetApp().saveConfig();
} else if (event.GetId() == wxID_SET_DS_I) {
wxGetApp().setDirectSampling(1);
wxGetApp().saveConfig();
} else if (event.GetId() == wxID_SET_DS_Q) {
wxGetApp().setDirectSampling(2);
wxGetApp().saveConfig();
} else if (event.GetId() == wxID_SET_SWAP_IQ) {
bool swap_state = !wxGetApp().getSwapIQ();
wxGetApp().setSwapIQ(swap_state);
wxGetApp().saveConfig();
iqSwapMenuItem->Check(swap_state);
} else if (event.GetId() == wxID_SET_PPM) {
long ofs = wxGetNumberFromUser("Frequency correction for device in PPM.\ni.e. -51 for -51 PPM\n\nNote: you can adjust PPM interactively\nby holding ALT over the frequency tuning bar.\n", "Parts per million (PPM)",

View File

@ -193,7 +193,6 @@ void CubicSDR::setOffset(long long ofs) {
SDRDeviceInfo *dev = (*getDevices())[getDevice()];
config.getDevice(dev->getDeviceId())->setOffset(ofs);
config.save();
}
void CubicSDR::setDirectSampling(int mode) {
@ -204,7 +203,6 @@ void CubicSDR::setDirectSampling(int mode) {
SDRDeviceInfo *dev = (*getDevices())[getDevice()];
config.getDevice(dev->getDeviceId())->setDirectSampling(mode);
config.save();
}
int CubicSDR::getDirectSampling() {
@ -215,7 +213,6 @@ void CubicSDR::setSwapIQ(bool swapIQ) {
sdrPostThread->setSwapIQ(swapIQ);
SDRDeviceInfo *dev = (*getDevices())[getDevice()];
config.getDevice(dev->getDeviceId())->setIQSwap(swapIQ);
config.save();
}
bool CubicSDR::getSwapIQ() {
@ -309,7 +306,6 @@ void CubicSDR::setPPM(int ppm_in) {
SDRDeviceInfo *dev = (*getDevices())[getDevice()];
config.getDevice(dev->getDeviceId())->setPPM(ppm_in);
config.save();
}
int CubicSDR::getPPM() {