Added FFTSize setting

This commit is contained in:
Ryzerth
2021-04-13 18:31:38 +02:00
parent b74043e2ee
commit 48bba00cb3
5 changed files with 81 additions and 50 deletions

View File

@ -4,6 +4,7 @@
#include <core.h>
#include <gui/colormaps.h>
#include <gui/gui.h>
#include <gui/main_window.h>
namespace displaymenu {
bool showWaterfall;
@ -14,6 +15,26 @@ namespace displaymenu {
std::string colorMapNamesTxt = "";
std::string colorMapAuthor = "";
const int FFTSizes[] = {
65536,
32768,
16384,
8192,
4096,
2048,
1024
};
const char* FFTSizesStr = "65536\0"
"32768\0"
"16384\0"
"8192\0"
"4096\0"
"2048\0"
"1024\0";
int fftSizeId = 0;
void init() {
showWaterfall = core::configManager.conf["showWaterfall"];
showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall();
@ -38,17 +59,52 @@ namespace displaymenu {
fullWaterfallUpdate = core::configManager.conf["fullWaterfallUpdate"];
gui::waterfall.setFullWaterfallUpdate(fullWaterfallUpdate);
fftSizeId = 0;
int fftSize = core::configManager.conf["fftSize"];
for (int i = 0; i < 7; i++) {
if (fftSize == FFTSizes[i]) {
fftSizeId = i;
break;
}
}
setFFTSize(FFTSizes[fftSizeId]);
}
void draw(void* ctx) {
float menuWidth = ImGui::GetContentRegionAvailWidth();
if (ImGui::Checkbox("Show Waterfall", &showWaterfall)) {
if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall)) {
showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall();
core::configManager.aquire();
core::configManager.conf["showWaterfall"] = showWaterfall;
core::configManager.release(true);
}
if (ImGui::Checkbox("Fast FFT##_sdrpp", &fastFFT)) {
gui::waterfall.setFastFFT(fastFFT);
core::configManager.aquire();
core::configManager.conf["fastFFT"] = fastFFT;
core::configManager.release(true);
}
if (ImGui::Checkbox("Full Waterfall Update##_sdrpp", &fullWaterfallUpdate)) {
gui::waterfall.setFullWaterfallUpdate(fullWaterfallUpdate);
core::configManager.aquire();
core::configManager.conf["fullWaterfallUpdate"] = fullWaterfallUpdate;
core::configManager.release(true);
}
ImGui::Text("FFT Size");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::Combo("##test_fft_size", &fftSizeId, FFTSizesStr)) {
setFFTSize(FFTSizes[fftSizeId]);
core::configManager.aquire();
core::configManager.conf["fftSize"] = FFTSizes[fftSizeId];
core::configManager.release(true);
}
if (colorMapNames.size() > 0) {
ImGui::Text("Color Map");
ImGui::SameLine();
@ -64,18 +120,6 @@ namespace displaymenu {
ImGui::Text("Color map Author: %s", colorMapAuthor.c_str());
}
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);
}
}
}