diff --git a/HPPA/AppSettings.cpp b/HPPA/AppSettings.cpp index 3fe1c30..54ab0cd 100644 --- a/HPPA/AppSettings.cpp +++ b/HPPA/AppSettings.cpp @@ -175,6 +175,16 @@ void AppSettings::setReturnSpeed(double value) m_settings.setValue("OneMotorControl/ReturnSpeed", value); } +double AppSettings::manualMovementSpeed() const +{ + return m_settings.value("OneMotorControl/ManualMovementSpeed", 1).toDouble(); +} + +void AppSettings::setManualMovementSpeed(double value) +{ + m_settings.setValue("OneMotorControl/ManualMovementSpeed", value); +} + int AppSettings::gonggaShanRecordPort() const { return m_settings.value("GonggaShanRecordCtl/Port", kDefaultGonggaShanRecordPort).toInt(); diff --git a/HPPA/AppSettings.h b/HPPA/AppSettings.h index b62711d..dbad821 100644 --- a/HPPA/AppSettings.h +++ b/HPPA/AppSettings.h @@ -56,6 +56,10 @@ public: double returnSpeed() const; void setReturnSpeed(double value); + // 手动移动速度 + double manualMovementSpeed() const; + void setManualMovementSpeed(double value); + // 贡嘎山记录端口 int gonggaShanRecordPort() const; void setGonggaShanRecordPort(int value); diff --git a/HPPA/OneMotorControl.cpp b/HPPA/OneMotorControl.cpp index e798ed8..71a0b40 100644 --- a/HPPA/OneMotorControl.cpp +++ b/HPPA/OneMotorControl.cpp @@ -17,18 +17,18 @@ OneMotorControl::OneMotorControl(QWidget* parent) : QDialog(parent) connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(onx_rangeMeasurement())); - // 从 AppSettings 读取速度参数 - AppSettings& settings = AppSettings::instance(); - ui.speed_lineEdit->setText(QString::number(settings.scanSpeed())); - ui.return_speed_lineEdit->setText(QString::number(settings.returnSpeed())); - // 连接信号,当控件数值变化时保存到 AppSettings - connect(ui.speed_lineEdit, &QLineEdit::editingFinished, [this]() { - AppSettings::instance().setScanSpeed(ui.speed_lineEdit->text().toDouble()); + connect(ui.scanSpeed_lineEdit, &QLineEdit::editingFinished, [this]() { + AppSettings::instance().setScanSpeed(ui.scanSpeed_lineEdit->text().toDouble()); }); connect(ui.return_speed_lineEdit, &QLineEdit::editingFinished, [this]() { AppSettings::instance().setReturnSpeed(ui.return_speed_lineEdit->text().toDouble()); }); + connect(ui.manualMovementSpeed_lineEdit, &QLineEdit::editingFinished, [this]() { + AppSettings::instance().setManualMovementSpeed(ui.manualMovementSpeed_lineEdit->text().toDouble()); + }); + + loadSettings(); } OneMotorControl::~OneMotorControl() @@ -37,6 +37,13 @@ OneMotorControl::~OneMotorControl() m_motorThread.wait(); } +void OneMotorControl::loadSettings() +{ + ui.scanSpeed_lineEdit->setText(QString::number(AppSettings::instance().scanSpeed())); + ui.return_speed_lineEdit->setText(QString::number(AppSettings::instance().returnSpeed())); + ui.manualMovementSpeed_lineEdit->setText(QString::number(AppSettings::instance().manualMovementSpeed())); +} + void OneMotorControl::onConnectMotor() { connectMotor(true); @@ -44,7 +51,7 @@ void OneMotorControl::onConnectMotor() void OneMotorControl::setScanSpeed(double speed) { - ui.speed_lineEdit->setText(QString::number(speed)); + ui.scanSpeed_lineEdit->setText(QString::number(speed)); } void OneMotorControl::connectMotor(bool isNotification) @@ -116,7 +123,7 @@ void OneMotorControl::connectMotor(bool isNotification) void OneMotorControl::display_x_loc(std::vector loc) { double tmp = round(loc[0] * 100) / 100; - this->ui.realTimeLoc_lineEdit->setText(QString::number(tmp)); + this->ui.realTimeLoc_label->setText(QString::number(tmp)); emit broadcastLocationSignal(loc); } @@ -166,13 +173,13 @@ void OneMotorControl::zeroStart() void OneMotorControl::onx_rangeMeasurement() { - double s0 = ui.speed_lineEdit->text().toDouble(); + double s0 = ui.manualMovementSpeed_lineEdit->text().toDouble(); emit rangeMeasurement(0, s0, 1000); } void OneMotorControl::onxMove2Loc() { - double s = ui.speed_lineEdit->text().toDouble(); + double s = ui.manualMovementSpeed_lineEdit->text().toDouble(); double l = ui.move2loc_lineEdit->text().toDouble(); emit move2LocSignal(0, l, s, 1000); @@ -180,14 +187,14 @@ void OneMotorControl::onxMove2Loc() void OneMotorControl::onxMotorRight() { - double s = ui.speed_lineEdit->text().toDouble(); + double s = ui.manualMovementSpeed_lineEdit->text().toDouble(); emit moveSignal(0, abs(s), 1000); } void OneMotorControl::onxMotorLeft() { - double s = ui.speed_lineEdit->text().toDouble(); + double s = ui.manualMovementSpeed_lineEdit->text().toDouble(); emit moveSignal(0, abs(s)*-1, 1000); } @@ -204,7 +211,7 @@ void OneMotorControl::setImager(ImagerOperationBase* imager) void OneMotorControl::record_dark() { - double s = ui.speed_lineEdit->text().toDouble(); + double s = ui.scanSpeed_lineEdit->text().toDouble(); if (m_darkCaptureCoordinator == nullptr) { @@ -216,7 +223,7 @@ void OneMotorControl::record_dark() void OneMotorControl::record_white() { - double s = ui.speed_lineEdit->text().toDouble(); + double s = ui.scanSpeed_lineEdit->text().toDouble(); if (m_whiteCaptureCoordinator == nullptr) { @@ -246,7 +253,7 @@ void OneMotorControl::run() this, &OneMotorControl::onSequenceComplete_motorBack2Origin); OneMotionCapturePathLine tmp; - tmp.speedRecord = ui.speed_lineEdit->text().toDouble(); + tmp.speedRecord = ui.scanSpeed_lineEdit->text().toDouble(); tmp.speedBack = ui.return_speed_lineEdit->text().toDouble(); emit start(tmp); @@ -275,7 +282,7 @@ void OneMotorControl::multiPosHyperAutoExposure() connect(m_coordinator_gonggashan_autoexpose, &OneMotorMultiPosCoordinator::sequenceComplete, this, &OneMotorControl::onSequenceComplete_gonggashan_autoexpose); connect(m_coordinator_gonggashan_autoexpose, &OneMotorMultiPosCoordinator::hyperAutoExposureDoneSignal, this, &OneMotorControl::hyperAutoExposureDoneSignal_gonggashan); - m_coordinator_gonggashan_autoexpose->startStepMotion(ui.speed_lineEdit->text().toDouble(), locations); + m_coordinator_gonggashan_autoexpose->startStepMotion(ui.manualMovementSpeed_lineEdit->text().toDouble(), locations); } void OneMotorControl::onSequenceComplete_gonggashan_autoexpose(int state) @@ -365,18 +372,18 @@ OneMotorControl_LiftingPlatform::OneMotorControl_LiftingPlatform(QWidget* parent connect(this->ui.rangeMeasurement_btn, SIGNAL(pressed()), this, SLOT(onx_rangeMeasurement())); - // 从 AppSettings 读取速度参数 - AppSettings& settings = AppSettings::instance(); - ui.speed_lineEdit->setText(QString::number(settings.scanSpeed())); - ui.return_speed_lineEdit->setText(QString::number(settings.returnSpeed())); - // 连接信号,当控件数值变化时保存到 AppSettings - connect(ui.speed_lineEdit, &QLineEdit::editingFinished, [this]() { - AppSettings::instance().setScanSpeed(ui.speed_lineEdit->text().toDouble()); + connect(ui.scanSpeed_lineEdit, &QLineEdit::editingFinished, [this]() { + AppSettings::instance().setScanSpeed(ui.scanSpeed_lineEdit->text().toDouble()); }); connect(ui.return_speed_lineEdit, &QLineEdit::editingFinished, [this]() { AppSettings::instance().setReturnSpeed(ui.return_speed_lineEdit->text().toDouble()); }); + connect(ui.manualMovementSpeed_lineEdit, &QLineEdit::editingFinished, [this]() { + AppSettings::instance().setManualMovementSpeed(ui.manualMovementSpeed_lineEdit->text().toDouble()); + }); + + loadSettings(); } OneMotorControl_LiftingPlatform::~OneMotorControl_LiftingPlatform() @@ -385,6 +392,13 @@ OneMotorControl_LiftingPlatform::~OneMotorControl_LiftingPlatform() m_motorThread.wait(); } +void OneMotorControl_LiftingPlatform::loadSettings() +{ + ui.scanSpeed_lineEdit->setText(QString::number(AppSettings::instance().scanSpeed())); + ui.return_speed_lineEdit->setText(QString::number(AppSettings::instance().returnSpeed())); + ui.manualMovementSpeed_lineEdit->setText(QString::number(AppSettings::instance().manualMovementSpeed())); +} + void OneMotorControl_LiftingPlatform::onConnectMotor() { connectMotor(true); @@ -459,7 +473,7 @@ void OneMotorControl_LiftingPlatform::connectMotor(bool isNotification) void OneMotorControl_LiftingPlatform::display_x_loc(std::vector loc) { double tmp = round(loc[0] * 100) / 100; - this->ui.realTimeLoc_lineEdit->setText(QString::number(tmp)); + this->ui.realTimeLoc_label->setText(QString::number(tmp)); emit broadcastLocationSignal(loc); } @@ -509,13 +523,13 @@ void OneMotorControl_LiftingPlatform::zeroStart() void OneMotorControl_LiftingPlatform::onx_rangeMeasurement() { - double s0 = ui.speed_lineEdit->text().toDouble(); + double s0 = ui.manualMovementSpeed_lineEdit->text().toDouble(); emit rangeMeasurement(0, s0, 1000); } void OneMotorControl_LiftingPlatform::onxMove2Loc() { - double s = ui.speed_lineEdit->text().toDouble(); + double s = ui.manualMovementSpeed_lineEdit->text().toDouble(); double l = ui.move2loc_lineEdit->text().toDouble(); emit move2LocSignal(0, l, s, 1000); @@ -523,14 +537,14 @@ void OneMotorControl_LiftingPlatform::onxMove2Loc() void OneMotorControl_LiftingPlatform::onxMotorRight() { - double s = ui.speed_lineEdit->text().toDouble(); + double s = ui.manualMovementSpeed_lineEdit->text().toDouble(); emit moveSignal(0, abs(s), 1000); } void OneMotorControl_LiftingPlatform::onxMotorLeft() { - double s = ui.speed_lineEdit->text().toDouble(); + double s = ui.manualMovementSpeed_lineEdit->text().toDouble(); emit moveSignal(0, abs(s)*-1, 1000); } @@ -555,7 +569,7 @@ void OneMotorControl_LiftingPlatform::run() return; } - m_coordinator->moveToTarget(targetDepth, ui.speed_lineEdit->text().toDouble()); + m_coordinator->moveToTarget(targetDepth, ui.manualMovementSpeed_lineEdit->text().toDouble()); } void OneMotorControl_LiftingPlatform::stop() diff --git a/HPPA/OneMotorControl.h b/HPPA/OneMotorControl.h index 6c31788..a208170 100644 --- a/HPPA/OneMotorControl.h +++ b/HPPA/OneMotorControl.h @@ -92,6 +92,8 @@ private: bool m_xMotorConnectionStatus = false; QPointer m_coordinator_gonggashan_autoexpose; + + void loadSettings(); }; class OneMotorControl_LiftingPlatform : public QDialog, public MotorWindowBase @@ -152,4 +154,5 @@ private: QPointer m_coordinator; bool m_xMotorConnectionStatus = false; + void loadSettings(); }; diff --git a/HPPA/oneMotorControl.ui b/HPPA/oneMotorControl.ui index 67c981a..1407fc5 100644 --- a/HPPA/oneMotorControl.ui +++ b/HPPA/oneMotorControl.ui @@ -56,7 +56,11 @@ QLabel color: #ACCDFF; background-color: transparent; } - +QRadioButton +{ + color: #ACCDFF; + background-color: transparent; +} @@ -80,7 +84,7 @@ QLineEdit:focus { background-color: #23345c; } - + @@ -112,75 +116,8 @@ QLineEdit:focus { 10 - - - - - 0 - 0 - - - - 实时位置 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 88 - 30 - - - - 0 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - 连接 - - - - - - - - 0 - 0 - - - - 运行速度 - - - Qt::AlignCenter - - - - + 0 @@ -210,7 +147,33 @@ QLineEdit:focus { - + + + + + 0 + 0 + + + + 移动至 + + + + + + + + 0 + 0 + + + + 量程测量 + + + + @@ -223,8 +186,56 @@ QLineEdit:focus { - - + + + + + 0 + 0 + + + + ←0 + + + + + + + + 0 + 0 + + + + → + + + + + + + + 0 + 0 + + + + + 88 + 30 + + + + 0 + + + Qt::AlignCenter + + + + + 0 @@ -232,7 +243,99 @@ QLineEdit:focus { - 返回速度 + 扫描速度 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + 连接 + + + + + + + + + + + 0 + 0 + + + + 实时位置: + + + Qt::AlignCenter + + + + + + + null + + + Qt::AlignCenter + + + + + + + + + + + 0 + 0 + + + + + 88 + 30 + + + + + 16777215 + 16777215 + + + + + + + 0.1 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + 手动速度 Qt::AlignCenter @@ -261,113 +364,60 @@ QLineEdit:focus { - - + + - + 0 0 - 量程测量 - - - - - - - - 0 - 0 - - - - - 88 - 30 - - - - 0 + 返回速度 Qt::AlignCenter - - - - - 0 - 0 - - - - 移动至 - - - - - - - - 0 - 0 - - - - ←0 - - - - - - - - 0 - 0 - - - - → - - - - - - - - - 状态 - - - - - - - - 8 - 8 - - - - - 8 - 8 - - - - background-color: red; + + + + + + + + + + 反转 + + + + + + + + 8 + 8 + + + + + 8 + 8 + + + + background-color: red; border-radius: 4px; - - - - - - - + + + + + + + +