mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-26 02:48:31 +01:00
Fixed SNR not updating when waterfall is hidden
This commit is contained in:
parent
aaa15315ce
commit
8a1df1d712
@ -431,7 +431,7 @@ namespace ImGui {
|
|||||||
ImGui::Text("Bandwidth Locked: %s", _vfo->bandwidthLocked ? "Yes" : "No");
|
ImGui::Text("Bandwidth Locked: %s", _vfo->bandwidthLocked ? "Yes" : "No");
|
||||||
|
|
||||||
float strength, snr;
|
float strength, snr;
|
||||||
if (calculateVFOSignalInfo(_vfo, strength, snr)) {
|
if (calculateVFOSignalInfo(waterfallVisible ? &rawFFTs[currentFFTLine * rawFFTSize] : rawFFTs, _vfo, strength, snr)) {
|
||||||
ImGui::Text("Strength: %0.1fdBFS", strength);
|
ImGui::Text("Strength: %0.1fdBFS", strength);
|
||||||
ImGui::Text("SNR: %0.1fdB", snr);
|
ImGui::Text("SNR: %0.1fdB", snr);
|
||||||
}
|
}
|
||||||
@ -448,8 +448,8 @@ namespace ImGui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaterFall::calculateVFOSignalInfo(WaterfallVFO* _vfo, float& strength, float& snr) {
|
bool WaterFall::calculateVFOSignalInfo(float* fftLine, WaterfallVFO* _vfo, float& strength, float& snr) {
|
||||||
if (rawFFTs == NULL || fftLines <= 0) { return false; }
|
if (fftLine == NULL || fftLines <= 0) { return false; }
|
||||||
|
|
||||||
// Calculate FFT index data
|
// Calculate FFT index data
|
||||||
double vfoMinSizeFreq = _vfo->centerOffset - _vfo->bandwidth;
|
double vfoMinSizeFreq = _vfo->centerOffset - _vfo->bandwidth;
|
||||||
@ -461,8 +461,6 @@ namespace ImGui {
|
|||||||
int vfoMaxOffset = std::clamp<int>(((vfoMaxFreq / (wholeBandwidth/2.0)) * (double)(rawFFTSize/2)) + (rawFFTSize/2), 0, rawFFTSize);
|
int vfoMaxOffset = std::clamp<int>(((vfoMaxFreq / (wholeBandwidth/2.0)) * (double)(rawFFTSize/2)) + (rawFFTSize/2), 0, rawFFTSize);
|
||||||
int vfoMaxSideOffset = std::clamp<int>(((vfoMaxSizeFreq / (wholeBandwidth/2.0)) * (double)(rawFFTSize/2)) + (rawFFTSize/2), 0, rawFFTSize);
|
int vfoMaxSideOffset = std::clamp<int>(((vfoMaxSizeFreq / (wholeBandwidth/2.0)) * (double)(rawFFTSize/2)) + (rawFFTSize/2), 0, rawFFTSize);
|
||||||
|
|
||||||
float* fftLine = &rawFFTs[currentFFTLine * rawFFTSize];
|
|
||||||
|
|
||||||
double avg = 0;
|
double avg = 0;
|
||||||
float max = -INFINITY;
|
float max = -INFINITY;
|
||||||
int avgCount = 0;
|
int avgCount = 0;
|
||||||
@ -804,7 +802,7 @@ namespace ImGui {
|
|||||||
|
|
||||||
if (selectedVFO != "" && vfos.size() > 0) {
|
if (selectedVFO != "" && vfos.size() > 0) {
|
||||||
float dummy;
|
float dummy;
|
||||||
calculateVFOSignalInfo(vfos[selectedVFO], dummy, selectedVFOSNR);
|
calculateVFOSignalInfo(waterfallVisible ? &rawFFTs[currentFFTLine * rawFFTSize] : rawFFTs, vfos[selectedVFO], dummy, selectedVFOSNR);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf_mtx.unlock();
|
buf_mtx.unlock();
|
||||||
|
@ -165,7 +165,7 @@ namespace ImGui {
|
|||||||
void updateWaterfallFb();
|
void updateWaterfallFb();
|
||||||
void updateWaterfallTexture();
|
void updateWaterfallTexture();
|
||||||
void updateAllVFOs(bool checkRedrawRequired = false);
|
void updateAllVFOs(bool checkRedrawRequired = false);
|
||||||
bool calculateVFOSignalInfo(WaterfallVFO* vfo, float& strength, float& snr);
|
bool calculateVFOSignalInfo(float* fftLine, WaterfallVFO* vfo, float& strength, float& snr);
|
||||||
|
|
||||||
bool waterfallUpdate = false;
|
bool waterfallUpdate = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user