diff --git a/PhaseCompAcq/PhaseDevice.cpp b/PhaseCompAcq/PhaseDevice.cpp index 8bb9173..1bfbd58 100644 --- a/PhaseCompAcq/PhaseDevice.cpp +++ b/PhaseCompAcq/PhaseDevice.cpp @@ -83,6 +83,10 @@ phaseData->milisecond = now.toMSecsSinceEpoch(); this->afterFramePhase(phaseData); } + } else if (this->dataBuff.size() > PHASE_FRAM_LENGTH) + { + std::cout << QString("%1").arg(this->dataBuff.size()).toStdString() << std::endl; + this->dataBuff.clear(); } // 在此处释放内存,不影响后续显示 diff --git a/PhaseCompAcq/PhaseDevice.cpp b/PhaseCompAcq/PhaseDevice.cpp index 8bb9173..1bfbd58 100644 --- a/PhaseCompAcq/PhaseDevice.cpp +++ b/PhaseCompAcq/PhaseDevice.cpp @@ -83,6 +83,10 @@ phaseData->milisecond = now.toMSecsSinceEpoch(); this->afterFramePhase(phaseData); } + } else if (this->dataBuff.size() > PHASE_FRAM_LENGTH) + { + std::cout << QString("%1").arg(this->dataBuff.size()).toStdString() << std::endl; + this->dataBuff.clear(); } // 在此处释放内存,不影响后续显示 diff --git a/PhaseCompAcq/PhaseWindow.cpp b/PhaseCompAcq/PhaseWindow.cpp index d0e8221..9910be4 100644 --- a/PhaseCompAcq/PhaseWindow.cpp +++ b/PhaseCompAcq/PhaseWindow.cpp @@ -74,6 +74,7 @@ device->initSerialPort(); QThread::msleep(100); + device->startWork(); } // 5. 设置下拉框的样式 QStandardItemModel * model = qobject_cast(ui->devSelect->model()); @@ -112,7 +113,7 @@ // 赋值,对应的lineEdit/label ((QLineEdit *)channelBox->children().at(2))->setText(phaseData->timestamp); - ((QLineEdit *)channelBox->children().at(4))->setText(QString("%1 s").arg(phaseData->channelData.at(i))); + ((QLineEdit *)channelBox->children().at(4))->setText(QString("%1 ns").arg(phaseData->channelData.at(i))); ((QLineEdit *)channelBox->children().at(6))->setText(phaseData->frameId); ((QLabel *)channelBox->children().at(7))->setText(phaseData->channelActive.at(i) == "1" ? "有效" : "无效"); } @@ -155,7 +156,7 @@ dataLabel->setStyleSheet("margin-left:20;"); vbox->addWidget(dataLabel); QLineEdit * dataValue = new QLineEdit(); - dataValue->setFixedWidth(150); + dataValue->setFixedWidth(250); dataValue->setFont(labelFont); vbox->addWidget(dataValue); diff --git a/PhaseCompAcq/PhaseDevice.cpp b/PhaseCompAcq/PhaseDevice.cpp index 8bb9173..1bfbd58 100644 --- a/PhaseCompAcq/PhaseDevice.cpp +++ b/PhaseCompAcq/PhaseDevice.cpp @@ -83,6 +83,10 @@ phaseData->milisecond = now.toMSecsSinceEpoch(); this->afterFramePhase(phaseData); } + } else if (this->dataBuff.size() > PHASE_FRAM_LENGTH) + { + std::cout << QString("%1").arg(this->dataBuff.size()).toStdString() << std::endl; + this->dataBuff.clear(); } // 在此处释放内存,不影响后续显示 diff --git a/PhaseCompAcq/PhaseWindow.cpp b/PhaseCompAcq/PhaseWindow.cpp index d0e8221..9910be4 100644 --- a/PhaseCompAcq/PhaseWindow.cpp +++ b/PhaseCompAcq/PhaseWindow.cpp @@ -74,6 +74,7 @@ device->initSerialPort(); QThread::msleep(100); + device->startWork(); } // 5. 设置下拉框的样式 QStandardItemModel * model = qobject_cast(ui->devSelect->model()); @@ -112,7 +113,7 @@ // 赋值,对应的lineEdit/label ((QLineEdit *)channelBox->children().at(2))->setText(phaseData->timestamp); - ((QLineEdit *)channelBox->children().at(4))->setText(QString("%1 s").arg(phaseData->channelData.at(i))); + ((QLineEdit *)channelBox->children().at(4))->setText(QString("%1 ns").arg(phaseData->channelData.at(i))); ((QLineEdit *)channelBox->children().at(6))->setText(phaseData->frameId); ((QLabel *)channelBox->children().at(7))->setText(phaseData->channelActive.at(i) == "1" ? "有效" : "无效"); } @@ -155,7 +156,7 @@ dataLabel->setStyleSheet("margin-left:20;"); vbox->addWidget(dataLabel); QLineEdit * dataValue = new QLineEdit(); - dataValue->setFixedWidth(150); + dataValue->setFixedWidth(250); dataValue->setFont(labelFont); vbox->addWidget(dataValue); diff --git a/PhaseCompAcq/common/utils/QSerialPortUtil.cpp b/PhaseCompAcq/common/utils/QSerialPortUtil.cpp index ba0ffb5..64da0f7 100644 --- a/PhaseCompAcq/common/utils/QSerialPortUtil.cpp +++ b/PhaseCompAcq/common/utils/QSerialPortUtil.cpp @@ -21,18 +21,18 @@ open = serial.open(QIODevice::ReadWrite); -// if (open == true) -// { + if (open == true) + { // 绑定信号与槽 connect(&serial, &QSerialPort::readyRead, this, &QSerialPortUtil::readData); // mock data received per second - QTimer * timer = new QTimer(this); - connect(timer, &QTimer::timeout, - this, &QSerialPortUtil::mockReceivData); - timer->start(1000); -// } +// QTimer * timer = new QTimer(this); +// connect(timer, &QTimer::timeout, +// this, &QSerialPortUtil::mockReceivData); +// timer->start(1000); + } } void QSerialPortUtil::sendData(QByteArray data) diff --git a/PhaseCompAcq/PhaseDevice.cpp b/PhaseCompAcq/PhaseDevice.cpp index 8bb9173..1bfbd58 100644 --- a/PhaseCompAcq/PhaseDevice.cpp +++ b/PhaseCompAcq/PhaseDevice.cpp @@ -83,6 +83,10 @@ phaseData->milisecond = now.toMSecsSinceEpoch(); this->afterFramePhase(phaseData); } + } else if (this->dataBuff.size() > PHASE_FRAM_LENGTH) + { + std::cout << QString("%1").arg(this->dataBuff.size()).toStdString() << std::endl; + this->dataBuff.clear(); } // 在此处释放内存,不影响后续显示 diff --git a/PhaseCompAcq/PhaseWindow.cpp b/PhaseCompAcq/PhaseWindow.cpp index d0e8221..9910be4 100644 --- a/PhaseCompAcq/PhaseWindow.cpp +++ b/PhaseCompAcq/PhaseWindow.cpp @@ -74,6 +74,7 @@ device->initSerialPort(); QThread::msleep(100); + device->startWork(); } // 5. 设置下拉框的样式 QStandardItemModel * model = qobject_cast(ui->devSelect->model()); @@ -112,7 +113,7 @@ // 赋值,对应的lineEdit/label ((QLineEdit *)channelBox->children().at(2))->setText(phaseData->timestamp); - ((QLineEdit *)channelBox->children().at(4))->setText(QString("%1 s").arg(phaseData->channelData.at(i))); + ((QLineEdit *)channelBox->children().at(4))->setText(QString("%1 ns").arg(phaseData->channelData.at(i))); ((QLineEdit *)channelBox->children().at(6))->setText(phaseData->frameId); ((QLabel *)channelBox->children().at(7))->setText(phaseData->channelActive.at(i) == "1" ? "有效" : "无效"); } @@ -155,7 +156,7 @@ dataLabel->setStyleSheet("margin-left:20;"); vbox->addWidget(dataLabel); QLineEdit * dataValue = new QLineEdit(); - dataValue->setFixedWidth(150); + dataValue->setFixedWidth(250); dataValue->setFont(labelFont); vbox->addWidget(dataValue); diff --git a/PhaseCompAcq/common/utils/QSerialPortUtil.cpp b/PhaseCompAcq/common/utils/QSerialPortUtil.cpp index ba0ffb5..64da0f7 100644 --- a/PhaseCompAcq/common/utils/QSerialPortUtil.cpp +++ b/PhaseCompAcq/common/utils/QSerialPortUtil.cpp @@ -21,18 +21,18 @@ open = serial.open(QIODevice::ReadWrite); -// if (open == true) -// { + if (open == true) + { // 绑定信号与槽 connect(&serial, &QSerialPort::readyRead, this, &QSerialPortUtil::readData); // mock data received per second - QTimer * timer = new QTimer(this); - connect(timer, &QTimer::timeout, - this, &QSerialPortUtil::mockReceivData); - timer->start(1000); -// } +// QTimer * timer = new QTimer(this); +// connect(timer, &QTimer::timeout, +// this, &QSerialPortUtil::mockReceivData); +// timer->start(1000); + } } void QSerialPortUtil::sendData(QByteArray data) diff --git a/PhaseCompAcq/common/utils/SettingConfig.cpp b/PhaseCompAcq/common/utils/SettingConfig.cpp index c95ff2a..9a84a43 100644 --- a/PhaseCompAcq/common/utils/SettingConfig.cpp +++ b/PhaseCompAcq/common/utils/SettingConfig.cpp @@ -11,8 +11,8 @@ KAFKA_BROKERS = getProperty("kafka", "brokers").toString(); KAFKA_DATA_TOPIC = getProperty("kafka", "dataTopic").toString(); NEED_SASL = getProperty("kafka", "needSasl").toInt(); - SASL_USERNAME = getProperty("kafka", "sasl_username").toString(); - SASL_PASSWORD = getProperty("kafka", "sasl_password").toString(); + SASL_USERNAME = getProperty("kafka", "saslUsername").toString(); + SASL_PASSWORD = getProperty("kafka", "saslPassword").toString(); CLIENT_ID = getProperty("client", "clientId").toString(); APP_KEY = getProperty("client", "appKey").toString(); diff --git a/PhaseCompAcq/PhaseDevice.cpp b/PhaseCompAcq/PhaseDevice.cpp index 8bb9173..1bfbd58 100644 --- a/PhaseCompAcq/PhaseDevice.cpp +++ b/PhaseCompAcq/PhaseDevice.cpp @@ -83,6 +83,10 @@ phaseData->milisecond = now.toMSecsSinceEpoch(); this->afterFramePhase(phaseData); } + } else if (this->dataBuff.size() > PHASE_FRAM_LENGTH) + { + std::cout << QString("%1").arg(this->dataBuff.size()).toStdString() << std::endl; + this->dataBuff.clear(); } // 在此处释放内存,不影响后续显示 diff --git a/PhaseCompAcq/PhaseWindow.cpp b/PhaseCompAcq/PhaseWindow.cpp index d0e8221..9910be4 100644 --- a/PhaseCompAcq/PhaseWindow.cpp +++ b/PhaseCompAcq/PhaseWindow.cpp @@ -74,6 +74,7 @@ device->initSerialPort(); QThread::msleep(100); + device->startWork(); } // 5. 设置下拉框的样式 QStandardItemModel * model = qobject_cast(ui->devSelect->model()); @@ -112,7 +113,7 @@ // 赋值,对应的lineEdit/label ((QLineEdit *)channelBox->children().at(2))->setText(phaseData->timestamp); - ((QLineEdit *)channelBox->children().at(4))->setText(QString("%1 s").arg(phaseData->channelData.at(i))); + ((QLineEdit *)channelBox->children().at(4))->setText(QString("%1 ns").arg(phaseData->channelData.at(i))); ((QLineEdit *)channelBox->children().at(6))->setText(phaseData->frameId); ((QLabel *)channelBox->children().at(7))->setText(phaseData->channelActive.at(i) == "1" ? "有效" : "无效"); } @@ -155,7 +156,7 @@ dataLabel->setStyleSheet("margin-left:20;"); vbox->addWidget(dataLabel); QLineEdit * dataValue = new QLineEdit(); - dataValue->setFixedWidth(150); + dataValue->setFixedWidth(250); dataValue->setFont(labelFont); vbox->addWidget(dataValue); diff --git a/PhaseCompAcq/common/utils/QSerialPortUtil.cpp b/PhaseCompAcq/common/utils/QSerialPortUtil.cpp index ba0ffb5..64da0f7 100644 --- a/PhaseCompAcq/common/utils/QSerialPortUtil.cpp +++ b/PhaseCompAcq/common/utils/QSerialPortUtil.cpp @@ -21,18 +21,18 @@ open = serial.open(QIODevice::ReadWrite); -// if (open == true) -// { + if (open == true) + { // 绑定信号与槽 connect(&serial, &QSerialPort::readyRead, this, &QSerialPortUtil::readData); // mock data received per second - QTimer * timer = new QTimer(this); - connect(timer, &QTimer::timeout, - this, &QSerialPortUtil::mockReceivData); - timer->start(1000); -// } +// QTimer * timer = new QTimer(this); +// connect(timer, &QTimer::timeout, +// this, &QSerialPortUtil::mockReceivData); +// timer->start(1000); + } } void QSerialPortUtil::sendData(QByteArray data) diff --git a/PhaseCompAcq/common/utils/SettingConfig.cpp b/PhaseCompAcq/common/utils/SettingConfig.cpp index c95ff2a..9a84a43 100644 --- a/PhaseCompAcq/common/utils/SettingConfig.cpp +++ b/PhaseCompAcq/common/utils/SettingConfig.cpp @@ -11,8 +11,8 @@ KAFKA_BROKERS = getProperty("kafka", "brokers").toString(); KAFKA_DATA_TOPIC = getProperty("kafka", "dataTopic").toString(); NEED_SASL = getProperty("kafka", "needSasl").toInt(); - SASL_USERNAME = getProperty("kafka", "sasl_username").toString(); - SASL_PASSWORD = getProperty("kafka", "sasl_password").toString(); + SASL_USERNAME = getProperty("kafka", "saslUsername").toString(); + SASL_PASSWORD = getProperty("kafka", "saslPassword").toString(); CLIENT_ID = getProperty("client", "clientId").toString(); APP_KEY = getProperty("client", "appKey").toString(); diff --git a/PhaseCompAcq/protocol/PhaseProtocolBM.h b/PhaseCompAcq/protocol/PhaseProtocolBM.h index 234525a..20cb37e 100644 --- a/PhaseCompAcq/protocol/PhaseProtocolBM.h +++ b/PhaseCompAcq/protocol/PhaseProtocolBM.h @@ -15,7 +15,7 @@ PHASE_MESSURE_CHANNEL * PHASE_MESSURE_SIZE; static const qulonglong CALCULATE_OFFSET = 0X0080000000000000; -static const double CALCULATE_FACTOR = 1.6810E-15 * 10E9; +static const double CALCULATE_FACTOR = 1.6810E-15 * 1E9; class PhaseProtocolBM : public QObject {