1 Star 0 Fork 0

sirli/AxleRobotOld

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
dialogprm.cpp 4.62 KB
一键复制 编辑 原始数据 按行查看 历史
sirli 提交于 2021-02-24 01:25 . base files
#include "dialogprm.h"
#include "ui_dialogprm.h"
#include "mainframdata.h"
#include "mainwindow.h"
DialogPrm::DialogPrm(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogPrm)
{
ui->setupUi(this);
UiInit();
}
DialogPrm::~DialogPrm()
{
delete ui;
}
void DialogPrm::UiInit()
{
ui->pushButton->hide();//防止鼠标自动锁定”保存按钮“
ui->dial_value->setAlignment(Qt::AlignHCenter);
ui->dial_value->setEnabled(false);
ui->lineEdit_acc->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.MotorTrapPrm.acc));
ui->lineEdit_dec->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.MotorTrapPrm.dec));
ui->lineEdit_velStart->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.MotorTrapPrm.velStart));
ui->lineEdit_smoothTime->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.MotorTrapPrm.smoothTime));
ui->comboBox_XDir->setCurrentIndex(EnvmPrm::m_MotorPara.m_HomePara.Direction[0]);
ui->comboBox_YDir->setCurrentIndex(EnvmPrm::m_MotorPara.m_HomePara.Direction[1]);
ui->comboBox_ZDir->setCurrentIndex(EnvmPrm::m_MotorPara.m_HomePara.Direction[2]);
ui->comboBox_UDir->setCurrentIndex(EnvmPrm::m_MotorPara.m_HomePara.Direction[3]);
ui->HomeSpeed->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_HomePara.HomeSpeed));
ui->SEARCH_HOME->setText(QString::number(EnvmPrm::m_MotorPara.m_HomePara.SEARCH_HOME));
ui->HOME_OFFSET->setText(QString::number(EnvmPrm::m_MotorPara.m_HomePara.HOME_OFFSET));
ui->SEARCH_INDEX->setText(QString::number(EnvmPrm::m_MotorPara.m_HomePara.SEARCH_INDEX));
ui->INDEX_OFFSET->setText(QString::number(EnvmPrm::m_MotorPara.m_HomePara.INDEX_OFFSET));
ui->checkBox->setChecked(EnvmPrm::m_MotorPara.m_MovoPara.Power);
ui->dial->setNotchesVisible(true);
ui->dial->setRange(1,10);
ui->dial->setNotchTarget(1);
ui->dial->setValue(EnvmPrm::m_MotorPara.m_MovoPara.Ratio);
ui->XSpeed_m->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[0]));
ui->YSpeed_m->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[1]));
ui->ZSpeed_m->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[2]));
ui->USpeed_m->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[3]));
ui->XSpeed_A->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[0]));
ui->YSpeed_A->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[1]));
ui->ZSpeed_A->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[2]));
ui->USpeed_A->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[3]));
}
void DialogPrm::on_btn_save_clicked()
{
EnvmPrm::m_MotorPara.MotorTrapPrm.acc=ui->lineEdit_acc->text().toDouble();
EnvmPrm::m_MotorPara.MotorTrapPrm.dec=ui->lineEdit_dec->text().toDouble();
EnvmPrm::m_MotorPara.MotorTrapPrm.velStart=ui->lineEdit_velStart->text().toDouble();
EnvmPrm::m_MotorPara.MotorTrapPrm.smoothTime=ui->lineEdit_smoothTime->text().toDouble();
EnvmPrm::m_MotorPara.m_HomePara.Direction[0]=ui->comboBox_XDir->currentIndex();
EnvmPrm::m_MotorPara.m_HomePara.Direction[1]=ui->comboBox_YDir->currentIndex();
EnvmPrm::m_MotorPara.m_HomePara.Direction[2]=ui->comboBox_ZDir->currentIndex();
EnvmPrm::m_MotorPara.m_HomePara.Direction[3]=ui->comboBox_UDir->currentIndex();
EnvmPrm::m_MotorPara.m_HomePara.HomeSpeed=ui->HomeSpeed->text().toDouble();
EnvmPrm::m_MotorPara.m_HomePara.SEARCH_HOME=ui->SEARCH_HOME->text().toDouble();
EnvmPrm::m_MotorPara.m_HomePara.SEARCH_INDEX=ui->SEARCH_INDEX->text().toDouble();
EnvmPrm::m_MotorPara.m_HomePara.INDEX_OFFSET=ui->INDEX_OFFSET->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.Power=ui->checkBox->isChecked();
EnvmPrm::m_MotorPara.m_MovoPara.Ratio=ui->dial->value();
EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[0]=ui->XSpeed_m->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[1]=ui->YSpeed_m->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[2]=ui->ZSpeed_m->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[3]=ui->USpeed_m->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[0]=ui->XSpeed_A->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[1]=ui->YSpeed_A->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[2]=ui->ZSpeed_A->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[3]=ui->USpeed_A->text().toDouble();
emit SigSaveDialogPrm();
accept();
}
void DialogPrm::on_dial_valueChanged(int value)
{
ui->dial_value->setText(QString::number(value));
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lixin3216/AxleRobotOld.git
git@gitee.com:lixin3216/AxleRobotOld.git
lixin3216
AxleRobotOld
AxleRobotOld
master

搜索帮助