| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | #include "gui/glscopegui.h"
 | 
					
						
							|  |  |  | #include "dsp/scopevis.h"
 | 
					
						
							|  |  |  | #include "dsp/dspcommands.h"
 | 
					
						
							|  |  |  | #include "gui/glscope.h"
 | 
					
						
							|  |  |  | #include "util/simpleserializer.h"
 | 
					
						
							|  |  |  | #include "ui_glscopegui.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-09 10:33:04 +02:00
										 |  |  | #include <QDebug>
 | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-12 11:25:55 +02:00
										 |  |  | const qreal GLScopeGUI::amps[11] = { 0.2, 0.1, 0.05, 0.02, 0.01, 0.005, 0.002, 0.001, 0.0005, 0.0002, 0.0001 }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | GLScopeGUI::GLScopeGUI(QWidget* parent) : | 
					
						
							|  |  |  | 	QWidget(parent), | 
					
						
							|  |  |  | 	ui(new Ui::GLScopeGUI), | 
					
						
							|  |  |  | 	m_messageQueue(NULL), | 
					
						
							|  |  |  | 	m_scopeVis(NULL), | 
					
						
							|  |  |  | 	m_glScope(NULL), | 
					
						
							| 
									
										
										
										
											2015-07-06 09:17:51 +02:00
										 |  |  | 	m_sampleRate(1), | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	m_displayData(GLScope::ModeIQ), | 
					
						
							|  |  |  | 	m_displayOrientation(Qt::Horizontal), | 
					
						
							| 
									
										
										
										
											2015-07-12 23:45:17 +02:00
										 |  |  | 	m_displays(GLScope::DisplayBoth), | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	m_timeBase(1), | 
					
						
							|  |  |  | 	m_timeOffset(0), | 
					
						
							| 
									
										
										
										
											2015-06-23 22:52:27 +02:00
										 |  |  | 	m_amplification(0), | 
					
						
							| 
									
										
										
										
											2015-07-06 09:17:51 +02:00
										 |  |  | 	m_ampOffset(0), | 
					
						
							| 
									
										
										
										
											2015-07-13 10:46:51 +02:00
										 |  |  | 	m_displayGridIntensity(1), | 
					
						
							|  |  |  | 	m_triggerChannel(ScopeVis::TriggerFreeRun), | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 	m_triggerLevelCoarse(0), | 
					
						
							|  |  |  | 	m_triggerLevelFine(0), | 
					
						
							| 
									
										
										
										
											2015-07-21 21:38:36 +02:00
										 |  |  | 	m_triggerPositiveEdge(true), | 
					
						
							| 
									
										
										
										
											2015-07-23 06:52:12 +02:00
										 |  |  | 	m_triggerBothEdges(false), | 
					
						
							| 
									
										
										
										
											2015-07-21 22:18:17 +02:00
										 |  |  |     m_triggerPre(0), | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  |     m_triggerDelay(0), | 
					
						
							| 
									
										
										
										
											2015-07-22 01:06:42 +02:00
										 |  |  | 	m_traceLenMult(20) | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | { | 
					
						
							|  |  |  | 	ui->setupUi(this); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | GLScopeGUI::~GLScopeGUI() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	delete ui; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::setBuddies(MessageQueue* messageQueue, ScopeVis* scopeVis, GLScope* glScope) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_messageQueue = messageQueue; | 
					
						
							|  |  |  | 	m_scopeVis = scopeVis; | 
					
						
							|  |  |  | 	m_glScope = glScope; | 
					
						
							| 
									
										
										
										
											2015-07-07 01:17:16 +02:00
										 |  |  | 	connect(m_glScope, SIGNAL(traceSizeChanged(int)), this, SLOT(on_scope_traceSizeChanged(int))); | 
					
						
							|  |  |  | 	connect(m_glScope, SIGNAL(sampleRateChanged(int)), this, SLOT(on_scope_sampleRateChanged(int))); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	applySettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 00:01:48 +02:00
										 |  |  | void GLScopeGUI::setSampleRate(int sampleRate) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_sampleRate = sampleRate; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | void GLScopeGUI::resetToDefaults() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_displayData = GLScope::ModeIQ; | 
					
						
							|  |  |  | 	m_displayOrientation = Qt::Horizontal; | 
					
						
							|  |  |  | 	m_timeBase = 1; | 
					
						
							|  |  |  | 	m_timeOffset = 0; | 
					
						
							|  |  |  | 	m_amplification = 0; | 
					
						
							| 
									
										
										
										
											2015-06-23 22:52:27 +02:00
										 |  |  | 	m_displayGridIntensity = 5; | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  |     m_triggerChannel = ScopeVis::TriggerFreeRun; | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  |     m_triggerLevelCoarse = 0; | 
					
						
							|  |  |  |     m_triggerLevelFine = 0; | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  |     m_triggerPositiveEdge = true; | 
					
						
							|  |  |  |     m_triggerPre = 0; | 
					
						
							|  |  |  |     m_triggerDelay = 0; | 
					
						
							|  |  |  |     m_traceLenMult = 20; | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	applySettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QByteArray GLScopeGUI::serialize() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	SimpleSerializer s(1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	s.writeS32(1, m_displayData); | 
					
						
							|  |  |  | 	s.writeS32(2, m_displayOrientation); | 
					
						
							|  |  |  | 	s.writeS32(3, m_timeBase); | 
					
						
							|  |  |  | 	s.writeS32(4, m_timeOffset); | 
					
						
							|  |  |  | 	s.writeS32(5, m_amplification); | 
					
						
							| 
									
										
										
										
											2015-06-23 22:52:27 +02:00
										 |  |  | 	s.writeS32(6, m_displayGridIntensity); | 
					
						
							| 
									
										
										
										
											2015-07-06 09:17:51 +02:00
										 |  |  | 	s.writeS32(7, m_ampOffset); | 
					
						
							| 
									
										
										
										
											2015-07-12 23:45:17 +02:00
										 |  |  | 	s.writeS32(8, m_displays); | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | 	s.writeS32(9, m_triggerChannel); | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 	s.writeS32(10, m_triggerLevelCoarse); | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | 	s.writeBool(11, m_triggerPositiveEdge); | 
					
						
							| 
									
										
										
										
											2015-07-18 11:27:09 +02:00
										 |  |  | 	s.writeS32(12, m_displayTraceIntensity); | 
					
						
							| 
									
										
										
										
											2015-07-21 22:18:17 +02:00
										 |  |  | 	s.writeS32(13, m_triggerPre); | 
					
						
							| 
									
										
										
										
											2015-07-22 01:06:42 +02:00
										 |  |  | 	s.writeS32(14, m_traceLenMult); | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  | 	s.writeS32(15, m_triggerDelay); | 
					
						
							| 
									
										
										
										
											2015-07-23 06:52:12 +02:00
										 |  |  | 	s.writeBool(16, m_triggerBothEdges); | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 	s.writeS32(17, m_triggerLevelFine); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return s.final(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool GLScopeGUI::deserialize(const QByteArray& data) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	SimpleDeserializer d(data); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if(!d.isValid()) { | 
					
						
							|  |  |  | 		resetToDefaults(); | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if(d.getVersion() == 1) { | 
					
						
							|  |  |  | 		d.readS32(1, &m_displayData, GLScope::ModeIQ); | 
					
						
							|  |  |  | 		d.readS32(2, &m_displayOrientation, Qt::Horizontal); | 
					
						
							|  |  |  | 		d.readS32(3, &m_timeBase, 1); | 
					
						
							|  |  |  | 		d.readS32(4, &m_timeOffset, 0); | 
					
						
							|  |  |  | 		d.readS32(5, &m_amplification, 0); | 
					
						
							| 
									
										
										
										
											2015-06-23 22:52:27 +02:00
										 |  |  | 		d.readS32(6, &m_displayGridIntensity, 5); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 		if(m_timeBase < 0) | 
					
						
							|  |  |  | 			m_timeBase = 1; | 
					
						
							| 
									
										
										
										
											2015-07-06 09:17:51 +02:00
										 |  |  | 		d.readS32(7, &m_ampOffset, 0); | 
					
						
							| 
									
										
										
										
											2015-07-12 23:45:17 +02:00
										 |  |  | 		d.readS32(8, &m_displays, GLScope::DisplayBoth); | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | 		d.readS32(9, &m_triggerChannel, ScopeVis::TriggerFreeRun); | 
					
						
							|  |  |  | 		ui->trigMode->setCurrentIndex(m_triggerChannel); | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 		d.readS32(10, &m_triggerLevelCoarse, 0); | 
					
						
							|  |  |  | 		ui->trigLevelCoarse->setValue(m_triggerLevelCoarse); | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | 		d.readBool(11, &m_triggerPositiveEdge, true); | 
					
						
							| 
									
										
										
										
											2015-07-18 11:27:09 +02:00
										 |  |  | 		d.readS32(12, &m_displayTraceIntensity, 50); | 
					
						
							| 
									
										
										
										
											2015-07-21 22:18:17 +02:00
										 |  |  | 		d.readS32(13, &m_triggerPre, 0); | 
					
						
							|  |  |  | 		ui->trigPre->setValue(m_triggerPre); | 
					
						
							|  |  |  | 		setTrigPreDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-22 01:06:42 +02:00
										 |  |  | 		d.readS32(14, &m_traceLenMult, 20); | 
					
						
							|  |  |  | 		ui->traceLen->setValue(m_traceLenMult); | 
					
						
							|  |  |  | 		setTraceLenDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  | 		d.readS32(15, &m_triggerDelay, 0); | 
					
						
							|  |  |  | 		ui->trigDelay->setValue(m_triggerDelay); | 
					
						
							|  |  |  | 		setTrigDelayDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-23 06:52:12 +02:00
										 |  |  | 		d.readBool(16, &m_triggerBothEdges, false); | 
					
						
							|  |  |  | 		if (m_triggerBothEdges) { | 
					
						
							|  |  |  | 			ui->slopePos->setChecked(false); | 
					
						
							|  |  |  | 			ui->slopeNeg->setChecked(false); | 
					
						
							|  |  |  | 			ui->slopeBoth->setChecked(true); | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			ui->slopeBoth->setChecked(false); | 
					
						
							|  |  |  | 			ui->slopePos->setChecked(m_triggerPositiveEdge); | 
					
						
							|  |  |  | 			ui->slopeNeg->setChecked(!m_triggerPositiveEdge); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 		d.readS32(17, &m_triggerLevelFine, 0); | 
					
						
							|  |  |  | 		ui->trigLevelFine->setValue(m_triggerLevelFine); | 
					
						
							|  |  |  | 		setTrigLevelDisplay(); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 		applySettings(); | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | 		applyTriggerSettings(); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 		return true; | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		resetToDefaults(); | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::applySettings() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	ui->dataMode->setCurrentIndex(m_displayData); | 
					
						
							| 
									
										
										
										
											2015-07-12 23:45:17 +02:00
										 |  |  | 	if (m_displays == GLScope::DisplayBoth) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		if(m_displayOrientation == Qt::Horizontal) { | 
					
						
							|  |  |  | 			m_glScope->setOrientation(Qt::Horizontal); | 
					
						
							|  |  |  | 			ui->horizView->setChecked(true); | 
					
						
							|  |  |  | 			ui->vertView->setChecked(false); | 
					
						
							|  |  |  | 			ui->onlyPrimeView->setChecked(false); | 
					
						
							|  |  |  | 			ui->onlySecondView->setChecked(false); | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			m_glScope->setOrientation(Qt::Vertical); | 
					
						
							|  |  |  | 			ui->horizView->setChecked(false); | 
					
						
							|  |  |  | 			ui->vertView->setChecked(true); | 
					
						
							|  |  |  | 			ui->onlyPrimeView->setChecked(false); | 
					
						
							|  |  |  | 			ui->onlySecondView->setChecked(false); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	else if (m_displays == GLScope::DisplayFirstOnly) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		m_glScope->setDisplays(GLScope::DisplayFirstOnly); | 
					
						
							|  |  |  | 		ui->onlyPrimeView->setChecked(true); | 
					
						
							|  |  |  | 		ui->horizView->setChecked(false); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 		ui->vertView->setChecked(false); | 
					
						
							| 
									
										
										
										
											2015-07-12 23:45:17 +02:00
										 |  |  | 		ui->onlySecondView->setChecked(false); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	else if (m_displays == GLScope::DisplaySecondOnly) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		m_glScope->setDisplays(GLScope::DisplaySecondOnly); | 
					
						
							|  |  |  | 		ui->onlySecondView->setChecked(true); | 
					
						
							|  |  |  | 		ui->onlyPrimeView->setChecked(false); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 		ui->horizView->setChecked(false); | 
					
						
							| 
									
										
										
										
											2015-07-12 23:45:17 +02:00
										 |  |  | 		ui->vertView->setChecked(false); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	ui->time->setValue(m_timeBase); | 
					
						
							|  |  |  | 	ui->timeOfs->setValue(m_timeOffset); | 
					
						
							|  |  |  | 	ui->amp->setValue(m_amplification); | 
					
						
							| 
									
										
										
										
											2015-07-08 02:11:13 +02:00
										 |  |  | 	ui->ampOfs->setValue(m_ampOffset); | 
					
						
							| 
									
										
										
										
											2015-06-23 22:52:27 +02:00
										 |  |  | 	ui->gridIntensity->setSliderPosition(m_displayGridIntensity); | 
					
						
							| 
									
										
										
										
											2015-07-18 11:27:09 +02:00
										 |  |  | 	ui->traceIntensity->setSliderPosition(m_displayTraceIntensity); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | void GLScopeGUI::applyTriggerSettings() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 	qreal t = (m_triggerLevelCoarse / 100.0) + (m_triggerLevelFine / 20000.0); // [-1.0, 1.0]
 | 
					
						
							|  |  |  | 	qreal triggerLevel; | 
					
						
							| 
									
										
										
										
											2015-07-21 22:18:17 +02:00
										 |  |  | 	quint32 preTriggerSamples = (m_glScope->getTraceSize() * m_triggerPre) / 100; | 
					
						
							| 
									
										
										
										
											2015-07-13 23:38:10 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (m_triggerChannel == ScopeVis::TriggerMagDb) { | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 		triggerLevel = 100.0 * (t - 1.0); // [-200.0, 0.0]
 | 
					
						
							| 
									
										
										
										
											2015-07-26 13:06:15 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else if (m_triggerChannel == ScopeVis::TriggerMagLin) { | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 		triggerLevel = 1.0 + t; // [0.0, 2.0]
 | 
					
						
							| 
									
										
										
										
											2015-07-13 23:38:10 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else { | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 		triggerLevel = t; // [-1.0, 1.0]
 | 
					
						
							| 
									
										
										
										
											2015-07-13 23:38:10 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-14 01:45:16 +02:00
										 |  |  | 	m_glScope->setTriggerChannel((ScopeVis::TriggerChannel) m_triggerChannel); | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 	m_glScope->setTriggerLevel(t);  // [-1.0, 1.0]
 | 
					
						
							| 
									
										
										
										
											2015-07-27 02:12:37 +02:00
										 |  |  | 	m_glScope->setTriggerPre(m_triggerPre/100.0); // [0.0, 1.0]
 | 
					
						
							| 
									
										
										
										
											2015-07-14 01:45:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-22 01:06:42 +02:00
										 |  |  | 	m_scopeVis->configure(m_messageQueue, | 
					
						
							|  |  |  | 			(ScopeVis::TriggerChannel) m_triggerChannel, | 
					
						
							|  |  |  | 			triggerLevel, | 
					
						
							|  |  |  | 			m_triggerPositiveEdge, | 
					
						
							| 
									
										
										
										
											2015-07-23 06:52:12 +02:00
										 |  |  | 			m_triggerBothEdges, | 
					
						
							| 
									
										
										
										
											2015-07-22 01:06:42 +02:00
										 |  |  | 			preTriggerSamples, | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  |             m_triggerDelay, | 
					
						
							| 
									
										
										
										
											2015-07-22 01:06:42 +02:00
										 |  |  | 			m_traceLenMult * ScopeVis::m_traceChunkSize); | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::setTrigLevelDisplay() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 	qreal t = (m_triggerLevelCoarse / 100.0) + (m_triggerLevelFine / 20000.0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ui->trigLevelCoarse->setToolTip(QString("Trigger level coarse: %1 %").arg(m_triggerLevelCoarse)); | 
					
						
							|  |  |  | 	ui->trigLevelFine->setToolTip(QString("Trigger level fine: %1 ppm").arg(m_triggerLevelFine * 50)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-14 00:53:08 +02:00
										 |  |  | 	if (m_triggerChannel == ScopeVis::TriggerMagDb) { | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 		ui->trigText->setText(tr("%1\ndB").arg(100.0 * (t - 1.0), 0, 'f', 1)); | 
					
						
							| 
									
										
										
										
											2015-07-14 00:53:08 +02:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-07-26 10:35:57 +02:00
										 |  |  | 	else | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2015-07-26 13:06:15 +02:00
										 |  |  | 		qreal a; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-27 02:22:41 +02:00
										 |  |  | 		if (m_triggerChannel == ScopeVis::TriggerMagLin) { | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 			a = 1.0 + t; | 
					
						
							| 
									
										
										
										
											2015-07-26 13:06:15 +02:00
										 |  |  | 		} else { | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 			a = t; | 
					
						
							| 
									
										
										
										
											2015-07-26 13:06:15 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-07-26 10:35:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		if(fabs(a) < 0.000001) | 
					
						
							|  |  |  | 			ui->trigText->setText(tr("%1\nn").arg(a * 1000000000.0)); | 
					
						
							|  |  |  | 		else if(fabs(a) < 0.001) | 
					
						
							|  |  |  | 			ui->trigText->setText(tr("%1\nµ").arg(a * 1000000.0)); | 
					
						
							|  |  |  | 		else if(fabs(a) < 1.0) | 
					
						
							|  |  |  | 			ui->trigText->setText(tr("%1\nm").arg(a * 1000.0)); | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			ui->trigText->setText(tr("%1").arg(a * 1.0)); | 
					
						
							| 
									
										
										
										
											2015-07-14 00:53:08 +02:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-12 11:25:55 +02:00
										 |  |  | void GLScopeGUI::setAmpScaleDisplay() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (m_glScope->getDataMode() == GLScope::ModeMagdBPha) { | 
					
						
							| 
									
										
										
										
											2015-07-14 10:39:41 +02:00
										 |  |  | 		ui->ampText->setText(tr("%1\ndB").arg(amps[m_amplification]*500.0, 0, 'f', 1)); | 
					
						
							| 
									
										
										
										
											2015-07-12 11:25:55 +02:00
										 |  |  | 	} else { | 
					
						
							| 
									
										
										
										
											2015-07-25 18:53:27 +02:00
										 |  |  | 		qreal a = amps[m_amplification]*10.0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if(a < 0.000001) | 
					
						
							|  |  |  | 			ui->ampText->setText(tr("%1\nn").arg(a * 1000000000.0)); | 
					
						
							|  |  |  | 		else if(a < 0.001) | 
					
						
							|  |  |  | 			ui->ampText->setText(tr("%1\nµ").arg(a * 1000000.0)); | 
					
						
							|  |  |  | 		else if(a < 1.0) | 
					
						
							|  |  |  | 			ui->ampText->setText(tr("%1\nm").arg(a * 1000.0)); | 
					
						
							|  |  |  | 		else | 
					
						
							|  |  |  | 			ui->ampText->setText(tr("%1").arg(a * 1.0)); | 
					
						
							| 
									
										
										
										
											2015-07-12 11:25:55 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::setAmpOfsDisplay() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (m_glScope->getDataMode() == GLScope::ModeMagdBPha) { | 
					
						
							| 
									
										
										
										
											2015-07-26 10:00:21 +02:00
										 |  |  | 		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)); | 
					
						
							| 
									
										
										
										
											2015-07-12 11:25:55 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | void GLScopeGUI::on_amp_valueChanged(int value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_amplification = value; | 
					
						
							| 
									
										
										
										
											2015-07-12 11:25:55 +02:00
										 |  |  | 	setAmpScaleDisplay(); | 
					
						
							|  |  |  | 	m_glScope->setAmp(0.2 / amps[m_amplification]); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-06 09:17:51 +02:00
										 |  |  | void GLScopeGUI::on_ampOfs_valueChanged(int value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_ampOffset = value; | 
					
						
							| 
									
										
										
										
											2015-07-12 11:25:55 +02:00
										 |  |  | 	setAmpOfsDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-26 10:00:21 +02:00
										 |  |  | 	m_glScope->setAmpOfs(value/1000.0); // scale to [-1.0,1.0]
 | 
					
						
							| 
									
										
										
										
											2015-07-06 09:17:51 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | void GLScopeGUI::on_scope_traceSizeChanged(int) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-07 01:17:16 +02:00
										 |  |  | 	setTimeScaleDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-22 01:06:42 +02:00
										 |  |  | 	setTraceLenDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-12 10:17:23 +02:00
										 |  |  | 	setTimeOfsDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-21 23:38:36 +02:00
										 |  |  | 	setTrigPreDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  |     setTrigDelayDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-21 23:38:36 +02:00
										 |  |  | 	applySettings(); | 
					
						
							|  |  |  | 	applyTriggerSettings(); | 
					
						
							| 
									
										
										
										
											2015-07-07 01:17:16 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::on_scope_sampleRateChanged(int) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-21 23:38:36 +02:00
										 |  |  | 	m_sampleRate = m_glScope->getSampleRate(); | 
					
						
							| 
									
										
										
										
											2015-07-07 01:17:16 +02:00
										 |  |  | 	setTimeScaleDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-22 01:06:42 +02:00
										 |  |  | 	setTraceLenDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-12 10:17:23 +02:00
										 |  |  | 	setTimeOfsDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-21 23:38:36 +02:00
										 |  |  | 	setTrigPreDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  |     setTrigDelayDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-21 23:38:36 +02:00
										 |  |  | 	applySettings(); | 
					
						
							|  |  |  | 	applyTriggerSettings(); | 
					
						
							| 
									
										
										
										
											2015-07-07 01:17:16 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::setTimeScaleDisplay() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-06 09:17:51 +02:00
										 |  |  | 	m_sampleRate = m_glScope->getSampleRate(); | 
					
						
							| 
									
										
										
										
											2015-07-14 10:39:41 +02:00
										 |  |  | 	qreal t = (m_glScope->getTraceSize() * 1.0 / m_sampleRate) / (qreal)m_timeBase; | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	if(t < 0.000001) | 
					
						
							| 
									
										
										
										
											2015-07-14 10:39:41 +02:00
										 |  |  | 		ui->timeText->setText(tr("%1\nns").arg(t * 1000000000.0)); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	else if(t < 0.001) | 
					
						
							| 
									
										
										
										
											2015-07-14 10:39:41 +02:00
										 |  |  | 		ui->timeText->setText(tr("%1\nµs").arg(t * 1000000.0)); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	else if(t < 1.0) | 
					
						
							| 
									
										
										
										
											2015-07-14 10:39:41 +02:00
										 |  |  | 		ui->timeText->setText(tr("%1\nms").arg(t * 1000.0)); | 
					
						
							| 
									
										
										
										
											2015-07-25 18:53:27 +02:00
										 |  |  | 	else | 
					
						
							|  |  |  | 		ui->timeText->setText(tr("%1\ns").arg(t * 1.0)); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-22 01:06:42 +02:00
										 |  |  | void GLScopeGUI::setTraceLenDisplay() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	uint n_samples = m_traceLenMult * ScopeVis::m_traceChunkSize; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (n_samples < 1000) { | 
					
						
							|  |  |  | 		ui->traceLenText->setToolTip(tr("%1S").arg(n_samples)); | 
					
						
							|  |  |  | 	} else if (n_samples < 1000000) { | 
					
						
							|  |  |  | 		ui->traceLenText->setToolTip(tr("%1kS").arg(n_samples/1000.0)); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		ui->traceLenText->setToolTip(tr("%1MS").arg(n_samples/1000000.0)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	m_sampleRate = m_glScope->getSampleRate(); | 
					
						
							|  |  |  | 	qreal t = (m_glScope->getTraceSize() * 1.0 / m_sampleRate); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if(t < 0.000001) | 
					
						
							|  |  |  | 		ui->traceLenText->setText(tr("%1\nns").arg(t * 1000000000.0)); | 
					
						
							|  |  |  | 	else if(t < 0.001) | 
					
						
							|  |  |  | 		ui->traceLenText->setText(tr("%1\nµs").arg(t * 1000000.0)); | 
					
						
							|  |  |  | 	else if(t < 1.0) | 
					
						
							|  |  |  | 		ui->traceLenText->setText(tr("%1\nms").arg(t * 1000.0)); | 
					
						
							| 
									
										
										
										
											2015-07-25 18:53:27 +02:00
										 |  |  | 	else | 
					
						
							|  |  |  | 		ui->traceLenText->setText(tr("%1\ns").arg(t * 1.0)); | 
					
						
							| 
									
										
										
										
											2015-07-22 01:06:42 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  | void GLScopeGUI::setTrigDelayDisplay() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	uint n_samples_delay = m_traceLenMult * ScopeVis::m_traceChunkSize * m_triggerDelay; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (n_samples_delay < 1000) { | 
					
						
							|  |  |  | 		ui->trigDelayText->setToolTip(tr("%1S").arg(n_samples_delay)); | 
					
						
							|  |  |  | 	} else if (n_samples_delay < 1000000) { | 
					
						
							|  |  |  | 		ui->trigDelayText->setToolTip(tr("%1kS").arg(n_samples_delay/1000.0)); | 
					
						
							|  |  |  | 	} else if (n_samples_delay < 1000000000) { | 
					
						
							|  |  |  | 		ui->trigDelayText->setToolTip(tr("%1MS").arg(n_samples_delay/1000000.0)); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		ui->trigDelayText->setToolTip(tr("%1GS").arg(n_samples_delay/1000000000.0)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	m_sampleRate = m_glScope->getSampleRate(); | 
					
						
							|  |  |  | 	qreal t = (n_samples_delay * 1.0 / m_sampleRate); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if(t < 0.000001) | 
					
						
							|  |  |  | 		ui->trigDelayText->setText(tr("%1\nns").arg(t * 1000000000.0)); | 
					
						
							|  |  |  | 	else if(t < 0.001) | 
					
						
							|  |  |  | 		ui->trigDelayText->setText(tr("%1\nµs").arg(t * 1000000.0)); | 
					
						
							|  |  |  | 	else if(t < 1.0) | 
					
						
							|  |  |  | 		ui->trigDelayText->setText(tr("%1\nms").arg(t * 1000.0)); | 
					
						
							| 
									
										
										
										
											2015-07-25 18:53:27 +02:00
										 |  |  | 	else | 
					
						
							|  |  |  | 		ui->trigDelayText->setText(tr("%1\ns").arg(t * 1.0)); | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-12 10:17:23 +02:00
										 |  |  | void GLScopeGUI::setTimeOfsDisplay() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-12 23:21:37 +02:00
										 |  |  | 	qreal dt = m_glScope->getTraceSize() * (m_timeOffset/100.0) / m_sampleRate; | 
					
						
							| 
									
										
										
										
											2015-07-12 10:17:23 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	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)); | 
					
						
							| 
									
										
										
										
											2015-07-25 18:53:27 +02:00
										 |  |  | 	else | 
					
						
							|  |  |  | 		ui->timeOfsText->setText(tr("%1\ns").arg(dt * 1.0)); | 
					
						
							| 
									
										
										
										
											2015-07-12 10:17:23 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	//ui->timeOfsText->setText(tr("%1").arg(value/100.0, 0, 'f', 2));
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-21 22:18:17 +02:00
										 |  |  | void GLScopeGUI::setTrigPreDisplay() | 
					
						
							| 
									
										
										
										
											2015-07-21 01:33:58 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-21 22:18:17 +02:00
										 |  |  | 	qreal dt = m_glScope->getTraceSize() * (m_triggerPre/100.0) / m_sampleRate; | 
					
						
							| 
									
										
										
										
											2015-07-21 01:33:58 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if(dt < 0.000001) | 
					
						
							| 
									
										
										
										
											2015-07-21 22:18:17 +02:00
										 |  |  | 		ui->trigPreText->setText(tr("%1\nns").arg(dt * 1000000000.0)); | 
					
						
							| 
									
										
										
										
											2015-07-21 01:33:58 +02:00
										 |  |  | 	else if(dt < 0.001) | 
					
						
							| 
									
										
										
										
											2015-07-21 22:18:17 +02:00
										 |  |  | 		ui->trigPreText->setText(tr("%1\nµs").arg(dt * 1000000.0)); | 
					
						
							| 
									
										
										
										
											2015-07-21 01:33:58 +02:00
										 |  |  | 	else if(dt < 1.0) | 
					
						
							| 
									
										
										
										
											2015-07-21 22:18:17 +02:00
										 |  |  | 		ui->trigPreText->setText(tr("%1\nms").arg(dt * 1000.0)); | 
					
						
							| 
									
										
										
										
											2015-07-25 18:53:27 +02:00
										 |  |  | 	else | 
					
						
							|  |  |  | 		ui->trigPreText->setText(tr("%1\ns").arg(dt * 1.0)); | 
					
						
							| 
									
										
										
										
											2015-07-21 01:33:58 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | void GLScopeGUI::on_time_valueChanged(int value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_timeBase = value; | 
					
						
							| 
									
										
										
										
											2015-07-07 01:17:16 +02:00
										 |  |  | 	setTimeScaleDisplay(); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	m_glScope->setTimeBase(m_timeBase); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-22 01:06:42 +02:00
										 |  |  | void GLScopeGUI::on_traceLen_valueChanged(int value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if ((value < 1) || (value > 100)) { | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	m_traceLenMult = value; | 
					
						
							|  |  |  | 	setTraceLenDisplay(); | 
					
						
							|  |  |  | 	applyTriggerSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | void GLScopeGUI::on_timeOfs_valueChanged(int value) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-21 01:33:58 +02:00
										 |  |  | 	if ((value < 0) || (value > 100)) { | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	m_timeOffset = value; | 
					
						
							| 
									
										
										
										
											2015-07-12 10:17:23 +02:00
										 |  |  | 	setTimeOfsDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-07 02:50:26 +02:00
										 |  |  | 	m_glScope->setTimeOfsProMill(value*10); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-21 22:18:17 +02:00
										 |  |  | void GLScopeGUI::on_trigPre_valueChanged(int value) | 
					
						
							| 
									
										
										
										
											2015-07-21 01:33:58 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  | 	if ((value < 0) || (value > 100)) { | 
					
						
							| 
									
										
										
										
											2015-07-21 01:33:58 +02:00
										 |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-07-21 22:18:17 +02:00
										 |  |  | 	m_triggerPre = value; | 
					
						
							|  |  |  | 	setTrigPreDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-21 01:33:58 +02:00
										 |  |  | 	applyTriggerSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-23 04:58:27 +02:00
										 |  |  | void GLScopeGUI::on_trigDelay_valueChanged(int value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if ((value < 0) || (value > 100)) { | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	m_triggerDelay = value; | 
					
						
							|  |  |  | 	setTrigDelayDisplay(); | 
					
						
							|  |  |  | 	applyTriggerSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-22 09:01:25 +02:00
										 |  |  | void GLScopeGUI::on_dataMode_currentIndexChanged(int index) | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | { | 
					
						
							|  |  |  | 	m_displayData = index; | 
					
						
							| 
									
										
										
										
											2015-07-12 11:25:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	switch(index) { | 
					
						
							|  |  |  | 		case 0: // i+q
 | 
					
						
							|  |  |  | 			m_glScope->setMode(GLScope::ModeIQ); | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		case 1: // mag(lin)+pha
 | 
					
						
							|  |  |  | 			m_glScope->setMode(GLScope::ModeMagLinPha); | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		case 2: // mag(dB)+pha
 | 
					
						
							|  |  |  | 			m_glScope->setMode(GLScope::ModeMagdBPha); | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		case 3: // derived1+derived2
 | 
					
						
							|  |  |  | 			m_glScope->setMode(GLScope::ModeDerived12); | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		case 4: // clostationary
 | 
					
						
							|  |  |  | 			m_glScope->setMode(GLScope::ModeCyclostationary); | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		default: | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-07-12 11:25:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	setAmpScaleDisplay(); | 
					
						
							|  |  |  | 	setAmpOfsDisplay(); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::on_horizView_clicked() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_displayOrientation = Qt::Horizontal; | 
					
						
							| 
									
										
										
										
											2015-07-12 23:45:17 +02:00
										 |  |  | 	m_displays = GLScope::DisplayBoth; | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	if(ui->horizView->isChecked()) { | 
					
						
							|  |  |  | 		ui->vertView->setChecked(false); | 
					
						
							| 
									
										
										
										
											2015-07-12 22:22:04 +02:00
										 |  |  | 		ui->onlyPrimeView->setChecked(false); | 
					
						
							|  |  |  | 		ui->onlySecondView->setChecked(false); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 		m_glScope->setOrientation(Qt::Horizontal); | 
					
						
							| 
									
										
										
										
											2015-07-12 22:22:04 +02:00
										 |  |  | 		m_glScope->setDisplays(GLScope::DisplayBoth); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	} else { | 
					
						
							|  |  |  | 		ui->horizView->setChecked(true); | 
					
						
							| 
									
										
										
										
											2015-07-12 22:22:04 +02:00
										 |  |  | 		m_glScope->setOrientation(Qt::Horizontal); | 
					
						
							|  |  |  | 		m_glScope->setDisplays(GLScope::DisplayBoth); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::on_vertView_clicked() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_displayOrientation = Qt::Vertical; | 
					
						
							| 
									
										
										
										
											2015-07-12 23:45:17 +02:00
										 |  |  | 	m_displays = GLScope::DisplayBoth; | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	if(ui->vertView->isChecked()) { | 
					
						
							|  |  |  | 		ui->horizView->setChecked(false); | 
					
						
							| 
									
										
										
										
											2015-07-12 22:22:04 +02:00
										 |  |  | 		ui->onlyPrimeView->setChecked(false); | 
					
						
							|  |  |  | 		ui->onlySecondView->setChecked(false); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 		m_glScope->setOrientation(Qt::Vertical); | 
					
						
							| 
									
										
										
										
											2015-07-12 22:22:04 +02:00
										 |  |  | 		m_glScope->setDisplays(GLScope::DisplayBoth); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	} else { | 
					
						
							|  |  |  | 		ui->vertView->setChecked(true); | 
					
						
							|  |  |  | 		m_glScope->setOrientation(Qt::Vertical); | 
					
						
							| 
									
										
										
										
											2015-07-12 22:22:04 +02:00
										 |  |  | 		m_glScope->setDisplays(GLScope::DisplayBoth); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::on_onlyPrimeView_clicked() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-12 23:45:17 +02:00
										 |  |  | 	m_displays = GLScope::DisplayFirstOnly; | 
					
						
							| 
									
										
										
										
											2015-07-12 22:22:04 +02:00
										 |  |  | 	if(ui->onlyPrimeView->isChecked()) { | 
					
						
							|  |  |  | 		ui->horizView->setChecked(false); | 
					
						
							|  |  |  | 		ui->vertView->setChecked(false); | 
					
						
							|  |  |  | 		ui->onlySecondView->setChecked(false); | 
					
						
							|  |  |  | 		m_glScope->setDisplays(GLScope::DisplayFirstOnly); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		ui->onlyPrimeView->setChecked(true); | 
					
						
							|  |  |  | 		m_glScope->setDisplays(GLScope::DisplayFirstOnly); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::on_onlySecondView_clicked() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-12 23:45:17 +02:00
										 |  |  | 	m_displays = GLScope::DisplaySecondOnly; | 
					
						
							| 
									
										
										
										
											2015-07-12 22:22:04 +02:00
										 |  |  | 	if(ui->onlySecondView->isChecked()) { | 
					
						
							|  |  |  | 		ui->horizView->setChecked(false); | 
					
						
							|  |  |  | 		ui->vertView->setChecked(false); | 
					
						
							|  |  |  | 		ui->onlyPrimeView->setChecked(false); | 
					
						
							|  |  |  | 		m_glScope->setDisplays(GLScope::DisplaySecondOnly); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		ui->onlySecondView->setChecked(true); | 
					
						
							|  |  |  | 		m_glScope->setDisplays(GLScope::DisplaySecondOnly); | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-23 22:52:27 +02:00
										 |  |  | void GLScopeGUI::on_gridIntensity_valueChanged(int index) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_displayGridIntensity = index; | 
					
						
							| 
									
										
										
										
											2015-07-18 11:27:09 +02:00
										 |  |  | 	ui->gridIntensity->setToolTip(QString("Grid intensity: %1").arg(m_displayGridIntensity)); | 
					
						
							| 
									
										
										
										
											2015-06-23 22:52:27 +02:00
										 |  |  | 	if(m_glScope != NULL) | 
					
						
							|  |  |  | 		m_glScope->setDisplayGridIntensity(m_displayGridIntensity); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-18 11:27:09 +02:00
										 |  |  | void GLScopeGUI::on_traceIntensity_valueChanged(int index) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_displayTraceIntensity = index; | 
					
						
							|  |  |  | 	ui->traceIntensity->setToolTip(QString("Trace intensity: %1").arg(m_displayTraceIntensity)); | 
					
						
							|  |  |  | 	if(m_glScope != NULL) | 
					
						
							|  |  |  | 		m_glScope->setDisplayTraceIntensity(m_displayTraceIntensity); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | void GLScopeGUI::on_trigMode_currentIndexChanged(int index) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_triggerChannel = index; | 
					
						
							| 
									
										
										
										
											2015-07-14 00:53:08 +02:00
										 |  |  | 	setTrigLevelDisplay(); | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | 	applyTriggerSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | void GLScopeGUI::on_trigLevelCoarse_valueChanged(int value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_triggerLevelCoarse = value; | 
					
						
							|  |  |  | 	setTrigLevelDisplay(); | 
					
						
							|  |  |  | 	applyTriggerSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::on_trigLevelFine_valueChanged(int value) | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-26 18:58:59 +02:00
										 |  |  | 	m_triggerLevelFine = value; | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | 	setTrigLevelDisplay(); | 
					
						
							|  |  |  | 	applyTriggerSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::on_slopePos_clicked() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_triggerPositiveEdge = true; | 
					
						
							| 
									
										
										
										
											2015-07-23 06:52:12 +02:00
										 |  |  | 	m_triggerBothEdges = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ui->slopeBoth->setChecked(false); | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if(ui->slopePos->isChecked()) { | 
					
						
							|  |  |  | 		ui->slopeNeg->setChecked(false); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		ui->slopePos->setChecked(true); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	applyTriggerSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void GLScopeGUI::on_slopeNeg_clicked() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_triggerPositiveEdge = false; | 
					
						
							| 
									
										
										
										
											2015-07-23 06:52:12 +02:00
										 |  |  | 	m_triggerBothEdges = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ui->slopeBoth->setChecked(false); | 
					
						
							| 
									
										
										
										
											2015-07-13 12:58:32 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if(ui->slopeNeg->isChecked()) { | 
					
						
							|  |  |  | 		ui->slopePos->setChecked(false); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		ui->slopeNeg->setChecked(true); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	applyTriggerSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-23 06:52:12 +02:00
										 |  |  | void GLScopeGUI::on_slopeBoth_clicked() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-08-09 10:33:04 +02:00
										 |  |  | 	qDebug() << "GLScopeGUI::on_slopeBoth_clicked"; | 
					
						
							| 
									
										
										
										
											2015-07-23 06:52:12 +02:00
										 |  |  | 	ui->slopePos->setChecked(false); | 
					
						
							|  |  |  | 	ui->slopeNeg->setChecked(false); | 
					
						
							|  |  |  | 	ui->slopeBoth->setChecked(true); | 
					
						
							|  |  |  | 	m_triggerBothEdges = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	applyTriggerSettings(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-14 02:18:55 +02:00
										 |  |  | void GLScopeGUI::on_oneShot_clicked() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	m_scopeVis->setOneShot(ui->oneShot->isChecked()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | bool GLScopeGUI::handleMessage(Message* cmd) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-07-06 09:17:51 +02:00
										 |  |  | 	return false; | 
					
						
							|  |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 	if(DSPSignalNotification::match(cmd)) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		DSPSignalNotification* signal = (DSPSignalNotification*)cmd; | 
					
						
							| 
									
										
										
										
											2015-07-06 09:17:51 +02:00
										 |  |  | 		//fprintf(stderr, "GLScopeGUI::handleMessage: %d samples/sec, %lld Hz offset", signal->getSampleRate(), signal->getFrequencyOffset());
 | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | 		m_sampleRate = signal->getSampleRate(); | 
					
						
							|  |  |  | 		cmd->completed(); | 
					
						
							|  |  |  | 		return true; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-07-06 09:17:51 +02:00
										 |  |  | 	*/ | 
					
						
							| 
									
										
										
										
											2015-06-22 04:16:27 +02:00
										 |  |  | } |