1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 17:45:48 -05:00

Corrected scope trace with time offset

This commit is contained in:
f4exb 2015-07-14 11:47:03 +02:00
parent e0699d9711
commit 50034678d2

View File

@ -3,6 +3,7 @@
#include "gui/glscope.h" #include "gui/glscope.h"
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
#include <algorithm>
#include <iostream> #include <iostream>
#ifdef _WIN32 #ifdef _WIN32
@ -328,6 +329,7 @@ void GLScope::paintGL()
glPopMatrix(); glPopMatrix();
} }
// paint trace
if(m_displayTrace->size() > 0) { if(m_displayTrace->size() > 0) {
glPushMatrix(); glPushMatrix();
glTranslatef(m_glScopeRect1.x(), m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0, 0); glTranslatef(m_glScopeRect1.x(), m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0, 0);
@ -337,8 +339,8 @@ void GLScope::paintGL()
glEnable(GL_LINE_SMOOTH); glEnable(GL_LINE_SMOOTH);
glLineWidth(1.0f); glLineWidth(1.0f);
glColor4f(1, 1, 0, 0.4f); glColor4f(1, 1, 0, 0.4f);
int start = m_timeOfsProMill * (m_displayTrace->size() - (m_displayTrace->size() / m_timeBase)) / 1000; int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size();
int end = start + m_displayTrace->size() / m_timeBase; int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size());
if(end - start < 2) if(end - start < 2)
start--; start--;
float posLimit = 1.0 / m_amp1; float posLimit = 1.0 / m_amp1;
@ -499,6 +501,7 @@ void GLScope::paintGL()
glPopMatrix(); glPopMatrix();
} }
// paint trace
if(m_displayTrace->size() > 0) { if(m_displayTrace->size() > 0) {
glPushMatrix(); glPushMatrix();
glTranslatef(m_glScopeRect2.x(), m_glScopeRect2.y() + m_glScopeRect2.height() / 2.0, 0); glTranslatef(m_glScopeRect2.x(), m_glScopeRect2.y() + m_glScopeRect2.height() / 2.0, 0);
@ -508,8 +511,8 @@ void GLScope::paintGL()
glEnable(GL_LINE_SMOOTH); glEnable(GL_LINE_SMOOTH);
glLineWidth(1.0f); glLineWidth(1.0f);
glColor4f(1, 1, 0, 0.4f); glColor4f(1, 1, 0, 0.4f);
int start = m_timeOfsProMill * (m_displayTrace->size() - (m_displayTrace->size() / m_timeBase)) / 1000; int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size();
int end = start + m_displayTrace->size() / m_timeBase; int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size());
if(end - start < 2) if(end - start < 2)
start--; start--;
float posLimit = 1.0 / m_amp2; float posLimit = 1.0 / m_amp2;