mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-05 10:25:32 -04:00
Deep redesign: debug phase #1
This commit is contained in:
parent
a6a7145f3d
commit
d23da25354
@ -59,11 +59,11 @@ void DSPEngine::run()
|
|||||||
qDebug() << "DSPEngine::run";
|
qDebug() << "DSPEngine::run";
|
||||||
|
|
||||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||||
connect(&m_syncMessenger, SIGNAL(messageSent(Message*)), this, SLOT(handleSynchronousMessages(Message*)), Qt::QueuedConnection);
|
connect(&m_syncMessenger, SIGNAL(messageSent(const Message&)), this, SLOT(handleSynchronousMessages(const Message&)), Qt::QueuedConnection);
|
||||||
|
|
||||||
m_state = StIdle;
|
m_state = StIdle;
|
||||||
|
|
||||||
handleInputMessages();
|
//handleInputMessages();
|
||||||
exec();
|
exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,6 +84,7 @@ void DSPEngine::stop()
|
|||||||
|
|
||||||
bool DSPEngine::initAcquisition()
|
bool DSPEngine::initAcquisition()
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::initAcquisition";
|
||||||
DSPAcquisitionInit cmd;
|
DSPAcquisitionInit cmd;
|
||||||
|
|
||||||
return m_syncMessenger.sendWait(cmd) == StReady;
|
return m_syncMessenger.sendWait(cmd) == StReady;
|
||||||
@ -91,6 +92,7 @@ bool DSPEngine::initAcquisition()
|
|||||||
|
|
||||||
bool DSPEngine::startAcquisition()
|
bool DSPEngine::startAcquisition()
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::startAcquisition";
|
||||||
DSPAcquisitionStart cmd;
|
DSPAcquisitionStart cmd;
|
||||||
|
|
||||||
return m_syncMessenger.sendWait(cmd) == StRunning;
|
return m_syncMessenger.sendWait(cmd) == StRunning;
|
||||||
@ -98,6 +100,7 @@ bool DSPEngine::startAcquisition()
|
|||||||
|
|
||||||
void DSPEngine::stopAcquistion()
|
void DSPEngine::stopAcquistion()
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::stopAcquistion";
|
||||||
DSPAcquisitionStop cmd;
|
DSPAcquisitionStop cmd;
|
||||||
m_syncMessenger.sendWait(cmd);
|
m_syncMessenger.sendWait(cmd);
|
||||||
|
|
||||||
@ -109,6 +112,7 @@ void DSPEngine::stopAcquistion()
|
|||||||
|
|
||||||
void DSPEngine::setSource(SampleSource* source)
|
void DSPEngine::setSource(SampleSource* source)
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::setSource";
|
||||||
DSPSetSource cmd(source);
|
DSPSetSource cmd(source);
|
||||||
m_syncMessenger.sendWait(cmd);
|
m_syncMessenger.sendWait(cmd);
|
||||||
}
|
}
|
||||||
@ -122,6 +126,7 @@ void DSPEngine::addSink(SampleSink* sink)
|
|||||||
|
|
||||||
void DSPEngine::removeSink(SampleSink* sink)
|
void DSPEngine::removeSink(SampleSink* sink)
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::removeSink: " << sink->objectName().toStdString().c_str();
|
||||||
DSPRemoveSink cmd(sink);
|
DSPRemoveSink cmd(sink);
|
||||||
m_syncMessenger.sendWait(cmd);
|
m_syncMessenger.sendWait(cmd);
|
||||||
}
|
}
|
||||||
@ -135,30 +140,35 @@ void DSPEngine::addThreadedSink(SampleSink* sink)
|
|||||||
|
|
||||||
void DSPEngine::removeThreadedSink(SampleSink* sink)
|
void DSPEngine::removeThreadedSink(SampleSink* sink)
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::removeThreadedSink: " << sink->objectName().toStdString().c_str();
|
||||||
DSPRemoveThreadedSink cmd(sink);
|
DSPRemoveThreadedSink cmd(sink);
|
||||||
m_syncMessenger.sendWait(cmd);
|
m_syncMessenger.sendWait(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPEngine::addAudioSink(AudioFifo* audioFifo)
|
void DSPEngine::addAudioSink(AudioFifo* audioFifo)
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::addAudioSink";
|
||||||
DSPAddAudioSink cmd(audioFifo);
|
DSPAddAudioSink cmd(audioFifo);
|
||||||
m_syncMessenger.sendWait(cmd);
|
m_syncMessenger.sendWait(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPEngine::removeAudioSink(AudioFifo* audioFifo)
|
void DSPEngine::removeAudioSink(AudioFifo* audioFifo)
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::removeAudioSink";
|
||||||
DSPRemoveAudioSink cmd(audioFifo);
|
DSPRemoveAudioSink cmd(audioFifo);
|
||||||
m_syncMessenger.sendWait(cmd);
|
m_syncMessenger.sendWait(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPEngine::configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection)
|
void DSPEngine::configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection)
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::configureCorrections";
|
||||||
DSPConfigureCorrection* cmd = new DSPConfigureCorrection(dcOffsetCorrection, iqImbalanceCorrection);
|
DSPConfigureCorrection* cmd = new DSPConfigureCorrection(dcOffsetCorrection, iqImbalanceCorrection);
|
||||||
m_inputMessageQueue.push(cmd);
|
m_inputMessageQueue.push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DSPEngine::errorMessage()
|
QString DSPEngine::errorMessage()
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::errorMessage";
|
||||||
DSPGetErrorMessage cmd;
|
DSPGetErrorMessage cmd;
|
||||||
m_syncMessenger.sendWait(cmd);
|
m_syncMessenger.sendWait(cmd);
|
||||||
return cmd.getErrorMessage();
|
return cmd.getErrorMessage();
|
||||||
@ -166,6 +176,7 @@ QString DSPEngine::errorMessage()
|
|||||||
|
|
||||||
QString DSPEngine::sourceDeviceDescription()
|
QString DSPEngine::sourceDeviceDescription()
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::sourceDeviceDescription";
|
||||||
DSPGetSourceDeviceDescription cmd;
|
DSPGetSourceDeviceDescription cmd;
|
||||||
m_syncMessenger.sendWait(cmd);
|
m_syncMessenger.sendWait(cmd);
|
||||||
return cmd.getDeviceDescription();
|
return cmd.getDeviceDescription();
|
||||||
@ -178,6 +189,8 @@ void DSPEngine::dcOffset(SampleVector::iterator begin, SampleVector::iterator en
|
|||||||
int qo = 0;
|
int qo = 0;
|
||||||
Sample corr((qint16)m_iOffset, (qint16)m_qOffset);
|
Sample corr((qint16)m_iOffset, (qint16)m_qOffset);
|
||||||
|
|
||||||
|
qDebug() << "DSPEngine::dcOffset";
|
||||||
|
|
||||||
// sum and correct in one pass
|
// sum and correct in one pass
|
||||||
for(SampleVector::iterator it = begin; it < end; it++)
|
for(SampleVector::iterator it = begin; it < end; it++)
|
||||||
{
|
{
|
||||||
@ -199,6 +212,8 @@ void DSPEngine::imbalance(SampleVector::iterator begin, SampleVector::iterator e
|
|||||||
int qMin = 0;
|
int qMin = 0;
|
||||||
int qMax = 0;
|
int qMax = 0;
|
||||||
|
|
||||||
|
qDebug() << "DSPEngine::imbalance";
|
||||||
|
|
||||||
// find value ranges for both I and Q
|
// find value ranges for both I and Q
|
||||||
// both intervals should be same same size (for a perfect circle)
|
// both intervals should be same same size (for a perfect circle)
|
||||||
for (SampleVector::iterator it = begin; it < end; it++)
|
for (SampleVector::iterator it = begin; it < end; it++)
|
||||||
@ -243,6 +258,8 @@ void DSPEngine::imbalance(SampleVector::iterator begin, SampleVector::iterator e
|
|||||||
|
|
||||||
void DSPEngine::work()
|
void DSPEngine::work()
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::work";
|
||||||
|
|
||||||
SampleFifo* sampleFifo = m_sampleSource->getSampleFifo();
|
SampleFifo* sampleFifo = m_sampleSource->getSampleFifo();
|
||||||
std::size_t samplesDone = 0;
|
std::size_t samplesDone = 0;
|
||||||
bool positiveOnly = false;
|
bool positiveOnly = false;
|
||||||
@ -304,6 +321,8 @@ void DSPEngine::work()
|
|||||||
|
|
||||||
DSPEngine::State DSPEngine::gotoIdle()
|
DSPEngine::State DSPEngine::gotoIdle()
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::gotoIdle";
|
||||||
|
|
||||||
switch(m_state) {
|
switch(m_state) {
|
||||||
case StNotStarted:
|
case StNotStarted:
|
||||||
return StNotStarted;
|
return StNotStarted;
|
||||||
@ -339,6 +358,8 @@ DSPEngine::State DSPEngine::gotoIdle()
|
|||||||
|
|
||||||
DSPEngine::State DSPEngine::gotoInit()
|
DSPEngine::State DSPEngine::gotoInit()
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::gotoInit";
|
||||||
|
|
||||||
switch(m_state) {
|
switch(m_state) {
|
||||||
case StNotStarted:
|
case StNotStarted:
|
||||||
return StNotStarted;
|
return StNotStarted;
|
||||||
@ -450,6 +471,8 @@ DSPEngine::State DSPEngine::gotoRunning()
|
|||||||
|
|
||||||
DSPEngine::State DSPEngine::gotoError(const QString& errorMessage)
|
DSPEngine::State DSPEngine::gotoError(const QString& errorMessage)
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::gotoError";
|
||||||
|
|
||||||
m_errorMessage = errorMessage;
|
m_errorMessage = errorMessage;
|
||||||
m_deviceDescription.clear();
|
m_deviceDescription.clear();
|
||||||
m_state = StError;
|
m_state = StError;
|
||||||
@ -480,6 +503,8 @@ void DSPEngine::handleSetSource(SampleSource* source)
|
|||||||
|
|
||||||
void DSPEngine::handleData()
|
void DSPEngine::handleData()
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::handleData";
|
||||||
|
|
||||||
if(m_state == StRunning)
|
if(m_state == StRunning)
|
||||||
{
|
{
|
||||||
work();
|
work();
|
||||||
@ -488,6 +513,8 @@ void DSPEngine::handleData()
|
|||||||
|
|
||||||
void DSPEngine::handleSynchronousMessages(const Message& message)
|
void DSPEngine::handleSynchronousMessages(const Message& message)
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::handleSynchronousMessages";
|
||||||
|
|
||||||
if (DSPExit::match(message))
|
if (DSPExit::match(message))
|
||||||
{
|
{
|
||||||
gotoIdle();
|
gotoIdle();
|
||||||
@ -597,6 +624,8 @@ void DSPEngine::handleSynchronousMessages(const Message& message)
|
|||||||
|
|
||||||
void DSPEngine::handleInputMessages()
|
void DSPEngine::handleInputMessages()
|
||||||
{
|
{
|
||||||
|
qDebug() << "DSPEngine::handleInputMessages";
|
||||||
|
|
||||||
Message* message;
|
Message* message;
|
||||||
|
|
||||||
while ((message = m_inputMessageQueue.pop()) != 0)
|
while ((message = m_inputMessageQueue.pop()) != 0)
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
SyncMessenger::SyncMessenger() :
|
SyncMessenger::SyncMessenger() :
|
||||||
m_complete(0),
|
m_complete(0),
|
||||||
m_result(0)
|
m_result(0)
|
||||||
{}
|
{
|
||||||
|
qRegisterMetaType<Message>("Message");
|
||||||
|
}
|
||||||
|
|
||||||
SyncMessenger::~SyncMessenger()
|
SyncMessenger::~SyncMessenger()
|
||||||
{}
|
{}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user