Integrate SNR reporting from latest RADE. (#797)

* Integrate SNR reporting from latest RADE.

* Show -- for SNR when using RADE and not in sync.

* Suppress SNR display when not in sync for legacy modes.
pull/803/head
Mooneer Salem 2025-01-08 23:42:16 -08:00 committed by GitHub
parent 37f6531039
commit 630764778c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 32 additions and 9 deletions

View File

@ -13,7 +13,7 @@ ExternalProject_Add(build_rade
SOURCE_DIR rade_src
BINARY_DIR rade_build
GIT_REPOSITORY https://github.com/drowe67/radae.git
GIT_TAG main
GIT_TAG dr-est_snr
CMAKE_ARGS ${RADE_CMAKE_ARGS}
#CMAKE_CACHE_ARGS -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}
INSTALL_COMMAND ""

View File

@ -702,6 +702,19 @@ void FreeDVInterface::setReliableText(const char* callsign)
}
}
float FreeDVInterface::getSNREstimate()
{
if (txMode_ >= FREEDV_MODE_RADE)
{
// Special handling for RADE
return (getSync() ? rade_snrdB_3k_est(rade_) : 0);
}
else
{
return getCurrentRxModemStats()->snr_est;
}
}
IPipelineStep* FreeDVInterface::createTransmitPipeline(int inputSampleRate, int outputSampleRate, std::function<float()> getFreqOffsetFn)
{
std::vector<IPipelineStep*> parallelSteps;

View File

@ -135,6 +135,8 @@ public:
void restartTxVocoder();
float getSNREstimate();
private:
struct ReceivePipelineState
{

View File

@ -1682,8 +1682,9 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
float snr_limited;
// some APIs pass us invalid values, so lets trap it rather than bombing
if (!(isnan(freedvInterface.getCurrentRxModemStats()->snr_est) || isinf(freedvInterface.getCurrentRxModemStats()->snr_est))) {
g_snr = m_snrBeta*g_snr + (1.0 - m_snrBeta)*freedvInterface.getCurrentRxModemStats()->snr_est;
float snrEstimate = freedvInterface.getSNREstimate();
if (!(isnan(snrEstimate) || isinf(snrEstimate))) {
g_snr = m_snrBeta*g_snr + (1.0 - m_snrBeta)*snrEstimate;
}
snr_limited = g_snr;
if (snr_limited < -5.0) snr_limited = -5.0;
@ -1691,10 +1692,17 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
char snr[15];
snprintf(snr, 15, "%4.1f dB", g_snr);
wxString snr_string(snr);
m_textSNR->SetLabel(snr_string);
m_gaugeSNR->SetValue((int)(snr_limited+5));
if (freedvInterface.getSync())
{
wxString snr_string(snr);
m_textSNR->SetLabel(snr_string);
m_gaugeSNR->SetValue((int)(snr_limited+5));
}
else
{
m_textSNR->SetLabel("--");
m_gaugeSNR->SetValue(0);
}
// Level Gauge -----------------------------------------------------------------------
@ -1855,6 +1863,7 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
wxString wxCallsign = text;
delete[] text;
auto pendingSnr = (int)(g_snr + 0.5);
if (wxCallsign.Length() > 0)
{
freedvInterface.resetReliableText();
@ -1864,7 +1873,6 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
{
wxString rxCallsign = callsignFormat.GetMatch(wxCallsign, 1);
std::string pendingCallsign = rxCallsign.ToStdString();
auto pendingSnr = (int)(g_snr + 0.5);
wxString freqString;
if (wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz)
@ -1957,7 +1965,7 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
"",
freedvInterface.getCurrentModeStr(),
freq,
0
pendingSnr
);
}
}