2022-03-05 12:44:19 +01:00
|
|
|
#include "core/module.h"
|
2021-07-26 11:11:49 +02:00
|
|
|
#include <array>
|
|
|
|
|
#include <cstring>
|
|
|
|
|
#include "snr_plot.h"
|
|
|
|
|
|
2021-07-26 11:25:36 +02:00
|
|
|
namespace widgets
|
|
|
|
|
{
|
|
|
|
|
void SNRPlotViewer::draw(float snr, float peak_snr)
|
|
|
|
|
{
|
|
|
|
|
ImGui::Text("SNR (dB) : ");
|
|
|
|
|
ImGui::SameLine();
|
2022-05-01 20:53:44 +02:00
|
|
|
ImGui::TextColored(snr > 2 ? snr > 10 ? IMCOLOR_SYNCED : IMCOLOR_SYNCING : IMCOLOR_NOSYNC, "%0.3f", snr);
|
2021-07-26 11:25:36 +02:00
|
|
|
|
|
|
|
|
ImGui::Text("Peak SNR (dB) : ");
|
|
|
|
|
ImGui::SameLine();
|
2022-05-01 20:53:44 +02:00
|
|
|
ImGui::TextColored(peak_snr > 2 ? peak_snr > 10 ? IMCOLOR_SYNCED : IMCOLOR_SYNCING : IMCOLOR_NOSYNC, "%0.3f", peak_snr);
|
2021-07-26 11:25:36 +02:00
|
|
|
|
|
|
|
|
std::memmove(&snr_history[0], &snr_history[1], (200 - 1) * sizeof(float));
|
|
|
|
|
snr_history[200 - 1] = snr;
|
|
|
|
|
|
|
|
|
|
ImGui::PlotLines("", snr_history, IM_ARRAYSIZE(snr_history), 0, "", 0.0f, 25.0f, ImVec2(200 * ui_scale, 50 * ui_scale));
|
2021-07-26 11:11:49 +02:00
|
|
|
}
|
|
|
|
|
}
|