From c36104708a688a3e9311cc74c28b4407cee2a4a7 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 26 Jul 2015 10:00:21 +0200 Subject: [PATCH] Changed scope amplitude offset scale and display --- sdrbase/gui/glscopegui.cpp | 27 +++++++++++++++++++++------ sdrbase/gui/glscopegui.ui | 10 ++++++++-- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/sdrbase/gui/glscopegui.cpp b/sdrbase/gui/glscopegui.cpp index bc2128321..91de25ee1 100644 --- a/sdrbase/gui/glscopegui.cpp +++ b/sdrbase/gui/glscopegui.cpp @@ -255,11 +255,26 @@ void GLScopeGUI::setAmpScaleDisplay() void GLScopeGUI::setAmpOfsDisplay() { if (m_glScope->getDataMode() == GLScope::ModeMagdBPha) { - ui->ampOfsText->setText(tr("%1\ndB").arg(m_ampOffset - 100.0, 0, 'f', 0)); - } else if (m_glScope->getDataMode() == GLScope::ModeMagLinPha) { - ui->ampOfsText->setText(tr("%1").arg(m_ampOffset/200.0, 0, 'f', 3)); - } else { - ui->ampOfsText->setText(tr("%1").arg(m_ampOffset/100.0, 0, 'f', 2)); + ui->ampOfsText->setText(tr("%1\ndB").arg(m_ampOffset/10.0 - 100.0, 0, 'f', 1)); + } + else + { + qreal a; + + if (m_glScope->getDataMode() == GLScope::ModeMagLinPha) { + a = m_ampOffset/2000.0; + } else { + a = m_ampOffset/1000.0; + } + + if(fabs(a) < 0.000001) + ui->ampOfsText->setText(tr("%1\nn").arg(a * 1000000000.0)); + else if(fabs(a) < 0.001) + ui->ampOfsText->setText(tr("%1\nµ").arg(a * 1000000.0)); + else if(fabs(a) < 1.0) + ui->ampOfsText->setText(tr("%1\nm").arg(a * 1000.0)); + else + ui->ampOfsText->setText(tr("%1").arg(a * 1.0)); } } @@ -274,7 +289,7 @@ void GLScopeGUI::on_ampOfs_valueChanged(int value) { m_ampOffset = value; setAmpOfsDisplay(); - m_glScope->setAmpOfs(value/100.0); // scale to [-1.0,1.0] + m_glScope->setAmpOfs(value/1000.0); // scale to [-1.0,1.0] } void GLScopeGUI::on_scope_traceSizeChanged(int) diff --git a/sdrbase/gui/glscopegui.ui b/sdrbase/gui/glscopegui.ui index 4aa9e655e..a18dcd0f9 100644 --- a/sdrbase/gui/glscopegui.ui +++ b/sdrbase/gui/glscopegui.ui @@ -415,14 +415,20 @@ + + + 0 + 0 + + Y offset - -100 + -1000 - 100 + 1000 1