Skip to content

Comments

Добавлено переключение на три разных режима. Значения спинбоксов (Мар…#5

Merged
DaShakuev merged 4 commits intotest_qt_ros_guifrom
test_pult_pavel
Feb 19, 2026
Merged

Добавлено переключение на три разных режима. Значения спинбоксов (Мар…#5
DaShakuev merged 4 commits intotest_qt_ros_guifrom
test_pult_pavel

Conversation

@Alexberest0
Copy link
Collaborator

…ша, крена, глубины итд сохраняются)

mainwindow.cpp Outdated
&RosBridge::zeroYaw);

// Инициализация трех кнопок для режимов
if (ui->pushButton_speedFast_2) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему название кнопки pushButton_speedFast_2?
Есть pushButton_speedFast_1?
сделай просто pushButton_speedFast, если можно. Аналогично с другими двумя кнопками

mainwindow.cpp Outdated
// Инициализация трех кнопок для режимов
if (ui->pushButton_speedFast_2) {
connect(ui->pushButton_speedFast_2, &QPushButton::clicked,
this, &MainWindow::setSpeedModeFast);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

сможешь сделать один слод setSpeedMode, который бы смог работать для каждой кнопки

mainwindow.h Outdated
private:


enum SpeedMode { SLOW = 0, MEDIUM = 1, FAST = 2 }; // перечисление, для трех режимов скоростей
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рекомендуется использовать enum class с фиксированным базовым типом (uint8_t)
enum class SpeedMode : uint8_t {
Slow = 0,
Medium = 1,
Fast = 2
};

mainwindow.h Outdated


enum SpeedMode { SLOW = 0, MEDIUM = 1, FAST = 2 }; // перечисление, для трех режимов скоростей
SpeedMode currentMode = MEDIUM; // храним текущий режим, по умолчанию среднйи
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

оставь здесь лучше парметр currentMode без инициализации и инициализируй его в конструкторе через setSpeedMode

mainwindow.h Outdated
Comment on lines 98 to 100



Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лишние строки

mainwindow.h Outdated
Comment on lines 225 to 226


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

убрать

mainwindow.h Outdated
Comment on lines 64 to 85
/*
map - словарь из словарей
int - первый ключ, отвечает за номер режима 0, 1, 2
QString - второй ключ , имя спинбокса

SpeedMode = {
0: { // SLOW режим
"surge": 10.0,
"sway": 10.0,
"depth": 10.0,
},
1: { // MEDIUM режим
"surge": 50.0,
"sway": 50.0,
},
2: { // FAST режим
"surge": 100.0,
"sway": 100.0,
}
}

*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

удали

mainwindow.cpp Outdated
Comment on lines 651 to 654
void MainWindow::onGainValueChanged() {
// Сохраняем изменения в текущем режиме
saveCurrentModeGains();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

стрем, что onGainValueChanged используется только, чтобы вызвать saveCurrentModeGains.
удали onGainValueChanged и засунь вызов saveCurrentModeGains в лямбда функцию

mainwindow.cpp Outdated
// Подключаем сигналы
for (auto spinBox : gainSpinBoxes) {
connect(spinBox, QOverload<int>::of(&QSpinBox::valueChanged),
this, &MainWindow::onGainValueChanged);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

замени слот onGainValueChanged на saveCurrentModeGains в лямбда функции

@DaShakuev DaShakuev merged commit d8908cf into test_qt_ros_gui Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants