Исправлено неверное декодирование фрейма, добавлена скорость
This commit is contained in:
parent
346f40920b
commit
3b3685c417
@ -16,25 +16,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->log->setReadOnly(true);
|
||||
setWindowTitle("Podval Sniffer soft");
|
||||
updatePortsList();
|
||||
|
||||
// это перегон текстовика с заранее сохраненными пакетами
|
||||
// std::fstream f("test6.txt", std::ios_base::in | std::ios_base::binary);
|
||||
// if (f.good()) {
|
||||
// do {
|
||||
// char chars[22];
|
||||
// f.read((char*) chars, 22);
|
||||
// if (f.good()) {
|
||||
// for (char c: chars) {
|
||||
// printf("%c", c);
|
||||
// putCharToMessage(c);
|
||||
// }
|
||||
// } else {
|
||||
// break;
|
||||
// }
|
||||
// } while (!f.eof());
|
||||
// ui->log->appendHtml("<font style=\"color:green\">[INFO] Файл c данными прочитан. Там " + QString::number(messages.size()) + " записей</font>\n");
|
||||
// }
|
||||
// f.close();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
@ -58,7 +39,7 @@ void MainWindow::on_connectButton_clicked() {
|
||||
serial = new QSerialPort(port);
|
||||
connect(serial, &QSerialPort::readyRead, this, &MainWindow::readDataHandler);
|
||||
|
||||
serial->setBaudRate(500000);
|
||||
serial->setBaudRate(ui->speedSelect->currentText().toInt());
|
||||
serial->setDataBits(QSerialPort::Data8);
|
||||
serial->setFlowControl(QSerialPort::NoFlowControl);
|
||||
serial->setStopBits(QSerialPort::OneStop);
|
||||
@ -203,8 +184,7 @@ void MainWindow::putCharToMessage(char data) {
|
||||
|
||||
// теперь саму посылку, она все равно всегда передается как 8 байт
|
||||
for (int i = 0; i < 8; i++) {
|
||||
automat.message.data[i] = charToNum(automat.text[i + 5]) |
|
||||
(charToNum(automat.text[i + 4]) << 4);
|
||||
automat.message.data[i] = charToNum(automat.text[(i << 1) + 5]) | (charToNum(automat.text[(i << 1) + 4]) << 4);
|
||||
}
|
||||
|
||||
messages.push_back(automat.message);
|
||||
|
@ -20,7 +20,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Выбрать порт</string>
|
||||
<string>Порт:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -34,6 +34,32 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Скорость</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="speedSelect">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>921600</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>500000</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>115200</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="updatePortsButton">
|
||||
<property name="text">
|
||||
|
Reference in New Issue
Block a user