Fixed delayed VFO update bug

This commit is contained in:
Ryzerth 2021-05-04 02:52:59 +02:00
parent c23b2bdc55
commit 9a1850bd61
2 changed files with 5 additions and 15 deletions

View File

@ -202,18 +202,6 @@ namespace ImGui {
void WaterFall::drawVFOs() {
for (auto const& [name, vfo] : vfos) {
if (vfo->redrawRequired) {
vfo->redrawRequired = false;
vfo->updateDrawingVars(viewBandwidth, dataWidth, viewOffset, widgetPos, fftHeight);
vfo->wfRectMin = ImVec2(vfo->rectMin.x, wfMin.y);
vfo->wfRectMax = ImVec2(vfo->rectMax.x, wfMax.y);
vfo->wfLineMin = ImVec2(vfo->lineMin.x, wfMin.y);
vfo->wfLineMax = ImVec2(vfo->lineMax.x, wfMax.y);
vfo->wfLbwSelMin = ImVec2(vfo->wfRectMin.x - 2, vfo->wfRectMin.y);
vfo->wfLbwSelMax = ImVec2(vfo->wfRectMin.x + 2, vfo->wfRectMax.y);
vfo->wfRbwSelMin = ImVec2(vfo->wfRectMax.x - 2, vfo->wfRectMin.y);
vfo->wfRbwSelMax = ImVec2(vfo->wfRectMax.x + 2, vfo->wfRectMax.y);
}
vfo->draw(window, name == selectedVFO);
}
}
@ -711,6 +699,8 @@ namespace ImGui {
processInputs();
updateAllVFOs(true);
drawFFT();
if (waterfallVisible) {
drawWaterfall();
@ -980,14 +970,14 @@ namespace ImGui {
return waterfallMax;
}
void WaterFall::updateAllVFOs() {
void WaterFall::updateAllVFOs(bool checkRedrawRequired) {
for (auto const& [name, vfo] : vfos) {
if (checkRedrawRequired && !vfo->redrawRequired) { continue; }
vfo->updateDrawingVars(viewBandwidth, dataWidth, viewOffset, widgetPos, fftHeight);
vfo->wfRectMin = ImVec2(vfo->rectMin.x, wfMin.y);
vfo->wfRectMax = ImVec2(vfo->rectMax.x, wfMax.y);
vfo->wfLineMin = ImVec2(vfo->lineMin.x, wfMin.y);
vfo->wfLineMax = ImVec2(vfo->lineMax.x, wfMax.y);
vfo->wfLbwSelMin = ImVec2(vfo->wfRectMin.x - 2, vfo->wfRectMin.y);
vfo->wfLbwSelMax = ImVec2(vfo->wfRectMin.x + 2, vfo->wfRectMax.y);
vfo->wfRbwSelMin = ImVec2(vfo->wfRectMax.x - 2, vfo->wfRectMin.y);

View File

@ -163,7 +163,7 @@ namespace ImGui {
void onResize();
void updateWaterfallFb();
void updateWaterfallTexture();
void updateAllVFOs();
void updateAllVFOs(bool checkRedrawRequired = false);
bool calculateVFOSignalInfo(WaterfallVFO* vfo, float& strength, float& snr);
bool waterfallUpdate = false;