diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index e04e578..ce94068 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -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("[INFO] Файл c данными прочитан. Там " + QString::number(messages.size()) + " записей\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);
diff --git a/src/MainWindow.ui b/src/MainWindow.ui
index bef4697..d51ba01 100644
--- a/src/MainWindow.ui
+++ b/src/MainWindow.ui
@@ -20,7 +20,7 @@
-
- Выбрать порт
+ Порт:
@@ -34,6 +34,32 @@
+ -
+
+
+ Скорость
+
+
+
+ -
+
+
-
+
+ 921600
+
+
+ -
+
+ 500000
+
+
+ -
+
+ 115200
+
+
+
+
-