mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-22 03:36:24 -05:00
Add 'Reduced CPU Usage' menu option and config entry.
This commit is contained in:
parent
cd41a8197e
commit
b828b3636f
@ -199,6 +199,7 @@ AppConfig::AppConfig() : configName("") {
|
||||
winH.store(0);
|
||||
winMax.store(false);
|
||||
showTips.store(true);
|
||||
lowPerfMode.store(false);
|
||||
themeId.store(0);
|
||||
snap.store(1);
|
||||
centerFreq.store(100000000);
|
||||
@ -265,6 +266,14 @@ bool AppConfig::getShowTips() {
|
||||
return showTips.load();
|
||||
}
|
||||
|
||||
void AppConfig::setLowPerfMode(bool show) {
|
||||
lowPerfMode.store(show);
|
||||
}
|
||||
|
||||
bool AppConfig::getLowPerfMode() {
|
||||
return lowPerfMode.load();
|
||||
}
|
||||
|
||||
wxRect *AppConfig::getWindow() {
|
||||
wxRect *r = NULL;
|
||||
if (winH.load() && winW.load()) {
|
||||
@ -360,6 +369,7 @@ bool AppConfig::save() {
|
||||
|
||||
*window_node->newChild("max") = winMax.load();
|
||||
*window_node->newChild("tips") = showTips.load();
|
||||
*window_node->newChild("low_perf_mode") = lowPerfMode.load();
|
||||
*window_node->newChild("theme") = themeId.load();
|
||||
*window_node->newChild("snap") = snap.load();
|
||||
*window_node->newChild("center_freq") = centerFreq.load();
|
||||
@ -444,7 +454,7 @@ bool AppConfig::load() {
|
||||
|
||||
if (cfg.rootNode()->hasAnother("window")) {
|
||||
int x,y,w,h;
|
||||
int max,tips;
|
||||
int max,tips,lpm;
|
||||
|
||||
DataNode *win_node = cfg.rootNode()->getNext("window");
|
||||
|
||||
@ -470,6 +480,11 @@ bool AppConfig::load() {
|
||||
showTips.store(tips?true:false);
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("low_perf_mode")) {
|
||||
win_node->getNext("low_perf_mode")->element()->get(lpm);
|
||||
lowPerfMode.store(lpm?true:false);
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("theme")) {
|
||||
int theme;
|
||||
win_node->getNext("theme")->element()->get(theme);
|
||||
|
@ -73,6 +73,9 @@ public:
|
||||
void setShowTips(bool show);
|
||||
bool getShowTips();
|
||||
|
||||
void setLowPerfMode(bool lpm);
|
||||
bool getLowPerfMode();
|
||||
|
||||
void setTheme(int themeId);
|
||||
int getTheme();
|
||||
|
||||
@ -127,7 +130,7 @@ private:
|
||||
std::string configName;
|
||||
std::map<std::string, DeviceConfig *> deviceConfig;
|
||||
std::atomic_int winX,winY,winW,winH;
|
||||
std::atomic_bool winMax, showTips;
|
||||
std::atomic_bool winMax, showTips, lowPerfMode;
|
||||
std::atomic_int themeId;
|
||||
std::atomic_llong snap;
|
||||
std::atomic_llong centerFreq;
|
||||
|
@ -605,6 +605,14 @@ void AppFrame::updateDeviceParams() {
|
||||
showTipMenuItem = newSettingsMenu->AppendCheckItem(wxID_SET_TIPS, "Show Hover Tips");
|
||||
showTipMenuItem->Check(wxGetApp().getConfig()->getShowTips());
|
||||
|
||||
lowPerfMode = wxGetApp().getConfig()->getLowPerfMode();
|
||||
lowPerfMenuItem = newSettingsMenu->AppendCheckItem(wxID_LOW_PERF, "Reduce CPU Usage");
|
||||
if (lowPerfMode) {
|
||||
lowPerfMenuItem->Check(true);
|
||||
}
|
||||
|
||||
newSettingsMenu->AppendSeparator();
|
||||
|
||||
newSettingsMenu->Append(wxID_SET_FREQ_OFFSET, "Frequency Offset");
|
||||
|
||||
if (devInfo->hasCORR(SOAPY_SDR_RX, 0)) {
|
||||
@ -626,6 +634,10 @@ void AppFrame::updateDeviceParams() {
|
||||
|
||||
SoapySDR::ArgInfoList::const_iterator args_i;
|
||||
settingArgs = soapyDev->getSettingInfo();
|
||||
|
||||
if (settingArgs.size()) {
|
||||
newSettingsMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
for (args_i = settingArgs.begin(); args_i != settingArgs.end(); args_i++) {
|
||||
SoapySDR::ArgInfo arg = (*args_i);
|
||||
@ -781,6 +793,21 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
wxGetApp().setDevice(dev);
|
||||
}
|
||||
}
|
||||
} else if (event.GetId() == wxID_LOW_PERF) {
|
||||
lowPerfMode = lowPerfMenuItem->IsChecked();
|
||||
wxGetApp().getConfig()->setLowPerfMode(lowPerfMode);
|
||||
|
||||
// long srate = wxGetApp().getSampleRate();
|
||||
// if (srate > CHANNELIZER_RATE_MAX && lowPerfMode) {
|
||||
// if (wxGetApp().getSpectrumProcessor()->getFFTSize() != 1024) {
|
||||
// setMainWaterfallFFTSize(1024);
|
||||
// }
|
||||
// } else if (srate > CHANNELIZER_RATE_MAX) {
|
||||
// if (wxGetApp().getSpectrumProcessor()->getFFTSize() != 2048) {
|
||||
// setMainWaterfallFFTSize(2048);
|
||||
// }
|
||||
// }
|
||||
|
||||
} else if (event.GetId() == wxID_SET_TIPS ) {
|
||||
if (wxGetApp().getConfig()->getShowTips()) {
|
||||
wxGetApp().getConfig()->setShowTips(false);
|
||||
@ -1462,9 +1489,13 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
#endif
|
||||
|
||||
if (!this->IsActive()) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(25));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(30));
|
||||
} else {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
if (lowPerfMode) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(30));
|
||||
} else {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
}
|
||||
|
||||
event.RequestMore();
|
||||
|
@ -31,6 +31,7 @@
|
||||
#define wxID_SDR_DEVICES 2008
|
||||
#define wxID_AGC_CONTROL 2009
|
||||
#define wxID_SDR_START_STOP 2010
|
||||
#define wxID_LOW_PERF 2011
|
||||
|
||||
#define wxID_MAIN_SPLITTER 2050
|
||||
#define wxID_VIS_SPLITTER 2051
|
||||
@ -134,6 +135,7 @@ private:
|
||||
wxMenu *sampleRateMenu;
|
||||
wxMenuItem *agcMenuItem;
|
||||
wxMenuItem *iqSwapMenuItem;
|
||||
wxMenuItem *lowPerfMenuItem;
|
||||
wxMenu *settingsMenu;
|
||||
SoapySDR::ArgInfoList settingArgs;
|
||||
int settingsIdMax;
|
||||
@ -152,6 +154,8 @@ private:
|
||||
ModemArgInfoList newModemArgs;
|
||||
wxMenuItem *showTipMenuItem;
|
||||
|
||||
bool lowPerfMode;
|
||||
|
||||
#ifdef USE_HAMLIB
|
||||
void enableRig();
|
||||
void disableRig();
|
||||
|
@ -201,6 +201,14 @@ void SpectrumVisualProcessor::setFFTSize(unsigned int fftSize_in) {
|
||||
fftSizeChanged.store(true);
|
||||
}
|
||||
|
||||
unsigned int SpectrumVisualProcessor::getFFTSize() {
|
||||
if (fftSizeChanged.load()) {
|
||||
return newFFTSize;
|
||||
}
|
||||
return fftSize.load();
|
||||
}
|
||||
|
||||
|
||||
void SpectrumVisualProcessor::setHideDC(bool hideDC) {
|
||||
this->hideDC.store(hideDC);
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
|
||||
void setup(unsigned int fftSize);
|
||||
void setFFTSize(unsigned int fftSize);
|
||||
unsigned int getFFTSize();
|
||||
void setHideDC(bool hideDC);
|
||||
|
||||
void setScaleFactor(float sf);
|
||||
|
Loading…
Reference in New Issue
Block a user