summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clients/tde/src/part/scope/layout.ui224
-rw-r--r--clients/tde/src/part/scope/part.cpp199
-rw-r--r--clients/tde/src/part/scope/part.h45
-rw-r--r--clients/tde/src/widgets/tracewidget.cpp32
-rw-r--r--clients/tde/src/widgets/tracewidget.h11
-rw-r--r--servers/gpib_server_lin/src/gpib_functions.cpp5
-rw-r--r--servers/gpib_server_lin/src/scope_functions.cpp150
7 files changed, 507 insertions, 159 deletions
diff --git a/clients/tde/src/part/scope/layout.ui b/clients/tde/src/part/scope/layout.ui
index 5447780..43a0be8 100644
--- a/clients/tde/src/part/scope/layout.ui
+++ b/clients/tde/src/part/scope/layout.ui
@@ -78,121 +78,136 @@
</widget>
</grid>
</widget>
- <widget class="TQGroupBox" row="0" column="1">
+ <widget class="TQScrollView" row="0" column="1" rowspan="10">
<property name="name">
- <cstring>groupOscilloscopeCaptureControls</cstring>
+ <cstring>oscilloscopeControlCanvas</cstring>
</property>
- <property name="title">
- <string>Capture Controls</string>
- </property>
- <grid>
- <widget class="TQPushButton" row="0" column="0" colspan="1">
- <property name="name">
- <cstring>runControlStartButton</cstring>
- </property>
- <property name="text">
- <string>Run</string>
- </property>
- </widget>
- <widget class="TQPushButton" row="0" column="1" colspan="1">
- <property name="name">
- <cstring>runControlStopButton</cstring>
- </property>
- <property name="text">
- <string>Stop</string>
- </property>
- </widget>
- <widget class="TQWidget" row="1" column="0" colspan="2">
- <property name="name">
- <cstring>timebaseControlLayoutWidget</cstring>
- </property>
- </widget>
- <widget class="TQWidget" row="2" column="0" colspan="2">
- <property name="name">
- <cstring>traceControlLayoutWidget</cstring>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="TQGroupBox" row="1" column="1">
- <property name="name">
- <cstring>groupOscilloscopeAnalysisControls</cstring>
- </property>
- <property name="title">
- <string>Analysis Controls</string>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
</property>
- <grid>
- <widget class="TQWidget" row="0" column="0" colspan="1">
- <property name="name">
- <cstring>mathTraceControlLayoutWidget</cstring>
- </property>
- </widget>
- </grid>
</widget>
- <widget class="TQGroupBox" row="2" column="1">
+ <widget class="TQWidget">
<property name="name">
- <cstring>groupOscilloscopeAcquisitionControls</cstring>
- </property>
- <property name="title">
- <string>Acquisition Controls</string>
+ <cstring>oscilloscopeControlCanvasWidget</cstring>
</property>
<grid>
- <widget class="TQPushButton" row="0" column="0" colspan="1">
- <property name="name">
- <cstring>acqStart</cstring>
- </property>
- <property name="text">
- <string>Start Acquisition</string>
- </property>
- </widget>
- <widget class="TQPushButton" row="0" column="1" colspan="1">
+ <widget class="TQGroupBox" row="0" column="0">
<property name="name">
- <cstring>acqStop</cstring>
+ <cstring>groupOscilloscopeCaptureControls</cstring>
</property>
- <property name="text">
- <string>Stop Acquisition</string>
+ <property name="title">
+ <string>Capture Controls</string>
</property>
+ <grid>
+ <widget class="TQPushButton" row="0" column="0" colspan="1">
+ <property name="name">
+ <cstring>runControlStartButton</cstring>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="0" column="1" colspan="1">
+ <property name="name">
+ <cstring>runControlStopButton</cstring>
+ </property>
+ <property name="text">
+ <string>Stop</string>
+ </property>
+ </widget>
+ <widget class="TQWidget" row="1" column="0" colspan="2">
+ <property name="name">
+ <cstring>timebaseControlLayoutWidget</cstring>
+ </property>
+ </widget>
+ <widget class="TQWidget" row="2" column="0" colspan="2">
+ <property name="name">
+ <cstring>traceControlLayoutWidget</cstring>
+ </property>
+ </widget>
+ </grid>
</widget>
- <widget class="TQPushButton" row="1" column="0" colspan="1">
+ <widget class="TQGroupBox" row="1" column="0">
<property name="name">
- <cstring>waveformSave</cstring>
+ <cstring>groupOscilloscopeAnalysisControls</cstring>
</property>
- <property name="text">
- <string>Save Waveforms</string>
+ <property name="title">
+ <string>Analysis Controls</string>
</property>
+ <grid>
+ <widget class="TQWidget" row="0" column="0" colspan="1">
+ <property name="name">
+ <cstring>postProcessTraceControlLayoutWidget</cstring>
+ </property>
+ </widget>
+ <widget class="TQWidget" row="1" column="0" colspan="1">
+ <property name="name">
+ <cstring>mathTraceControlLayoutWidget</cstring>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="2" column="0" colspan="1">
+ <property name="name">
+ <cstring>dumpSamples</cstring>
+ </property>
+ <property name="text">
+ <string>Export Selected Data</string>
+ </property>
+ </widget>
+ </grid>
</widget>
- <widget class="TQPushButton" row="1" column="1" colspan="1">
+ <widget class="TQGroupBox" row="2" column="0">
<property name="name">
- <cstring>waveformRecall</cstring>
+ <cstring>groupOscilloscopeAcquisitionControls</cstring>
</property>
- <property name="text">
- <string>Recall Waveforms</string>
+ <property name="title">
+ <string>Acquisition Controls</string>
</property>
+ <grid>
+ <widget class="TQPushButton" row="0" column="0" colspan="1">
+ <property name="name">
+ <cstring>acqStart</cstring>
+ </property>
+ <property name="text">
+ <string>Start Acquisition</string>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="0" column="1" colspan="1">
+ <property name="name">
+ <cstring>acqStop</cstring>
+ </property>
+ <property name="text">
+ <string>Stop Acquisition</string>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="1" column="0" colspan="1">
+ <property name="name">
+ <cstring>waveformSave</cstring>
+ </property>
+ <property name="text">
+ <string>Save Waveforms</string>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="1" column="1" colspan="1">
+ <property name="name">
+ <cstring>waveformRecall</cstring>
+ </property>
+ <property name="text">
+ <string>Recall Waveforms</string>
+ </property>
+ </widget>
+ </grid>
</widget>
- </grid>
- </widget>
- <widget class="TQGroupBox" row="3" column="1">
- <property name="name">
- <cstring>groupOscilloscopeTestNotes</cstring>
- </property>
- <property name="title">
- <string>Notes</string>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>3</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>1</verstretch>
- </sizepolicy>
- </property>
- <grid>
- <widget class="KTextEdit" row="0" column="0" colspan="1">
+ <widget class="TQGroupBox" row="3" column="0">
<property name="name">
- <cstring>userNotes</cstring>
+ <cstring>groupOscilloscopeTestNotes</cstring>
</property>
- <property name="text">
- <string></string>
+ <property name="title">
+ <string>Notes</string>
</property>
<property name="sizePolicy">
<sizepolicy>
@@ -202,7 +217,28 @@
<verstretch>1</verstretch>
</sizepolicy>
</property>
+ <grid>
+ <widget class="KTextEdit" row="0" column="0" colspan="1">
+ <property name="name">
+ <cstring>userNotes</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </grid>
</widget>
+ <property name="margin">
+ <number>0</number>
+ </property>
</grid>
</widget>
</grid>
diff --git a/clients/tde/src/part/scope/part.cpp b/clients/tde/src/part/scope/part.cpp
index 44dbb84..efa05a0 100644
--- a/clients/tde/src/part/scope/part.cpp
+++ b/clients/tde/src/part/scope/part.cpp
@@ -15,9 +15,9 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (c) 2012-2019 Timothy Pearson
- * Raptor Engineering
- * http://www.raptorengineeringinc.com
+ * (c) 2012 - 2019 Timothy Pearson
+ * Raptor Engineering, LLC
+ * http://www.raptorengineering.com
*/
#include "define.h"
@@ -191,6 +191,63 @@ void TraceControlWidget::triggerRequested() {
emit(triggerChannelChangeRequested());
}
+TracePostProcessControlWidget::TracePostProcessControlWidget(TQWidget *parent, const char *name)
+ : TQWidget(parent, name)
+{
+ TQGridLayout *topGrid = new TQGridLayout(this);
+ m_groupBox = new TQGroupBox(this);
+ m_groupBox->setColumnLayout(0, TQt::Vertical);
+ topGrid->addMultiCellWidget(m_groupBox, 0, 0, 0, 0);
+ m_groupBox->setTitle(i18n("Unknown Channel"));
+ m_primaryLayout = new TQGridLayout(m_groupBox->layout(), 1, 1, KDialog::spacingHint());
+
+ m_postProcessEnabledCheckBox = new TQCheckBox(m_groupBox);
+ connect(m_postProcessEnabledCheckBox, SIGNAL(clicked()), this, SLOT(enableClicked()));
+ m_postProcessEnabledCheckBox->setText(i18n("Enable"));
+ m_primaryLayout->addMultiCellWidget(m_postProcessEnabledCheckBox, 0, 0, 0, 0);
+
+ m_voltsMultiplierSpinBox = new FloatSpinBox(m_groupBox);
+ m_voltsMultiplierSpinBox->setFloatMax(1000);
+ m_voltsMultiplierSpinBox->setFloatMin(-1000);
+ m_voltsMultiplierSpinBox->setFloatValue(1.0);
+ connect(m_voltsMultiplierSpinBox, SIGNAL(floatValueChanged(double)), this, SLOT(vMultChanged(double)));
+ m_voltsMultiplierSpinBox->setEnabled(false);
+ m_primaryLayout->addMultiCellWidget(m_voltsMultiplierSpinBox, 0, 0, 1, 1);
+
+ TQLabel* label = new TQLabel(m_groupBox);
+ label->setText(i18n("V/div multiplier"));
+ m_primaryLayout->addMultiCellWidget(label, 0, 0, 2, 2);
+}
+
+TracePostProcessControlWidget::~TracePostProcessControlWidget() {
+ //
+}
+
+void TracePostProcessControlWidget::setSelectedVoltsMultiplier(double vmult) {
+ m_voltsMultiplierSpinBox->setFloatValue(vmult);
+}
+
+void TracePostProcessControlWidget::setPostProcessEnabled(bool enabled) {
+ m_postProcessEnabledCheckBox->setChecked(enabled);
+ m_voltsMultiplierSpinBox->setEnabled(enabled);
+}
+
+void TracePostProcessControlWidget::setTraceName(TQString name) {
+ m_groupBox->setTitle(name);
+}
+
+void TracePostProcessControlWidget::enableClicked() {
+ bool enabled = m_postProcessEnabledCheckBox->isOn();
+ m_voltsMultiplierSpinBox->setEnabled(enabled);
+ emit(enableChanged(enabled));
+}
+
+void TracePostProcessControlWidget::vMultChanged(double vmult) {
+ Q_UNUSED(vmult)
+ double value = m_voltsMultiplierSpinBox->floatValue();
+ emit(voltsMultiplierChanged(value));
+}
+
MathTraceControlWidget::MathTraceControlWidget(TQWidget *parent, const char *name)
: TQWidget(parent, name)
{
@@ -472,6 +529,9 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
connect(m_forcedUpdateTimer, SIGNAL(timeout()), this, SLOT(mainEventLoop()));
m_updateTimeoutTimer = new TQTimer(this);
connect(m_updateTimeoutTimer, SIGNAL(timeout()), this, SLOT(mainEventLoop()));
+ m_controlWidgetViewFixupTimer = new TQTimer(this);
+ connect(m_controlWidgetViewFixupTimer, SIGNAL(timeout()), this, SLOT(controlWidgetViewSetWidth()));
+ m_controlWidgetViewFixupTimer->start(100, FALSE);
// Initialize data
m_hdivs = 0;
@@ -494,7 +554,10 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
m_traceAllowedVoltsDiv[traceno].clear();
m_voltsDiv[traceno] = 0;
m_secsDiv[traceno] = 0;
+ m_channelPostProcessActive[traceno] = false;
+ m_channelPostProcessVoltsMult[traceno] = 1;
m_traceControlWidgetList[traceno] = NULL;
+ m_tracePostProcessControlWidgetList[traceno] = NULL;
m_voltsDivSet[traceno] = false;
m_channelActiveSet[traceno] = false;
@@ -519,7 +582,12 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
// Create widgets
m_base = new ScopeBase(widget());
+ m_base->oscilloscopeControlCanvas->addChild(m_base->oscilloscopeControlCanvasWidget);
+ m_base->oscilloscopeControlCanvas->setHScrollBarMode(TQScrollView::AlwaysOff);
+ m_base->oscilloscopeControlCanvas->setFrameShape(TQFrame::NoFrame);
+ m_base->oscilloscopeControlCanvas->setMargin(0);
m_traceControlWidgetGrid = new TQGridLayout(m_base->traceControlLayoutWidget);
+ m_postProcessTraceControlWidgetGrid = new TQGridLayout(m_base->postProcessTraceControlLayoutWidget);
m_mathTraceControlWidgetGrid = new TQGridLayout(m_base->mathTraceControlLayoutWidget);
m_timebaseControlWidgetGrid = new TQGridLayout(m_base->timebaseControlLayoutWidget);
m_timebaseControlWidget = new TimebaseControlWidget(m_base->timebaseControlLayoutWidget);
@@ -570,6 +638,7 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
connect(m_traceWidget, SIGNAL(zoomBoxChanged(const TQRectF&)), this, SLOT(updateZoomWidgetLimits(const TQRectF&)));
connect(m_traceWidget, SIGNAL(offsetChanged(uint, double)), m_base->traceZoomWidget, SLOT(setTraceOffset(uint, double)));
+ connect(m_base->dumpSamples, SIGNAL(clicked()), this, SLOT(dumpSamples()));
connect(m_base->acqStart, SIGNAL(clicked()), this, SLOT(startDAQ()));
connect(m_base->acqStop, SIGNAL(clicked()), this, SLOT(stopDAQ()));
connect(m_base->runControlStartButton, SIGNAL(clicked()), this, SLOT(startScope()));
@@ -582,6 +651,8 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
}
ScopePart::~ScopePart() {
+ m_controlWidgetViewFixupTimer->stop();
+
if (m_instrumentMutex->locked()) {
printf("[WARNING] Exiting when data transfer still in progress!\n\r"); fflush(stdout);
}
@@ -2063,6 +2134,30 @@ void ScopePart::startDAQ() {
EXEC_NEXT_STATE_IMMEDIATELY
}
+void ScopePart::dumpSamples() {
+ // Calculate left and right extent of zoom area
+ TQRectF currentZoomBox = m_traceWidget->zoomBox();
+
+ TQString csvData = "";
+ for (int traceno=1; traceno<=m_maxNumberOfTraces; traceno++) {
+ if (m_channelActive[traceno]) {
+ TQString saveFileName = TQString("/tmp/trace%1.csv").arg(traceno);
+ TQFile file(saveFileName);
+ file.open(IO_WriteOnly);
+ csvData = "";
+ int start_sample = ((m_samplesInTrace[traceno] * currentZoomBox.x()) / 100.0);
+ int end_sample = ((m_samplesInTrace[traceno] * currentZoomBox.width()) / 100.0) + start_sample;
+ TQDoubleArray positions = m_traceWidget->positions(traceno-1);
+ TQDoubleArray values = m_traceWidget->samples(traceno-1);
+ for (int sample=start_sample; sample<end_sample; sample++) {
+ csvData += TQString("%1,%2\n").arg(positions[sample]).arg(values[sample]);
+ }
+ csvData += "\n";
+ file.writeBlock(csvData.ascii(), strlen(csvData.ascii()));
+ }
+ }
+}
+
void ScopePart::stopDAQ() {
if (m_commHandlerMode < 2) {
m_stopTraceUpdate = true;
@@ -2134,15 +2229,19 @@ void ScopePart::recallWaveforms() {
TQDataStream ds(&file);
TQ_INT32 magicNumber;
TQ_INT32 version;
+ TQ_INT16 savedMaxNumberOfMathTraces;
ds >> magicNumber;
if (magicNumber == WAVEFORM_MAGIC_NUMBER) {
ds >> version;
if ((version >= 1) && (version <= WAVEFORM_FILE_VERSION)) {
ds >> m_hdivs;
ds >> m_vdivs;
- ds >> m_maxNumberOfTraces;
+ ds >> savedMaxNumberOfMathTraces;
if (version >= 3) {
- ds >> m_maxNumberOfMathTraces;
+ ds >> savedMaxNumberOfMathTraces;
+ if (savedMaxNumberOfMathTraces > m_maxNumberOfMathTraces) {
+ m_maxNumberOfMathTraces = savedMaxNumberOfMathTraces;
+ }
}
for (int traceno=1; traceno<=m_maxNumberOfTraces; traceno++) {
TQ_UINT8 boolValue;
@@ -2169,7 +2268,7 @@ void ScopePart::recallWaveforms() {
m_base->traceZoomWidget->setTraceOffset(traceno-1, offset);
}
if (version >= 3) {
- for (int traceno=1; traceno<=m_maxNumberOfMathTraces; traceno++) {
+ for (int traceno=1; traceno<=savedMaxNumberOfMathTraces; traceno++) {
TQ_UINT8 boolValue;
ds >> boolValue;
m_mathChannelActive[traceno] = (boolValue!=0)?true:false;
@@ -2184,6 +2283,13 @@ void ScopePart::recallWaveforms() {
m_base->traceZoomWidget->setTraceOffset(traceno-1+m_maxNumberOfTraces, offset);
}
}
+ for (int traceno=savedMaxNumberOfMathTraces+1; traceno<=m_maxNumberOfMathTraces; traceno++) {
+ m_mathChannelActive[traceno] = false;
+ m_mathVoltsDiv[traceno] = m_mathTraceAllowedVoltsDiv[traceno][0];
+ m_mathFirstOperand[traceno] = 1;
+ m_mathSecondOperand[traceno] = 1;
+ m_mathOperator[traceno] = "+";
+ }
}
for (int cursorno=0; cursorno<5; cursorno++) {
double cursorPos;
@@ -2359,12 +2465,24 @@ void ScopePart::updateTraceControlWidgets() {
m_traceControlWidgetList[i]->setTraceName(i18n("Channel %1").arg(i+1));
m_traceControlWidgetList[i]->show();
}
+ if (!m_tracePostProcessControlWidgetList[i]) {
+ m_tracePostProcessControlWidgetList[i] = new TracePostProcessControlWidget(m_base->postProcessTraceControlLayoutWidget);
+ connect(m_tracePostProcessControlWidgetList[i], SIGNAL(enableChanged(bool)), this, SLOT(tracePostProcessControlEnableChanged(bool)));
+ connect(m_tracePostProcessControlWidgetList[i], SIGNAL(voltsMultiplierChanged(double)), this, SLOT(tracePostProcessControlVMultChanged(double)));
+ m_postProcessTraceControlWidgetGrid->addMultiCellWidget(m_tracePostProcessControlWidgetList[i], i, i, 0, 0);
+ m_tracePostProcessControlWidgetList[i]->setTraceName(i18n("Channel %1").arg(i+1));
+ m_tracePostProcessControlWidgetList[i]->show();
+ }
}
for (i=m_maxNumberOfTraces; i<MAXTRACES;i++) {
if (m_traceControlWidgetList[i]) {
m_traceControlWidgetGrid->remove(m_traceControlWidgetList[i]);
delete m_traceControlWidgetList[i];
}
+ if (m_tracePostProcessControlWidgetList[i]) {
+ m_postProcessTraceControlWidgetGrid->remove(m_tracePostProcessControlWidgetList[i]);
+ delete m_tracePostProcessControlWidgetList[i];
+ }
}
for (i=0; i<m_maxNumberOfMathTraces;i++) {
if (!m_mathTraceControlWidgetList[i]) {
@@ -2387,6 +2505,15 @@ void ScopePart::updateTraceControlWidgets() {
}
}
+void ScopePart::controlWidgetViewSetWidth() {
+ if (m_base->oscilloscopeControlCanvas->contentsHeight() > m_base->oscilloscopeControlCanvas->height()) {
+ m_base->oscilloscopeControlCanvas->setFixedWidth(m_base->oscilloscopeControlCanvas->contentsWidth() + m_base->oscilloscopeControlCanvas->verticalScrollBar()->sliderRect().width());
+ }
+ else {
+ m_base->oscilloscopeControlCanvas->setFixedWidth(m_base->oscilloscopeControlCanvas->contentsWidth());
+ }
+}
+
void ScopePart::traceControlEnableChanged(bool enabled) {
int i;
int channel = -1;
@@ -2438,6 +2565,66 @@ void ScopePart::traceControlSDivChanged(double sdiv) {
m_horizontalTimebaseSet = true;
}
+void ScopePart::tracePostProcessControlEnableChanged(bool enabled) {
+ int i;
+ int channel = -1;
+ const TracePostProcessControlWidget* widget = dynamic_cast<const TracePostProcessControlWidget*>(sender());
+ if (widget) {
+ for (i=0; i<MAXTRACES;i++) {
+ if (m_tracePostProcessControlWidgetList[i] == widget) {
+ channel = i;
+ break;
+ }
+ }
+ if ((channel >= 0) && (channel <=MAXTRACES)) {
+ m_channelPostProcessActive[channel+1] = enabled;
+ if (m_channelPostProcessActive[channel+1]) {
+ m_traceWidget->setTraceVerticalMultiplier(channel, m_channelPostProcessVoltsMult[channel+1]);
+ m_base->traceZoomWidget->setTraceVerticalMultiplier(channel, m_channelPostProcessVoltsMult[channel+1]);
+ }
+ else {
+ m_traceWidget->setTraceVerticalMultiplier(channel, 1.0);
+ m_base->traceZoomWidget->setTraceVerticalMultiplier(channel, 1.0);
+ }
+ }
+ }
+
+ updateGraticule();
+ m_traceWidget->repaint(false);
+ m_base->traceZoomWidget->repaint(false);
+ updateTraceControlWidgets();
+}
+
+void ScopePart::tracePostProcessControlVMultChanged(double vmult) {
+ int i;
+ int channel = -1;
+ const TracePostProcessControlWidget* widget = dynamic_cast<const TracePostProcessControlWidget*>(sender());
+ if (widget) {
+ for (i=0; i<MAXTRACES;i++) {
+ if (m_tracePostProcessControlWidgetList[i] == widget) {
+ channel = i;
+ break;
+ }
+ }
+ if ((channel >= 0) && (channel <=MAXTRACES)) {
+ m_channelPostProcessVoltsMult[channel+1] = vmult;
+ if (m_channelPostProcessActive[channel+1]) {
+ m_traceWidget->setTraceVerticalMultiplier(channel, m_channelPostProcessVoltsMult[channel+1]);
+ m_base->traceZoomWidget->setTraceVerticalMultiplier(channel, m_channelPostProcessVoltsMult[channel+1]);
+ }
+ else {
+ m_traceWidget->setTraceVerticalMultiplier(channel, 1.0);
+ m_base->traceZoomWidget->setTraceVerticalMultiplier(channel, 1.0);
+ }
+ }
+ }
+
+ updateGraticule();
+ m_traceWidget->repaint(false);
+ m_base->traceZoomWidget->repaint(false);
+ updateTraceControlWidgets();
+}
+
void ScopePart::mathTraceControlEnableChanged(bool enabled) {
int i;
int channel = -1;
diff --git a/clients/tde/src/part/scope/part.h b/clients/tde/src/part/scope/part.h
index c802ebf..dbe4066 100644
--- a/clients/tde/src/part/scope/part.h
+++ b/clients/tde/src/part/scope/part.h
@@ -15,9 +15,9 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (c) 2012-2019 Timothy Pearson
- * Raptor Engineering
- * http://www.raptorengineeringinc.com
+ * (c) 2012 - 2019 Timothy Pearson
+ * Raptor Engineering, LLC
+ * http://www.raptorengineering.com
*/
#ifndef REMOTELAB_SCOPEPART_H
@@ -30,6 +30,8 @@
#include <tqtrla.h>
+#include "floatspinbox.h"
+
#define MAXTRACES 255
#define MAXMATHTRACES 255
@@ -87,6 +89,34 @@ namespace RemoteLab
TQDoubleList m_voltsDivList;
};
+ class TracePostProcessControlWidget : public TQWidget
+ {
+ Q_OBJECT
+
+ public:
+ TracePostProcessControlWidget(TQWidget *parent=0, const char *name=0);
+ ~TracePostProcessControlWidget();
+
+ public:
+ void setSelectedVoltsMultiplier(double vmult);
+ void setPostProcessEnabled(bool enabled);
+ void setTraceName(TQString name);
+
+ signals:
+ void enableChanged(bool enabled);
+ void voltsMultiplierChanged(double vmult);
+
+ private slots:
+ void enableClicked();
+ void vMultChanged(double vmult);
+
+ private:
+ TQGroupBox* m_groupBox;
+ TQGridLayout* m_primaryLayout;
+ FloatSpinBox* m_voltsMultiplierSpinBox;
+ TQCheckBox* m_postProcessEnabledCheckBox;
+ };
+
class MathTraceControlWidget : public TQWidget
{
Q_OBJECT
@@ -187,17 +217,21 @@ namespace RemoteLab
void postInit();
void processLockouts();
void updateGraticule();
+ void controlWidgetViewSetWidth();
void connectionFinishedCallback();
void disconnectFromServerCallback();
void connectionStatusChangedCallback();
void setTickerMessage(TQString message);
void mainEventLoop();
+ void dumpSamples();
void startDAQ();
void stopDAQ();
void updateTraceControlWidgets();
void traceControlEnableChanged(bool enabled);
void traceControlVDivChanged(double vdiv);
void traceControlSDivChanged(double sdiv);
+ void tracePostProcessControlEnableChanged(bool enabled);
+ void tracePostProcessControlVMultChanged(double vmult);
void mathTraceControlEnableChanged(bool enabled);
void mathTraceControlVDivChanged(double vdiv);
void mathTraceControlFirstOperandChanged(int operand);
@@ -219,12 +253,14 @@ namespace RemoteLab
TraceWidget* m_traceWidget;
TQGridLayout* m_traceControlWidgetGrid;
TQGridLayout* m_mathTraceControlWidgetGrid;
+ TQGridLayout* m_postProcessTraceControlWidgetGrid;
TQGridLayout* m_timebaseControlWidgetGrid;
int m_commHandlerState;
int m_commHandlerMode;
int m_commHandlerCommandState;
TQTimer* m_forcedUpdateTimer;
TQTimer* m_updateTimeoutTimer;
+ TQTimer* m_controlWidgetViewFixupTimer;
bool m_connectionActiveAndValid;
unsigned char m_tickerState;
TQ_INT16 m_maxNumberOfTraces;
@@ -254,6 +290,7 @@ namespace RemoteLab
TQString m_mathHorizontalUnits[MAXMATHTRACES+1];
TQString m_mathVerticalUnits[MAXMATHTRACES+1];
TraceControlWidget* m_traceControlWidgetList[MAXTRACES+1];
+ TracePostProcessControlWidget* m_tracePostProcessControlWidgetList[MAXTRACES+1];
MathTraceControlWidget* m_mathTraceControlWidgetList[MAXMATHTRACES+1];
TimebaseControlWidget* m_timebaseControlWidget;
bool m_triggerLevelSet;
@@ -262,6 +299,8 @@ namespace RemoteLab
bool m_runningSet;
bool m_voltsDivSet[MAXTRACES+1];
bool m_channelActiveSet[MAXTRACES+1];
+ bool m_channelPostProcessActive[MAXTRACES+1];
+ double m_channelPostProcessVoltsMult[MAXTRACES+1];
bool m_settingsChanged;
MathOperatorList m_availableMathOperators;
ScopeBase* m_base;
diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp
index f875571..f4a7c7d 100644
--- a/clients/tde/src/widgets/tracewidget.cpp
+++ b/clients/tde/src/widgets/tracewidget.cpp
@@ -15,9 +15,9 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (c) 2012-2019 Timothy Pearson
- * Raptor Engineering
- * http://www.raptorengineeringinc.com
+ * (c) 2012 - 2019 Timothy Pearson
+ * Raptor Engineering, LLC
+ * http://www.raptorengineering.com
*/
#include "tracewidget.h"
@@ -548,6 +548,7 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p
rightEdgeIndex = -1;
offset = 0.0;
textOffset = 0.0;
+ verticalMultiplier = 1.0;
leftEdge = 0;
rightEdge = 0;
topEdge = 0;
@@ -705,9 +706,9 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh
}
x = (((positionArray[n]-leftEdge)/(rightEdge-leftEdge))*(virtual_width))-horizoffset;
- y = ((((sampleArray[n]+offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
+ y = (((((sampleArray[n]*verticalMultiplier)+offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
x2 = (((positionArray[n+incr]-leftEdge)/(rightEdge-leftEdge))*(virtual_width))-horizoffset;
- y2 = ((((sampleArray[n+incr]+offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
+ y2 = (((((sampleArray[n+incr]*verticalMultiplier)+offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
baseline = ((((offset)-topEdge)/(bottomEdge-topEdge))*(virtual_height));
// Do not draw lines that are placed fully off the screen
@@ -2493,6 +2494,27 @@ void TraceWidget::setTraceTextOffset(uint traceNumber, double offset, bool defer
}
}
+double TraceWidget::traceVerticalMultiplier(uint traceNumber) {
+ VERIFY_TRACE_ARRAY_SIZE
+
+ return m_traceArray[traceNumber]->verticalMultiplier;
+}
+
+void TraceWidget::setTraceVerticalMultiplier(uint traceNumber, double verticalMultiplier) {
+ setTraceVerticalMultiplier(traceNumber, verticalMultiplier, false);
+}
+
+void TraceWidget::setTraceVerticalMultiplier(uint traceNumber, double verticalMultiplier, bool deferUpdate) {
+ VERIFY_TRACE_ARRAY_SIZE
+
+ m_traceArray[traceNumber]->verticalMultiplier = verticalMultiplier;
+
+ if (!deferUpdate) {
+ m_graticuleWidget->repaint(false);
+ updateTraceText();
+ }
+}
+
void TraceWidget::processChangedOffset(double offset) {
// Find the sending trace number
const TraceData* sendingTrace = dynamic_cast<const TraceData*>(sender());
diff --git a/clients/tde/src/widgets/tracewidget.h b/clients/tde/src/widgets/tracewidget.h
index 7f63307..aed6189 100644
--- a/clients/tde/src/widgets/tracewidget.h
+++ b/clients/tde/src/widgets/tracewidget.h
@@ -15,9 +15,9 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (c) 2012-2019 Timothy Pearson
- * Raptor Engineering
- * http://www.raptorengineeringinc.com
+ * (c) 2012 - 2019 Timothy Pearson
+ * Raptor Engineering, LLC
+ * http://www.raptorengineering.com
*/
#ifndef REMOTELAB_TRACEWIDGET_H
@@ -116,6 +116,7 @@ class TraceData : public TQObject
long rightEdgeIndex;
double offset;
double textOffset;
+ double verticalMultiplier;
TQColor color;
bool enabled;
double leftEdge;
@@ -320,6 +321,9 @@ class TraceWidget : public TQWidget
double traceTextOffset(uint traceNumber);
void setTraceTextOffset(uint traceNumber, double offset, bool deferUpdate);
+ double traceVerticalMultiplier(uint traceNumber);
+ void setTraceVerticalMultiplier(uint traceNumber, double verticalMultiplier, bool deferUpdate);
+
bool horizontalRangeModeAbsolute();
void setHorizontalRangeModeAbsolute(bool absolute=true);
@@ -333,6 +337,7 @@ class TraceWidget : public TQWidget
public slots:
void setTraceOffset(uint traceNumber, double offset);
void setTraceTextOffset(uint traceNumber, double offset);
+ void setTraceVerticalMultiplier(uint traceNumber, double verticalMultiplier);
private slots:
void updateTraceText();
diff --git a/servers/gpib_server_lin/src/gpib_functions.cpp b/servers/gpib_server_lin/src/gpib_functions.cpp
index e3e3a38..d3e170e 100644
--- a/servers/gpib_server_lin/src/gpib_functions.cpp
+++ b/servers/gpib_server_lin/src/gpib_functions.cpp
@@ -39,6 +39,9 @@ const char * scopeLongDescription (const char * scopeType) {
else if (strcmp("TDS744AOS", scopeType) == 0) {
return "Tektronix 744A series";
}
+ else if (strcmp("TDS744COS", scopeType) == 0) {
+ return "Tektronix 744C series";
+ }
else {
return "UNKNOWN";
}
@@ -128,4 +131,4 @@ int gpib_read_binary(int ud, int max_num_bytes) {
return -1;
}
return 0;
-} \ No newline at end of file
+}
diff --git a/servers/gpib_server_lin/src/scope_functions.cpp b/servers/gpib_server_lin/src/scope_functions.cpp
index 96030c4..33d6ebf 100644
--- a/servers/gpib_server_lin/src/scope_functions.cpp
+++ b/servers/gpib_server_lin/src/scope_functions.cpp
@@ -49,7 +49,8 @@ unsigned long scopeScreenWidth (const char * scopeType) {
if (strcmp("HP54600OS", scopeType) == 0) {
return 512;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
return 640;
}
else {
@@ -61,7 +62,8 @@ unsigned long scopeScreenHeight (const char * scopeType) {
if (strcmp("HP54600OS", scopeType) == 0) {
return 280;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
return 480;
}
else {
@@ -73,7 +75,8 @@ unsigned long scopeScreenSize (const char * scopeType) {
if (strcmp("HP54600OS", scopeType) == 0) {
return scopeScreenWidth(scopeType)*scopeScreenHeight(scopeType)*3;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
return scopeScreenWidth(scopeType)*scopeScreenHeight(scopeType)*3;
}
else {
@@ -139,7 +142,7 @@ int scope_get_screenshot_stage2(const char * scopeType, int gpibDevice) {
int k;
int m;
- if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) {
+ if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) {
printf("[INFO] Getting scope screenshot [Stage 2]\n\r");
if (strcmp("HP54600OS", scopeType) == 0) {
if (gpib_read_binblock(gpibDevice, 19768, scopeType) == 0) {
@@ -149,7 +152,8 @@ int scope_get_screenshot_stage2(const char * scopeType, int gpibDevice) {
return 1;
}
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
gpib_read_binary(gpibDevice, scopeScreenSize(scopeType));
int bpp;
@@ -188,7 +192,7 @@ int scope_reset(const char * funcgenType, int gpibDevice) {
}
int scope_get_screenshot(const char * scopeType, int gpibDevice) {
- if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) {
+ if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) {
printf("[INFO] Getting scope screenshot [Stage 1]\n\r");
if (strcmp("HP54600OS", scopeType) == 0) {
sprintf(falpha, "PRINT?");
@@ -202,7 +206,8 @@ int scope_get_screenshot(const char * scopeType, int gpibDevice) {
return 2;
}
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
sprintf(falpha, "HARDCOPY:FORMAT BMPCOLOR");
if (gpib_write(gpibDevice, falpha) == 0) {
#ifdef ENABLE_EXTRA_DEBUGGING
@@ -240,7 +245,7 @@ int scope_get_screenshot(const char * scopeType, int gpibDevice) {
}
int scope_set_timebase(float desired_timebase,const char * scopeType, int gpibDevice) {
- if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) {
+ if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) {
printf("[INFO] Setting scope timebase to %E\n\r", desired_timebase);
if (strcmp("HP54600OS", scopeType) == 0) {
sprintf(falpha, "TIM:RANG %E", desired_timebase);
@@ -254,7 +259,8 @@ int scope_set_timebase(float desired_timebase,const char * scopeType, int gpibDe
return 2;
}
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
sprintf(falpha, "HORIZONTAL:MAIN:SCALE %E", desired_timebase);
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
@@ -285,7 +291,8 @@ int scope_get_timebase(double * retval, const char * scopeType, int gpibDevice)
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
// Send request
printf("[INFO] Getting scope timebase\n\r");
sprintf(falpha,"HORIZONTAL:MAIN:SCALE?");
@@ -325,7 +332,7 @@ int scope_get_timebase(double * retval, const char * scopeType, int gpibDevice)
}
int scope_set_volts_div(int desired_channel, double desired_volts, const char * scopeType, int gpibDevice) {
- if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) {
+ if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) {
printf("[INFO] Setting scope volts/div on channel %d to %E\n\r", desired_channel, desired_volts);
if (strcmp("HP54600OS", scopeType) == 0) {
sprintf(falpha, "CHAN%d:RANG %E", desired_channel, desired_volts);
@@ -339,7 +346,8 @@ int scope_set_volts_div(int desired_channel, double desired_volts, const char *
return 2;
}
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
sprintf(falpha, "CH%d:SCALE %E", desired_channel, desired_volts);
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
@@ -361,7 +369,7 @@ int scope_set_volts_div(int desired_channel, double desired_volts, const char *
}
int scope_set_acquisition(int status,const char * scopeType, int gpibDevice) {
- if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) {
+ if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) {
printf("[INFO] Setting scope run status to %d\n\r", status);
if (strcmp("HP54600OS", scopeType) == 0) {
if (status == 0) {
@@ -380,7 +388,8 @@ int scope_set_acquisition(int status,const char * scopeType, int gpibDevice) {
return 2;
}
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
sprintf(falpha, "ACQUIRE:STATE %d", status);
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
@@ -411,7 +420,8 @@ int scope_get_acquisition(int * retval, const char * scopeType, int gpibDevice)
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
// Send request
printf("[INFO] Getting run state\n\r");
sprintf(falpha,"ACQUIRE:STATE?");
@@ -451,7 +461,7 @@ int scope_get_acquisition(int * retval, const char * scopeType, int gpibDevice)
}
int scope_set_channel_state(int desired_channel, int status,const char * scopeType, int gpibDevice) {
- if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) {
+ if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) {
printf("[INFO] Setting channel %d state to %i\n\r", desired_channel, status);
if (strcmp("HP54600OS", scopeType) == 0) {
if (status == 0) {
@@ -473,7 +483,8 @@ int scope_set_channel_state(int desired_channel, int status,const char * scopeTy
return 2;
}
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
if (status == 0) {
sprintf(falpha, "SELECT:CH%d OFF", desired_channel);
}
@@ -514,7 +525,8 @@ int scope_get_channel_state(int * retval, int desired_channel, const char * scop
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
sprintf(falpha, "SELECT:CH%d?", desired_channel);
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
@@ -552,7 +564,7 @@ int scope_get_channel_state(int * retval, int desired_channel, const char * scop
}
int scope_set_trigger_channel(int desired_channel,const char * scopeType, int gpibDevice) {
- if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) {
+ if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) {
printf("[INFO] Setting scope trigger channel to %d\n\r", desired_channel);
if (strcmp("HP54600OS", scopeType) == 0) {
sprintf(falpha, "TRIG:SOUR CHAN%d", desired_channel);
@@ -566,7 +578,8 @@ int scope_set_trigger_channel(int desired_channel,const char * scopeType, int gp
return 2;
}
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
sprintf(falpha, "TRIGGER:MAIN:EDGE:SOURCE CH%d", desired_channel);
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
@@ -598,7 +611,8 @@ int scope_get_trigger_channel(int * retval, const char * scopeType, int gpibDevi
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
sprintf(falpha, "TRIGGER:MAIN:EDGE:SOURCE?");
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
@@ -646,7 +660,7 @@ int scope_get_trigger_channel(int * retval, const char * scopeType, int gpibDevi
}
int scope_set_trigger_level(float desired_level,const char * scopeType, int gpibDevice) {
- if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) {
+ if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) {
printf("[INFO] Setting scope trigger level to %f\n\r", desired_level);
if (strcmp("HP54600OS", scopeType) == 0) {
sprintf(falpha, "TRIG:LEV %E", desired_level);
@@ -660,7 +674,8 @@ int scope_set_trigger_level(float desired_level,const char * scopeType, int gpib
return 2;
}
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
sprintf(falpha, "TRIGGER:MAIN:LEVEL %f", desired_level);
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
@@ -691,7 +706,8 @@ int scope_get_trigger_level(double * retval, const char * scopeType, int gpibDev
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
// Send request
printf("[INFO] Getting trigger level\n\r");
sprintf(falpha,"TRIGGER:MAIN:LEVEL?");
@@ -731,7 +747,7 @@ int scope_get_trigger_level(double * retval, const char * scopeType, int gpibDev
}
int scope_set_channel_position(int desired_channel, float desired_level,const char * scopeType, int gpibDevice) {
- if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) {
+ if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) {
printf("[INFO] Setting scope channel %d level to %f\n\r", desired_channel, desired_level);
if (strcmp("HP54600OS", scopeType) == 0) {
sprintf(falpha, "CHAN%d:OFFS %E", desired_channel, desired_level);
@@ -745,7 +761,8 @@ int scope_set_channel_position(int desired_channel, float desired_level,const ch
return 2;
}
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
sprintf(falpha, "CH%d:POSITION %f", desired_channel, desired_level);
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
@@ -774,7 +791,8 @@ int scope_perform_initial_setup(const char * scopeType, int gpibDevice) {
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
sprintf(falpha,"HEAD OFF");
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
@@ -843,7 +861,8 @@ clock_gettime(CLOCK_REALTIME, &tp1);
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
// We need to get/parse the preamble, then obtain and adjust the trace data
sprintf(falpha,"DATA:SOURCE CH%d", desired_channel);
#ifdef ENABLE_EXTRA_DEBUGGING
@@ -887,6 +906,9 @@ clock_gettime(CLOCK_REALTIME, &tp4);
printf("[PROFILE] %f s\n\r", ((tp4.tv_nsec+(tp4.tv_sec*1e9))-(tp3.tv_nsec+(tp3.tv_sec*1e9)))/1e9);
#endif
TQString preamble(scope_segarray);
+ #ifdef ENABLE_EXTRA_TRACE_DEBUGGING
+ printf("[DEBG] Preamble: %s\n", preamble.ascii());
+ #endif
TQStringList resultPairs = TQStringList::split(";", preamble, FALSE);
// Find/initialize critical data values
double ymult = 0;
@@ -897,16 +919,33 @@ printf("[PROFILE] %f s\n\r", ((tp4.tv_nsec+(tp4.tv_sec*1e9))-(tp3.tv_nsec+(tp3.t
double xposition = 0;
char* xunits = NULL;
- if (resultPairs.count() > 15) {
- ymult = resultPairs[13].toDouble();
- yoffset = resultPairs[14].toDouble()*ymult;
- yposition = resultPairs[15].toDouble()*ymult;
- yunits = strdup(resultPairs[12]);
- xincr = resultPairs[9].toDouble();
- xposition = resultPairs[10].toDouble();
- xunits = strdup(resultPairs[8]);
+ if (strcmp("TDS744AOS", scopeType) == 0) {
+ if (resultPairs.count() > 15) {
+ ymult = resultPairs[13].toDouble();
+ yoffset = resultPairs[14].toDouble()*ymult;
+ yposition = resultPairs[15].toDouble()*ymult;
+ yunits = strdup(resultPairs[12]);
+ xincr = resultPairs[9].toDouble();
+ xposition = resultPairs[10].toDouble();
+ xunits = strdup(resultPairs[8]);
+ }
+ }
+ else if (strcmp("TDS744COS", scopeType) == 0) {
+ if (resultPairs.count() > 15) {
+ ymult = resultPairs[13].toDouble();
+ yoffset = resultPairs[14].toDouble()*ymult;
+ yposition = resultPairs[15].toDouble()*ymult;
+ yunits = strdup(resultPairs[12]);
+ xincr = resultPairs[9].toDouble();
+ xposition = resultPairs[10].toDouble();
+ xunits = strdup(resultPairs[8]);
+ }
}
+ #ifdef ENABLE_EXTRA_TRACE_DEBUGGING
+ printf("[DEBG] Decoded preamble: xincr: %f ymult: %f\n", xincr, ymult);
+ #endif
+
// If the units are desired, comment out these lines...
if (yunits) {
free(yunits);
@@ -944,15 +983,23 @@ printf("[PROFILE] %f s\n\r", ((tp6.tv_nsec+(tp6.tv_sec*1e9))-(tp5.tv_nsec+(tp5.t
long pointCount = ai/2;
double horizPos = 0.0;
char yheaderlen[2];
+ #ifdef ENABLE_EXTRA_TRACE_DEBUGGING
+ printf("[DEBG] Point count: %d\n", pointCount);
+ #endif
yheaderlen[0] = scope_segarray[1];
yheaderlen[1] = 0;
int data_offset = atoi(yheaderlen) + 2;
for (array_pointer=0; array_pointer<pointCount; array_pointer++) {
TQ_INT16 tempvalue;
- tempvalue = scope_segarray[(array_pointer*2)+1+data_offset]; // LSB
- tempvalue = tempvalue | (scope_segarray[(array_pointer*2)+0+data_offset] << 8); // MSB
+ tempvalue = (unsigned char)scope_segarray[(array_pointer*2)+1+data_offset]; // LSB
+ tempvalue = tempvalue | ((unsigned char)scope_segarray[(array_pointer*2)+0+data_offset] << 8); // MSB
scope_raw_trace_data[array_pointer] = tempvalue;
scope_raw_trace_data[array_pointer] = (scope_raw_trace_data[array_pointer] * ymult)-yoffset;
+ #ifdef ENABLE_EXTRA_TRACE_DEBUGGING
+ if (array_pointer < 512) {
+ printf("[DEBG] Array [%d]: %04x (%f) [%02x/%02x]\n", array_pointer, tempvalue, scope_raw_trace_data[array_pointer], (unsigned char)scope_segarray[(array_pointer*2)+0+data_offset], (unsigned char)scope_segarray[(array_pointer*2)+1+data_offset]);
+ }
+ #endif
scope_raw_position_data[array_pointer] = horizPos;
horizPos = horizPos + xincr;
}
@@ -988,7 +1035,8 @@ int scope_get_number_of_horizontal_divisions(const char * scopeType, int gpibDev
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
return 8;
}
else {
@@ -1002,7 +1050,8 @@ int scope_get_number_of_vertical_divisions(const char * scopeType, int gpibDevic
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
return 10;
}
else {
@@ -1014,7 +1063,8 @@ int scope_get_number_of_channels(const char * scopeType, int gpibDevice) {
if (strcmp("HP54600OS", scopeType) == 0) {
return 2;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
return 4;
}
else {
@@ -1032,7 +1082,8 @@ int scope_get_channel_volts_div(double * retval, int desired_channel, const char
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
// Send request
printf("[INFO] Getting scope volts per division for channel %d\n\r", desired_channel);
sprintf(falpha,"CH%d:SCALE?", desired_channel);
@@ -1081,7 +1132,8 @@ int scope_get_channel_seconds_div(double * retval, int desired_channel, const ch
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
double xincr;
// Send request
@@ -1177,7 +1229,8 @@ int scope_get_channel_sample_count(unsigned long * retval, int desired_channel,
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
// Send request
printf("[INFO] Getting number of samples in trace for channel %d\n\r", desired_channel);
sprintf(falpha,"DATA:SOURCE CH%d", desired_channel);
@@ -1242,7 +1295,8 @@ int scope_get_probe_attenuation_multiplier(double * retval, int desired_channel,
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
// Send request
printf("[INFO] Getting trigger level for channel %d\n\r", desired_channel);
sprintf(falpha,"CH%d:PROBE?", desired_channel);
@@ -1287,7 +1341,8 @@ int scope_get_permitted_volts_div_settings_at_1x(int * number_of_values, double
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
*number_of_values = 13;
double* values = (double*)malloc(sizeof(double)*(*number_of_values));
values[0] = 1e-3;
@@ -1317,7 +1372,8 @@ int scope_get_permitted_seconds_div_settings(int * number_of_values, double ** r
// Not supported (yet)
return -1;
}
- else if (strcmp("TDS744AOS", scopeType) == 0) {
+ else if ((strcmp("TDS744AOS", scopeType) == 0)
+ || (strcmp("TDS744COS", scopeType) == 0)) {
*number_of_values = 28;
double* values = (double*)malloc(sizeof(double)*(*number_of_values));
values[0] = 1.25e-8;