1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

Limit scope time span display to two decimals

This commit is contained in:
f4exb 2016-08-26 21:22:40 +02:00
parent d4070e2941
commit 5174fcdff7

View File

@ -512,15 +512,28 @@ void GLScopeGUI::on_scope_sampleRateChanged(int)
void GLScopeGUI::setTimeScaleDisplay()
{
m_sampleRate = m_glScope->getSampleRate();
qreal t = (m_glScope->getTraceSize() * 1.0 / m_sampleRate) / (qreal)m_timeBase;
double t = (m_glScope->getTraceSize() * 1.0 / m_sampleRate) / (qreal)m_timeBase;
if(t < 0.000001)
ui->timeText->setText(tr("%1\nns").arg(t * 1000000000.0));
{
t = round(t * 100000000000.0) / 100.0;
ui->timeText->setText(tr("%1\nns").arg(t));
}
else if(t < 0.001)
ui->timeText->setText(tr("%1\nµs").arg(t * 1000000.0));
{
t = round(t * 100000000.0) / 100.0;
ui->timeText->setText(tr("%1\nµs").arg(t));
}
else if(t < 1.0)
ui->timeText->setText(tr("%1\nms").arg(t * 1000.0));
{
t = round(t * 100000.0) / 100.0;
ui->timeText->setText(tr("%1\nms").arg(t));
}
else
ui->timeText->setText(tr("%1\ns").arg(t * 1.0));
{
t = round(t * 100.0) / 100.0;
ui->timeText->setText(tr("%1\ns").arg(t));
}
}
void GLScopeGUI::setTraceLenDisplay()