1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

DSD demod: update threading model complements

This commit is contained in:
f4exb 2022-10-13 23:04:25 +02:00
parent 8721379b55
commit 02ed98fdfb
3 changed files with 25 additions and 16 deletions

View File

@ -718,17 +718,16 @@ void DSDDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& resp
void DSDDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
{
if (!m_running) {
return;
}
double magsqAvg, magsqPeak;
int nbMagsqSamples;
getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
if (m_running)
{
response.getDsdDemodReport()->setAudioSampleRate(m_basebandSink->getAudioSampleRate());
response.getDsdDemodReport()->setChannelSampleRate(m_basebandSink->getChannelSampleRate());
response.getDsdDemodReport()->setSquelch(m_basebandSink->getSquelchOpen() ? 1 : 0);
}
response.getDsdDemodReport()->setAudioSampleRate(m_basebandSink->getAudioSampleRate());
response.getDsdDemodReport()->setChannelSampleRate(m_basebandSink->getChannelSampleRate());
response.getDsdDemodReport()->setSquelch(m_basebandSink->getSquelchOpen() ? 1 : 0);
response.getDsdDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg));
response.getDsdDemodReport()->setPllLocked(getDecoder().getSymbolPLLLocked() ? 1 : 0);
response.getDsdDemodReport()->setSlot1On(getDecoder().getVoice1On() ? 1 : 0);

View File

@ -155,14 +155,24 @@ public:
SWGSDRangel::SWGChannelSettings& response);
uint32_t getNumberOfDeviceStreams() const;
void setScopeXYSink(BasebandSampleSink* sampleSink) { m_basebandSink->setScopeXYSink(sampleSink); }
void configureMyPosition(float myLatitude, float myLongitude) { m_basebandSink->configureMyPosition(myLatitude, myLongitude); }
double getMagSq() { return m_basebandSink->getMagSq(); }
bool getSquelchOpen() const { return m_basebandSink->getSquelchOpen(); }
void setScopeXYSink(BasebandSampleSink* sampleSink) { if (m_running) { m_basebandSink->setScopeXYSink(sampleSink); } }
void configureMyPosition(float myLatitude, float myLongitude) { if (m_running) { m_basebandSink->configureMyPosition(myLatitude, myLongitude); } }
double getMagSq() { return m_running ? m_basebandSink->getMagSq() : 0.0; }
bool getSquelchOpen() const { return m_running && m_basebandSink->getSquelchOpen(); }
const DSDDecoder& getDecoder() const { return m_basebandSink->getDecoder(); }
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { m_basebandSink->getMagSqLevels(avg, peak, nbSamples); }
const char *updateAndGetStatusText() { return m_basebandSink->updateAndGetStatusText(); }
int getAudioSampleRate() const { return m_basebandSink->getAudioSampleRate(); }
void getMagSqLevels(double& avg, double& peak, int& nbSamples)
{
if (m_running) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} else {
avg = 0.0; peak = 0.0; nbSamples = 1;
}
}
const char *updateAndGetStatusText() { return m_running ? m_basebandSink->updateAndGetStatusText() : nullptr; }
int getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; }
bool isRunning() { return m_running; }
static const char* const m_channelIdURI;
static const char* const m_channelId;

View File

@ -651,7 +651,7 @@ void DSDDemodGUI::tick()
// "slow" updates
if (m_tickCount % 10 == 0)
if (m_dsdDemod->isRunning() & (m_tickCount % 10 == 0))
{
ui->inLevelText->setText(QString::number(m_dsdDemod->getDecoder().getInLevel()));
ui->inCarrierPosText->setText(QString::number(m_dsdDemod->getDecoder().getCarrierPos()));