kopia lustrzana https://github.com/f4exb/sdrangel
Scope + Spectrum: fixed trigger point to avoid invalid iterator
rodzic
635a1bd34b
commit
f1eeed38da
|
@ -229,19 +229,19 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_freeRun) {
|
if (m_freeRun) {
|
||||||
m_triggerPoint = cbegin;
|
m_triggerLocation = end - cbegin;
|
||||||
}
|
}
|
||||||
else if (m_triggerState == TriggerTriggered) {
|
else if (m_triggerState == TriggerTriggered) {
|
||||||
m_triggerPoint = cbegin;
|
m_triggerLocation = end - cbegin;
|
||||||
}
|
}
|
||||||
else if (m_triggerState == TriggerUntriggered) {
|
else if (m_triggerState == TriggerUntriggered) {
|
||||||
m_triggerPoint = end;
|
m_triggerLocation = 0;
|
||||||
}
|
}
|
||||||
else if (m_triggerWaitForReset) {
|
else if (m_triggerWaitForReset) {
|
||||||
m_triggerPoint = end;
|
m_triggerLocation = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_triggerPoint = cbegin;
|
m_triggerLocation = end - cbegin;
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleVector::const_iterator begin(cbegin);
|
SampleVector::const_iterator begin(cbegin);
|
||||||
|
@ -254,7 +254,7 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
||||||
triggerPointToEnd = -1;
|
triggerPointToEnd = -1;
|
||||||
processTrace(begin, end, triggerPointToEnd); // use all buffer
|
processTrace(begin, end, triggerPointToEnd); // use all buffer
|
||||||
if (triggerPointToEnd >= 0) {
|
if (triggerPointToEnd >= 0) {
|
||||||
m_triggerPoint = end - triggerPointToEnd;
|
m_triggerLocation = triggerPointToEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
begin = end; // effectively breaks out the loop
|
begin = end; // effectively breaks out the loop
|
||||||
|
@ -264,7 +264,8 @@ void ScopeVis::feed(const SampleVector::const_iterator& cbegin, const SampleVect
|
||||||
triggerPointToEnd = -1;
|
triggerPointToEnd = -1;
|
||||||
processTrace(begin, begin + m_traceSize, triggerPointToEnd); // use part of buffer to fit trace size
|
processTrace(begin, begin + m_traceSize, triggerPointToEnd); // use part of buffer to fit trace size
|
||||||
if (triggerPointToEnd >= 0) {
|
if (triggerPointToEnd >= 0) {
|
||||||
m_triggerPoint = begin + m_traceSize -triggerPointToEnd;
|
//m_triggerPoint = begin + m_traceSize - triggerPointToEnd;
|
||||||
|
m_triggerLocation = triggerPointToEnd - m_traceSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
begin += m_traceSize;
|
begin += m_traceSize;
|
||||||
|
|
|
@ -243,7 +243,7 @@ public:
|
||||||
virtual void start();
|
virtual void start();
|
||||||
virtual void stop();
|
virtual void stop();
|
||||||
virtual bool handleMessage(const Message& message);
|
virtual bool handleMessage(const Message& message);
|
||||||
SampleVector::const_iterator getTriggerPoint() const { return m_triggerPoint; }
|
int getTriggerLocation() const { return m_triggerLocation; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// === messages ===
|
// === messages ===
|
||||||
|
@ -1132,7 +1132,7 @@ private:
|
||||||
uint32_t m_timeBase; //!< Trace display time divisor
|
uint32_t m_timeBase; //!< Trace display time divisor
|
||||||
uint32_t m_timeOfsProMill; //!< Start trace shift in 1/1000 trace size
|
uint32_t m_timeOfsProMill; //!< Start trace shift in 1/1000 trace size
|
||||||
bool m_traceStart; //!< Trace is at start point
|
bool m_traceStart; //!< Trace is at start point
|
||||||
SampleVector::const_iterator m_triggerPoint; //!< Trigger start location in the samples vector
|
int m_triggerLocation; //!< Trigger location from end point
|
||||||
int m_sampleRate; //!< Actual sample rate being used
|
int m_sampleRate; //!< Actual sample rate being used
|
||||||
int m_liveSampleRate; //!< Sample rate in live mode
|
int m_liveSampleRate; //!< Sample rate in live mode
|
||||||
int m_liveLog2Decim; //!< Sample rate decimation log2 in live mode
|
int m_liveLog2Decim; //!< Sample rate decimation log2 in live mode
|
||||||
|
|
|
@ -18,8 +18,14 @@ void SpectrumScopeComboVis::feed(const SampleVector::const_iterator& begin, cons
|
||||||
{
|
{
|
||||||
(void) positiveOnly;
|
(void) positiveOnly;
|
||||||
m_scopeVis->feed(begin, end, false);
|
m_scopeVis->feed(begin, end, false);
|
||||||
SampleVector::const_iterator triggerPoint = m_scopeVis->getTriggerPoint();
|
//SampleVector::const_iterator triggerPoint = m_scopeVis->getTriggerPoint();
|
||||||
m_spectrumVis->feedTriggered(triggerPoint, end, positiveOnly);
|
//m_spectrumVis->feedTriggered(triggerPoint, end, positiveOnly);
|
||||||
|
int triggerPointLocation = m_scopeVis->getTriggerLocation();
|
||||||
|
if ((triggerPointLocation >= 0) && (triggerPointLocation < end - begin)) {
|
||||||
|
m_spectrumVis->feedTriggered(end - triggerPointLocation, end, positiveOnly);
|
||||||
|
} else {
|
||||||
|
m_spectrumVis->feedTriggered(begin, end, positiveOnly);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpectrumScopeComboVis::start()
|
void SpectrumScopeComboVis::start()
|
||||||
|
|
|
@ -78,11 +78,14 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
|
||||||
{
|
{
|
||||||
// if no visualisation is set, send the samples to /dev/null
|
// if no visualisation is set, send the samples to /dev/null
|
||||||
|
|
||||||
if(m_glSpectrum == 0)
|
if (m_glSpectrum == 0) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_mutex.tryLock(0)) { // prevent conflicts with configuration process
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SampleVector::const_iterator begin(cbegin);
|
SampleVector::const_iterator begin(cbegin);
|
||||||
|
|
||||||
while (begin < end)
|
while (begin < end)
|
||||||
|
@ -92,8 +95,6 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
|
||||||
|
|
||||||
if (todo >= samplesNeeded)
|
if (todo >= samplesNeeded)
|
||||||
{
|
{
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
|
||||||
|
|
||||||
// fill up the buffer
|
// fill up the buffer
|
||||||
std::vector<Complex>::iterator it = m_fftBuffer.begin() + m_fftBufferFill;
|
std::vector<Complex>::iterator it = m_fftBuffer.begin() + m_fftBufferFill;
|
||||||
|
|
||||||
|
@ -296,6 +297,8 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
|
||||||
m_needMoreSamples = true;
|
m_needMoreSamples = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpectrumVis::start()
|
void SpectrumVis::start()
|
||||||
|
|
Ładowanie…
Reference in New Issue