From 64436f1034697ea85fe64244cec4d9e8f723851a Mon Sep 17 00:00:00 2001 From: Ryzerth Date: Tue, 13 Apr 2021 04:54:47 +0200 Subject: [PATCH] New changes --- core/src/core.cpp | 2 ++ core/src/gui/menus/display.cpp | 17 +++++++++++++++++ core/src/gui/widgets/waterfall.cpp | 15 ++++++++++----- core/src/gui/widgets/waterfall.h | 3 +++ 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/core/src/core.cpp b/core/src/core.cpp index 79093170..ca66da92 100644 --- a/core/src/core.cpp +++ b/core/src/core.cpp @@ -106,8 +106,10 @@ int sdrpp_main(int argc, char *argv[]) { defConfig["bandPlanEnabled"] = true; defConfig["centerTuning"] = false; defConfig["colorMap"] = "Classic"; + defConfig["fastFFT"] = true; defConfig["fftHeight"] = 300; defConfig["frequency"] = 100000000.0; + defConfig["fullWaterfallUpdate"] = true; defConfig["max"] = 0.0; defConfig["maximized"] = false; defConfig["menuOrder"] = { diff --git a/core/src/gui/menus/display.cpp b/core/src/gui/menus/display.cpp index fbc21955..04be7444 100644 --- a/core/src/gui/menus/display.cpp +++ b/core/src/gui/menus/display.cpp @@ -8,6 +8,7 @@ namespace displaymenu { bool showWaterfall; bool fastFFT = true; + bool fullWaterfallUpdate = true; int colorMapId = 0; std::vector colorMapNames; std::string colorMapNamesTxt = ""; @@ -31,6 +32,12 @@ namespace displaymenu { colorMapAuthor = map.author; } } + + fastFFT = core::configManager.conf["fastFFT"]; + gui::waterfall.setFastFFT(fastFFT); + + fullWaterfallUpdate = core::configManager.conf["fullWaterfallUpdate"]; + gui::waterfall.setFullWaterfallUpdate(fullWaterfallUpdate); } void draw(void* ctx) { @@ -59,6 +66,16 @@ namespace displaymenu { if (ImGui::Checkbox("Fast FFT", &fastFFT)) { gui::waterfall.setFastFFT(fastFFT); + core::configManager.aquire(); + core::configManager.conf["fastFFT"] = fastFFT; + core::configManager.release(true); + } + + if (ImGui::Checkbox("Full Waterfall Update", &fullWaterfallUpdate)) { + gui::waterfall.setFullWaterfallUpdate(fullWaterfallUpdate); + core::configManager.aquire(); + core::configManager.conf["fullWaterfallUpdate"] = fullWaterfallUpdate; + core::configManager.release(true); } } } \ No newline at end of file diff --git a/core/src/gui/widgets/waterfall.cpp b/core/src/gui/widgets/waterfall.cpp index 8269e51b..86f26157 100644 --- a/core/src/gui/widgets/waterfall.cpp +++ b/core/src/gui/widgets/waterfall.cpp @@ -320,7 +320,7 @@ namespace ImGui { if (viewBandwidth != wholeBandwidth) { updateAllVFOs(); - updateWaterfallFb(); + if (_fullUpdate) { updateWaterfallFb(); }; } } else { @@ -718,7 +718,7 @@ namespace ImGui { lowerFreq = (centerFreq + viewOffset) - (viewBandwidth / 2.0); upperFreq = (centerFreq + viewOffset) + (viewBandwidth / 2.0); range = findBestRange(bandWidth, maxHSteps); - updateWaterfallFb(); + if (_fullUpdate) { updateWaterfallFb(); }; updateAllVFOs(); } @@ -740,7 +740,7 @@ namespace ImGui { viewOffset = offset; lowerFreq = (centerFreq + viewOffset) - (viewBandwidth / 2.0); upperFreq = (centerFreq + viewOffset) + (viewBandwidth / 2.0); - updateWaterfallFb(); + if (_fullUpdate) { updateWaterfallFb(); }; updateAllVFOs(); } @@ -766,13 +766,18 @@ namespace ImGui { return fftMax; } + void WaterFall::setFullWaterfallUpdate(bool fullUpdate) { + std::lock_guard lck(buf_mtx); + _fullUpdate = fullUpdate; + } + void WaterFall::setWaterfallMin(float min) { std::lock_guard lck(buf_mtx); if (min == waterfallMin) { return; } waterfallMin = min; - updateWaterfallFb(); + if (_fullUpdate) { updateWaterfallFb(); }; } float WaterFall::getWaterfallMin() { @@ -785,7 +790,7 @@ namespace ImGui { return; } waterfallMax = max; - updateWaterfallFb(); + if (_fullUpdate) { updateWaterfallFb(); }; } float WaterFall::getWaterfallMax() { diff --git a/core/src/gui/widgets/waterfall.h b/core/src/gui/widgets/waterfall.h index 8b811d86..eb79b06f 100644 --- a/core/src/gui/widgets/waterfall.h +++ b/core/src/gui/widgets/waterfall.h @@ -107,6 +107,8 @@ namespace ImGui { void setFastFFT(bool fastFFT); + void setFullWaterfallUpdate(bool fullUpdate); + bool centerFreqMoved = false; bool vfoFreqChanged = false; bool bandplanEnabled = false; @@ -207,5 +209,6 @@ namespace ImGui { bool bandplanVisible = false; bool _fastFFT = true; + bool _fullUpdate = true; }; }; \ No newline at end of file