/** * prebuild the optical flow using threading */ void Project_sV::buildCacheFlowSource() { QSettings settings; bool precalc = settings.value("preferences/precalcFlow", true).toBool(); if (precalc && (m_flowSource != NULL)) { #if 0 qDebug() << "Creating cached FlowSources "; Q_ASSERT(m_flowSource != NULL); // TODO: test/check better place ? // we should do it for each size/each way // use threading here //flowSource()->buildFlowForwardCache(FrameSize_Orig); startFlow(0,FrameSize_Small,0); startFlow(1,FrameSize_Small,1); startFlow(2,FrameSize_Orig,0); startFlow(3,FrameSize_Orig,1); #else qDebug() << "cache flow source disable"; #endif } }
QInjTester::QInjTester(QextSerialPort *port) { serial = port; setWindowTitle(tr("Injector tester")); move(380,80); //setGeometry(300,100,500,320); timeCount = 50; flowTimer = new QTimer(this); flowTimer->setSingleShot(true); pulseTimer = new QTimer(this); pulseTimer->setSingleShot(true); LCDFlowTimer = new QTimer(this); LCDPulseTimer = new QTimer(this); QGridLayout *grid = new QGridLayout; QTextEdit *editFlowHelp = new QTextEdit(tr("Choose test duration. Pressing\n" "the start button, the injector will " "remain open for the selected time, or until stop button is pressed.")); editFlowHelp->setReadOnly(true); QLabel *flowDurationLabel = new QLabel(tr("Duration (ms): ")); editFlowDuration = new QLineEdit("1000"); editFlowDuration->setAlignment(Qt::AlignRight); flowTimeLCD = new QLCDNumber(6); flowTimeLCD->setSegmentStyle(QLCDNumber::Filled); startFlowButton = new QPushButton(tr("Start")); stopFlowButton = new QPushButton(tr("Stop")); connect(startFlowButton,SIGNAL(released()),this,SLOT(startFlow())); connect(stopFlowButton,SIGNAL(released()),this,SLOT(stopFlow())); connect(flowTimer,SIGNAL(timeout()),this,SLOT(stopFlow())); connect(LCDFlowTimer,SIGNAL(timeout()),this,SLOT(displayFlowLCD())); QGroupBox *groupBox2 = new QGroupBox(tr("Flow Test")); QGridLayout *vbox2 = new QGridLayout; vbox2->addWidget(editFlowHelp,0,0); vbox2->addWidget(flowTimeLCD,1,0); vbox2->addWidget(flowDurationLabel,0,1); vbox2->addWidget(editFlowDuration,0,2); vbox2->addWidget(startFlowButton,1,1); vbox2->addWidget(stopFlowButton,1,2); groupBox2->setLayout(vbox2); QTextEdit *editPulseHelp = new QTextEdit(tr("Elija la duracion de la prueba (ms).\n" "Cuando pulse el boton Start,los inyectores se abriran el durante el tiempo elegido" " y no se cerraran hasta que termine la prueba o se presione el boton Stop.")); editPulseHelp->setReadOnly(true); QLabel *pulseDurationLabel = new QLabel(tr("Duration (ms): ")); editPulseDuration = new QLineEdit("1000"); editPulseDuration->setAlignment(Qt::AlignRight); QLabel *pulseONLabel = new QLabel(tr("ON time (ms): ")); editPulseON = new QLineEdit("2.5"); editPulseON->setAlignment(Qt::AlignRight); QLabel *pulseOFFLabel = new QLabel(tr("OFF time (ms): ")); editPulseOFF = new QLineEdit("2.5"); editPulseOFF->setAlignment(Qt::AlignRight); ONtime.entero = 2500; OFFtime.entero = 2500; pulseTimeLCD = new QLCDNumber(6); pulseTimeLCD->setSegmentStyle(QLCDNumber::Filled); pulseBar = new QProgressBar; pulseBar->setRange(0,5000); pulseBar->setValue(2500); startPulseButton = new QPushButton(tr("Start")); stopPulseButton = new QPushButton(tr("Stop")); connect(startPulseButton,SIGNAL(released()),this,SLOT(startPulse())); connect(stopPulseButton,SIGNAL(released()),this,SLOT(stopPulse())); connect(editPulseON,SIGNAL(textChanged(const QString)),this,SLOT(editONChange(const QString ))); connect(editPulseOFF,SIGNAL(textChanged(const QString)),this,SLOT(editOFFChange(const QString ))); connect(pulseTimer,SIGNAL(timeout()),this,SLOT(stopPulse())); connect(LCDPulseTimer,SIGNAL(timeout()),this,SLOT(displayPulseLCD())); QGroupBox *groupBox1 = new QGroupBox(tr("Pulse Test")); QGridLayout *vbox = new QGridLayout; vbox->addWidget(editPulseHelp,0,0,5,1); vbox->addWidget(pulseTimeLCD,6,0); vbox->addWidget(pulseDurationLabel,0,1); vbox->addWidget(editPulseDuration,0,2); vbox->addWidget(pulseONLabel,1,1); vbox->addWidget(editPulseON,1,2); vbox->addWidget(pulseOFFLabel,2,1); vbox->addWidget(editPulseOFF,2,2); vbox->addWidget(pulseBar,4,1,1,2); vbox->addWidget(startPulseButton,6,1); vbox->addWidget(stopPulseButton,6,2); groupBox1->setLayout(vbox); grid->addWidget(groupBox2,0,0,1,2); grid->addWidget(groupBox1,1,0,1,2); setLayout(grid); }