master
Timothy Pearson 13 years ago
parent 663e2f7a3d
commit 47f193b7de

@ -159,6 +159,32 @@
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="0" column="1">
<property name="name">
<cstring>groupOscilloscopeAcquisitionControls</cstring>
</property>
<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>
</grid>
</widget>
</grid>
</widget>
</grid>

@ -16,6 +16,7 @@
#include <tqvbox.h>
#include <tqsocket.h>
#include <tqmutex.h>
#include <tqpushbutton.h>
#include <tqeventloop.h>
#include <tqapplication.h>
#include <unistd.h> //access()
@ -93,6 +94,9 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
m_base->saRefLevel->setFloatMax(128);
m_base->saRefLevel->setLineStep(1);
connect(m_base->acqStart, SIGNAL(clicked()), this, SLOT(startDAQ()));
connect(m_base->acqStop, SIGNAL(clicked()), this, SLOT(stopDAQ()));
connect(m_base->saRefLevel, SIGNAL(floatValueChanged(double)), this, SLOT(saRefLevelChanged(double)));
TQTimer::singleShot(0, this, TQT_SLOT(postInit()));
@ -711,6 +715,15 @@ void ScopePart::mainEventLoop() {
}
}
}
else if (m_commHandlerCommandState == 3) {
if (stopTraceUpdate == false) {
m_commHandlerCommandState = 0;
EXEC_NEXT_STATE_IMMEDIATELY
}
else {
setTickerMessage(i18n("Data acquisition stopped"));
}
}
}
}
else {
@ -727,8 +740,25 @@ void ScopePart::postProcessTrace() {
return;
}
void ScopePart::startDAQ() {
// RAJA FIXME
// Also process lockouts...
}
void ScopePart::stopDAQ() {
// RAJA FIXME
// Also process lockouts...
if (m_commHandlerMode < 2) {
stopTraceUpdate = true;
m_commHandlerMode = 1;
m_commHandlerCommandState = 3;
mainEventLoop();
}
}
void ScopePart::updateZoomWidgetLimits(const TQRectF& zoomRect) {
for (int traceno=1; traceno<=m_maxNumberOfTraces; traceno++) {
for (int traceno=0; traceno<m_maxNumberOfTraces; traceno++) {
TQRectF fullZoomRect = m_traceWidget->displayLimits(traceno);
double widthSpan = fullZoomRect.width()-fullZoomRect.x();
double heightSpan = fullZoomRect.height()-fullZoomRect.y();

@ -49,6 +49,8 @@ namespace RemoteLab
void connectionStatusChangedCallback();
void setTickerMessage(TQString message);
void mainEventLoop();
void startDAQ();
void stopDAQ();
virtual void postProcessTrace();
void saRefLevelChanged(double);

@ -115,11 +115,20 @@ TraceData::TraceData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), p
graphStatusLabel->setPaletteBackgroundColor(labelParent->paletteBackgroundColor());
graphStatusLabel->setPaletteForegroundColor(color);
graphStatusLabel->setAlignment(TQt::AlignHCenter|TQt::AlignVCenter|TQt::SingleLine);
TQFont font;
font = graphStatusLabel->font();
font.setPointSize(font.pointSize()-1);
graphStatusLabel->setFont(font);
graphStatusLabel->setText("<qt></qt>");
graphStatusLabel->hide();
graphStatusLabelInner = new TQLabel(labelParent);
graphStatusLabelInner->setPaletteBackgroundColor(labelParent->paletteBackgroundColor());
graphStatusLabelInner->setPaletteForegroundColor(color);
graphStatusLabelInner->setAlignment(TQt::AlignHCenter|TQt::AlignVCenter|TQt::SingleLine);
font = graphStatusLabelInner->font();
font.setPointSize(font.pointSize()-1);
graphStatusLabelInner->setFont(font);
graphStatusLabelInner->setText("<qt></qt>");
graphStatusLabelInner->hide();
singleIncrBtn = new TQToolButton(TQt::UpArrow, labelParent);
singleDecrBtn = new TQToolButton(TQt::DownArrow, labelParent);
@ -173,12 +182,20 @@ void TraceData::drawTrace(TQPainter* p, int graticule_width, int graticule_heigh
y = ((((sampleArray[n]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height));
x2 = (((positionArray[n+1]-leftEdge)/(rightEdge-leftEdge))*(graticule_width));
y2 = ((((sampleArray[n+1]+offset)-topEdge)/(bottomEdge-topEdge))*(graticule_height));
if ((x > 0) && (x < graticule_width) && (y > 0) && (y < graticule_height) && (x2 > 0) && (x2 < graticule_width) && (y2 > 0) && (y2 < graticule_height)) {
if (x < 0) x = 0;
if (x > graticule_width) x = graticule_width;
if (y < 0) y = 0;
if (y > graticule_width) y = graticule_height;
if (x2 < 0) x2 = 0;
if (x2 > graticule_width) x2 = graticule_width;
if (y2 < 0) y2 = 0;
if (y2 > graticule_width) y2 = graticule_height;
p->drawLine(x, y, x2, y2);
}
}
}
}
void TraceData::movePosOneTick() {
double increment;
@ -541,7 +558,7 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) {
}
else {
for (uint trace=0;trace<m_base->m_traceArray.count();trace++) {
m_base->m_traceArray[trace]->graphStatusLabel->setText("");
m_base->m_traceArray[trace]->graphStatusLabel->setText("<qt></qt>");
m_base->m_traceArray[trace]->graphStatusLabelInner->setText(m_base->m_traceArray[trace]->graphStatusLabel->text());
}
}
@ -572,7 +589,7 @@ void GraticuleWidget::enterEvent(TQEvent *) {
void GraticuleWidget::leaveEvent(TQEvent *) {
for (uint trace=0;trace<m_base->m_traceArray.count();trace++) {
m_base->m_traceArray[trace]->graphStatusLabel->setText("");
m_base->m_traceArray[trace]->graphStatusLabel->setText("<qt></qt>");
m_base->m_traceArray[trace]->graphStatusLabelInner->setText(m_base->m_traceArray[trace]->graphStatusLabel->text());
}
}
@ -592,8 +609,8 @@ TraceWidget::TraceWidget(TQWidget* parent, const char* name) : TQWidget(parent,
m_traceLabelLayout = new TQGridLayout;
m_infoLabelLayout = new TQGridLayout;
m_cursorLabelLayout = new TQGridLayout;
m_statusLabelLayout = new TQGridLayout;
m_statusLabelLayoutInner = new TQGridLayout;
m_statusLabelLayout = new TQVBoxLayout;
m_statusLabelLayoutInner = new TQVBoxLayout;
m_primaryLayout->addLayout(m_traceLabelLayout, 255, 0);
m_primaryLayout->addLayout(m_rightPaneLayout, 0, 255);
m_primaryLayout->addLayout(m_statusLabelLayout, 255, 255);
@ -720,6 +737,7 @@ void TraceWidget::updateCursorText() {
// If this is a horizontal cursor, list all vertical positions for all channels
// If this is a vertical cursor, list the horizontal positions for all channels
for (uint trace=0;trace<m_traceArray.count();trace++) {
if (m_traceArray[trace]->enabled) {
double horizontal_range = (m_traceArray[trace]->rightEdge-m_traceArray[trace]->leftEdge);
double vertical_range = (m_traceArray[trace]->bottomEdge-m_traceArray[trace]->topEdge);
@ -732,6 +750,7 @@ void TraceWidget::updateCursorText() {
cursorText.append(TQString("<br>%1: %2").arg(m_traceArray[trace]->traceName).arg(prettyFormat(realCursorPosition, horizontal_range, m_traceArray[trace]->horizontalUnits)));
}
}
}
cursorText.append("</qt>");
m_cursorArray[cursor]->paramLabel->setText(cursorText);
@ -1212,8 +1231,8 @@ void TraceWidget::resizeTraceArray(uint newsize) {
m_traceLabelLayout->addWidget(m_traceArray[i]->singleIncrBtn, 0, (i*2)+1);
m_traceLabelLayout->addWidget(m_traceArray[i]->posResetBtn, 1, (i*2)+1);
m_traceLabelLayout->addWidget(m_traceArray[i]->singleDecrBtn, 2, (i*2)+1);
m_statusLabelLayout->addWidget(m_traceArray[i]->graphStatusLabel, i, 0);
m_statusLabelLayoutInner->addWidget(m_traceArray[i]->graphStatusLabelInner, i, 0);
m_statusLabelLayout->insertWidget(i, m_traceArray[i]->graphStatusLabel);
m_statusLabelLayoutInner->insertWidget(i, m_traceArray[i]->graphStatusLabelInner);
}
}
}

@ -234,8 +234,8 @@ class TraceWidget : public TQWidget
TQGridLayout* m_traceLabelLayout;
TQGridLayout* m_infoLabelLayout;
TQGridLayout* m_cursorLabelLayout;
TQGridLayout* m_statusLabelLayout;
TQGridLayout* m_statusLabelLayoutInner;
TQVBoxLayout* m_statusLabelLayout;
TQVBoxLayout* m_statusLabelLayoutInner;
GraticuleWidget* m_graticuleWidget;
friend class GraticuleWidget;

@ -632,6 +632,13 @@ clock_gettime(CLOCK_REALTIME, &tp1);
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
#endif
if (gpib_write(gpibDevice, falpha) != 0) {
return -1;
}
sprintf(falpha,"DATA:STOP 65535");
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
#endif
if (gpib_write(gpibDevice, falpha) == 0) {
#ifdef ENABLE_PROFILING
clock_gettime(CLOCK_REALTIME, &tp2);
@ -662,7 +669,7 @@ printf("[PROFILE] %f s\n\r", ((tp3.tv_nsec+(tp3.tv_sec*1e9))-(tp2.tv_nsec+(tp2.t
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(segarray); // RAJA UNCOMMENT ME
TQString preamble(segarray);
TQStringList resultPairs = TQStringList::split(";", preamble, FALSE);
// Find/initialize critical data values
double ymult;
@ -858,6 +865,14 @@ int scope_get_channel_seconds_div(double * retval, int desired_channel, const ch
return 2;
}
sprintf(falpha,"DATA:STOP 65535");
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
#endif
if (gpib_write(gpibDevice, falpha) != 0) {
return 2;
}
sprintf(falpha,"WFMPRE:CH%d:XINCR?",desired_channel);
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
@ -910,6 +925,7 @@ int scope_get_channel_seconds_div(double * retval, int desired_channel, const ch
else {
floatstring[ai]=0;
*retval = ((atof(floatstring)*xincr)/scope_get_number_of_vertical_divisions(scopeType, gpibDevice));
printf("[RAJA DEBUG 650.0] nr_p: %f, xincr: %E, vert_divs: %d, s/div: %f\n\r", atof(floatstring), xincr, scope_get_number_of_vertical_divisions(scopeType, gpibDevice), *retval); fflush(stdout);
}
#ifdef ENABLE_EXTRA_DEBUGGING
@ -944,6 +960,14 @@ int scope_get_channel_sample_count(unsigned long * retval, int desired_channel,
return 2;
}
sprintf(falpha,"DATA:STOP 65535");
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);
#endif
if (gpib_write(gpibDevice, falpha) != 0) {
return 2;
}
sprintf(falpha,"WFMPRE:CH%d:NR_P?", desired_channel);
#ifdef ENABLE_EXTRA_DEBUGGING
printf("[DEBG] Writing: %s\n\r", falpha);

Loading…
Cancel
Save