mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-03 13:47:50 -04:00
Display actual time units on time offset display
This commit is contained in:
parent
7924ed204a
commit
1ee68103d2
@ -49,6 +49,7 @@ private:
|
|||||||
|
|
||||||
void applySettings();
|
void applySettings();
|
||||||
void setTimeScaleDisplay();
|
void setTimeScaleDisplay();
|
||||||
|
void setTimeOfsDisplay();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_amp_valueChanged(int value);
|
void on_amp_valueChanged(int value);
|
||||||
|
@ -45,6 +45,7 @@ void GLScopeGUI::setSampleRate(int sampleRate)
|
|||||||
{
|
{
|
||||||
m_sampleRate = sampleRate;
|
m_sampleRate = sampleRate;
|
||||||
setTimeScaleDisplay();
|
setTimeScaleDisplay();
|
||||||
|
setTimeOfsDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLScopeGUI::resetToDefaults()
|
void GLScopeGUI::resetToDefaults()
|
||||||
@ -137,11 +138,13 @@ void GLScopeGUI::on_ampOfs_valueChanged(int value)
|
|||||||
void GLScopeGUI::on_scope_traceSizeChanged(int)
|
void GLScopeGUI::on_scope_traceSizeChanged(int)
|
||||||
{
|
{
|
||||||
setTimeScaleDisplay();
|
setTimeScaleDisplay();
|
||||||
|
setTimeOfsDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLScopeGUI::on_scope_sampleRateChanged(int)
|
void GLScopeGUI::on_scope_sampleRateChanged(int)
|
||||||
{
|
{
|
||||||
setTimeScaleDisplay();
|
setTimeScaleDisplay();
|
||||||
|
setTimeOfsDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLScopeGUI::setTimeScaleDisplay()
|
void GLScopeGUI::setTimeScaleDisplay()
|
||||||
@ -164,6 +167,21 @@ void GLScopeGUI::setTimeScaleDisplay()
|
|||||||
else ui->timeText->setText(tr("%1\ns/div").arg(t * 1.0));
|
else ui->timeText->setText(tr("%1\ns/div").arg(t * 1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLScopeGUI::setTimeOfsDisplay()
|
||||||
|
{
|
||||||
|
qreal dt = (m_glScope->getTraceSize() * (m_timeOffset/100.0) / m_sampleRate) / (qreal)m_timeBase;
|
||||||
|
|
||||||
|
if(dt < 0.000001)
|
||||||
|
ui->timeOfsText->setText(tr("%1\nns").arg(dt * 1000000000.0));
|
||||||
|
else if(dt < 0.001)
|
||||||
|
ui->timeOfsText->setText(tr("%1\nµs").arg(dt * 1000000.0));
|
||||||
|
else if(dt < 1.0)
|
||||||
|
ui->timeOfsText->setText(tr("%1\nms").arg(dt * 1000.0));
|
||||||
|
else ui->timeOfsText->setText(tr("%1\ns").arg(dt * 1.0));
|
||||||
|
|
||||||
|
//ui->timeOfsText->setText(tr("%1").arg(value/100.0, 0, 'f', 2));
|
||||||
|
}
|
||||||
|
|
||||||
void GLScopeGUI::on_time_valueChanged(int value)
|
void GLScopeGUI::on_time_valueChanged(int value)
|
||||||
{
|
{
|
||||||
m_timeBase = value;
|
m_timeBase = value;
|
||||||
@ -174,7 +192,7 @@ void GLScopeGUI::on_time_valueChanged(int value)
|
|||||||
void GLScopeGUI::on_timeOfs_valueChanged(int value)
|
void GLScopeGUI::on_timeOfs_valueChanged(int value)
|
||||||
{
|
{
|
||||||
m_timeOffset = value;
|
m_timeOffset = value;
|
||||||
ui->timeOfsText->setText(tr("%1").arg(value/100.0, 0, 'f', 2));
|
setTimeOfsDisplay();
|
||||||
m_glScope->setTimeOfsProMill(value*10);
|
m_glScope->setTimeOfsProMill(value*10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user