Save center frequency

This commit is contained in:
Charles J. Cliffe 2015-07-20 22:51:19 -04:00
parent ddedc984b0
commit 9843f85086
4 changed files with 24 additions and 2 deletions

View File

@ -122,6 +122,7 @@ AppConfig::AppConfig() : configName("") {
winMax.store(false);
themeId.store(0);
snap.store(1);
centerFreq.store(100000000);
}
@ -195,6 +196,14 @@ long long AppConfig::getSnap() {
return snap.load();
}
void AppConfig::setCenterFreq(long long freqVal) {
centerFreq.store(freqVal);
}
long long AppConfig::getCenterFreq() {
return centerFreq.load();
}
void AppConfig::setConfigName(std::string configName) {
this->configName = configName;
}
@ -233,6 +242,7 @@ bool AppConfig::save() {
*window_node->newChild("max") = winMax.load();
*window_node->newChild("theme") = themeId.load();
*window_node->newChild("snap") = snap.load();
*window_node->newChild("center_freq") = centerFreq.load();
}
DataNode *devices_node = cfg.rootNode()->newChild("devices");
@ -323,7 +333,13 @@ bool AppConfig::load() {
win_node->getNext("snap")->element()->get(snapVal);
snap.store(snapVal);
}
}
if (win_node->hasAnother("center_freq")) {
long long freqVal;
win_node->getNext("center_freq")->element()->get(freqVal);
centerFreq.store(freqVal);
}
}
if (cfg.rootNode()->hasAnother("devices")) {
DataNode *devices_node = cfg.rootNode()->getNext("devices");

View File

@ -58,6 +58,9 @@ public:
void setSnap(long long snapVal);
long long getSnap();
void setCenterFreq(long long freqVal);
long long getCenterFreq();
void setConfigName(std::string configName);
std::string getConfigFileName(bool ignoreName=false);
@ -72,4 +75,5 @@ private:
std::atomic_bool winMax;
std::atomic_int themeId;
std::atomic_llong snap;
std::atomic_llong centerFreq;
};

View File

@ -324,6 +324,8 @@ AppFrame::AppFrame() :
wxGetApp().setFrequencySnap(freqSnap);
ThemeMgr::mgr.setTheme(wxGetApp().getConfig()->getTheme());
wxGetApp().setFrequency(wxGetApp().getConfig()->getCenterFreq());
Show();

View File

@ -141,7 +141,7 @@ void SDRThread::threadMain() {
signed char buf[BUF_SIZE];
long long frequency = DEFAULT_FREQ;
long long frequency = wxGetApp().getConfig()->getCenterFreq();
int ppm = devConfig->getPPM();
int direct_sampling_mode = devConfig->getDirectSampling();;
int buf_size = BUF_SIZE;