mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
RadioClock: put sample rate as static constant in settings
This commit is contained in:
parent
4ac6c54f95
commit
8e1491f9c2
@ -38,6 +38,7 @@
|
||||
#include "util/db.h"
|
||||
#include "maincore.h"
|
||||
#include "radioclocksink.h"
|
||||
#include "radioclocksettings.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(RadioClock::MsgConfigureRadioClock, Message)
|
||||
MESSAGE_CLASS_DEFINITION(RadioClock::MsgDateTime, Message)
|
||||
@ -366,7 +367,7 @@ void RadioClock::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& respon
|
||||
getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
|
||||
|
||||
response.getRadioClockReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg));
|
||||
response.getRadioClockReport()->setChannelSampleRate(RADIOCLOCK_CHANNEL_SAMPLE_RATE);
|
||||
response.getRadioClockReport()->setChannelSampleRate(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE);
|
||||
response.getRadioClockReport()->setDate(new QString(m_dateTime.date().toString()));
|
||||
response.getRadioClockReport()->setTime(new QString(m_dateTime.time().toString()));
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "dsp/downchannelizer.h"
|
||||
|
||||
#include "radioclockbaseband.h"
|
||||
#include "radioclocksettings.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(RadioClockBaseband::MsgConfigureRadioClockBaseband, Message)
|
||||
|
||||
@ -159,7 +160,7 @@ void RadioClockBaseband::applySettings(const RadioClockSettings& settings, bool
|
||||
{
|
||||
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force)
|
||||
{
|
||||
m_channelizer->setChannelization(RADIOCLOCK_CHANNEL_SAMPLE_RATE, settings.m_inputFrequencyOffset);
|
||||
m_channelizer->setChannelization(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE, settings.m_inputFrequencyOffset);
|
||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ RadioClockGUI::RadioClockGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
|
||||
m_scopeVis = m_radioClock->getScopeSink();
|
||||
m_scopeVis->setGLScope(ui->glScope);
|
||||
m_scopeVis->setNbStreams(7);
|
||||
m_scopeVis->setLiveRate(1000);
|
||||
m_scopeVis->setLiveRate(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE);
|
||||
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
|
||||
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
|
||||
ui->scopeGUI->setStreams(QStringList({"IQ", "MagSq", "TH", "FM", "Data", "Samp", "GotMM"}));
|
||||
|
@ -52,6 +52,7 @@ struct RadioClockSettings
|
||||
uint16_t m_reverseAPIDeviceIndex;
|
||||
uint16_t m_reverseAPIChannelIndex;
|
||||
Serializable *m_scopeGUI;
|
||||
static const int RADIOCLOCK_CHANNEL_SAMPLE_RATE = 1000;
|
||||
|
||||
RadioClockSettings();
|
||||
void resetToDefaults();
|
||||
|
@ -31,7 +31,7 @@
|
||||
RadioClockSink::RadioClockSink(RadioClock *radioClock) :
|
||||
m_scopeSink(nullptr),
|
||||
m_radioClock(radioClock),
|
||||
m_channelSampleRate(RADIOCLOCK_CHANNEL_SAMPLE_RATE),
|
||||
m_channelSampleRate(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE),
|
||||
m_channelFrequencyOffset(0),
|
||||
m_magsq(0.0),
|
||||
m_magsqSum(0.0),
|
||||
@ -48,7 +48,7 @@ RadioClockSink::RadioClockSink(RadioClock *radioClock) :
|
||||
m_second(0),
|
||||
m_zeroCount(0)
|
||||
{
|
||||
m_phaseDiscri.setFMScaling(RADIOCLOCK_CHANNEL_SAMPLE_RATE / (2.0f * 20.0/M_PI));
|
||||
m_phaseDiscri.setFMScaling(RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE / (2.0f * 20.0/M_PI));
|
||||
applySettings(m_settings, true);
|
||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||
}
|
||||
@ -177,10 +177,10 @@ void RadioClockSink::dcf77()
|
||||
// Look for minute marker - 59th second carrier is held high
|
||||
if ((m_data == 0) && (m_prevData == 1))
|
||||
{
|
||||
if ( (m_highCount <= RADIOCLOCK_CHANNEL_SAMPLE_RATE * 2)
|
||||
&& (m_highCount >= RADIOCLOCK_CHANNEL_SAMPLE_RATE * 1.6)
|
||||
&& (m_lowCount <= RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.3)
|
||||
&& (m_lowCount >= RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.1)
|
||||
if ( (m_highCount <= RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE * 2)
|
||||
&& (m_highCount >= RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE * 1.6)
|
||||
&& (m_lowCount <= RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.3)
|
||||
&& (m_lowCount >= RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.1)
|
||||
)
|
||||
{
|
||||
qDebug() << "RadioClockSink::dcf77 - Minute marker: (low " << m_lowCount << " high " << m_highCount << ") prev period " << m_periodCount;
|
||||
@ -318,8 +318,8 @@ void RadioClockSink::tdf(Complex &ci)
|
||||
// Look for minute marker - 59th second is not phase modulated
|
||||
if ((m_data == 1) && (m_prevData == 0))
|
||||
{
|
||||
if ( (m_zeroCount <= RADIOCLOCK_CHANNEL_SAMPLE_RATE * 2)
|
||||
&& (m_zeroCount >= RADIOCLOCK_CHANNEL_SAMPLE_RATE * 1)
|
||||
if ( (m_zeroCount <= RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE * 2)
|
||||
&& (m_zeroCount >= RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE * 1)
|
||||
)
|
||||
{
|
||||
qDebug() << "RadioClockSink::tdf - Minute marker: (zero " << m_zeroCount << ") prev period " << m_periodCount;
|
||||
@ -455,10 +455,10 @@ void RadioClockSink::msf60()
|
||||
// Look for minute marker - 500ms low, then 500ms high
|
||||
if ((m_data == 0) && (m_prevData == 1))
|
||||
{
|
||||
if ( (m_highCount <= RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.6)
|
||||
&& (m_highCount >= RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.4)
|
||||
&& (m_lowCount <= RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.6)
|
||||
&& (m_lowCount >= RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.4)
|
||||
if ( (m_highCount <= RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.6)
|
||||
&& (m_highCount >= RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.4)
|
||||
&& (m_lowCount <= RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.6)
|
||||
&& (m_lowCount >= RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE * 0.4)
|
||||
)
|
||||
{
|
||||
qDebug() << "RadioClockSink::msf60 - Minute marker: (low " << m_lowCount << " high " << m_highCount << ") prev period " << m_periodCount;
|
||||
@ -623,7 +623,7 @@ void RadioClockSink::applyChannelSettings(int channelSampleRate, int channelFreq
|
||||
if ((m_channelSampleRate != channelSampleRate) || force)
|
||||
{
|
||||
m_interpolator.create(16, channelSampleRate, m_settings.m_rfBandwidth / 2.2);
|
||||
m_interpolatorDistance = (Real) channelSampleRate / (Real) RADIOCLOCK_CHANNEL_SAMPLE_RATE;
|
||||
m_interpolatorDistance = (Real) channelSampleRate / (Real) RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE;
|
||||
m_interpolatorDistanceRemain = m_interpolatorDistance;
|
||||
}
|
||||
|
||||
@ -642,7 +642,7 @@ void RadioClockSink::applySettings(const RadioClockSettings& settings, bool forc
|
||||
if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force)
|
||||
{
|
||||
m_interpolator.create(16, m_channelSampleRate, settings.m_rfBandwidth / 2.2);
|
||||
m_interpolatorDistance = (Real) m_channelSampleRate / (Real) RADIOCLOCK_CHANNEL_SAMPLE_RATE;
|
||||
m_interpolatorDistance = (Real) m_channelSampleRate / (Real) RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE;
|
||||
m_interpolatorDistanceRemain = m_interpolatorDistance;
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,6 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#define RADIOCLOCK_CHANNEL_SAMPLE_RATE 1000
|
||||
|
||||
class ChannelAPI;
|
||||
class RadioClock;
|
||||
class ScopeVis;
|
||||
@ -113,7 +111,7 @@ private:
|
||||
|
||||
MovingAverageUtil<Real, double, 40> m_movingAverage; //!< Moving average has sharpest step response of LPFs
|
||||
|
||||
MovingAverageUtil<Real, double, RADIOCLOCK_CHANNEL_SAMPLE_RATE> m_thresholdMovingAverage; // Average over 1 second
|
||||
MovingAverageUtil<Real, double, RadioClockSettings::RADIOCLOCK_CHANNEL_SAMPLE_RATE> m_thresholdMovingAverage; // Average over 1 second
|
||||
|
||||
int m_data; //!< Demod data before clocking
|
||||
int m_prevData; //!< Previous value of m_data
|
||||
|
Loading…
Reference in New Issue
Block a user