This commit is contained in:
Chenwenxuan
2024-03-06 14:54:30 +08:00
commit edac2715f0
1525 changed files with 809982 additions and 0 deletions

View File

@@ -0,0 +1,448 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SerialDeviceTest</class>
<widget class="QWidget" name="SerialDeviceTest">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>726</width>
<height>413</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QScrollArea" name="scrollArea">
<property name="geometry">
<rect>
<x>11</x>
<y>11</y>
<width>671</width>
<height>371</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>669</width>
<height>369</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>功率计</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>功率计:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmbPowerMeterID">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>20</height>
</size>
</property>
<item>
<property name="text">
<string>加工功率计</string>
</property>
</item>
<item>
<property name="text">
<string>光路功率计</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>功率:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbPowerValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbPowerRead">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>读 数</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbStopRead">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>停止读数</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>气压计</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="lbBarometer">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbBarometer">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>读取数值</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="grpCuHeightFind">
<property name="title">
<string>粗测高</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="lbCuHeightFind">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbCuHeightFind">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>测 高</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>上下料测试</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QPushButton" name="pbShangLiao">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>上 料</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QPushButton" name="pbXiaLiao">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>下 料</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>光源</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QComboBox" name="cmbCameraID">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>寻边相机</string>
</property>
</item>
<item>
<property name="text">
<string>全局相机</string>
</property>
</item>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QLabel" name="lbCuHeightFind_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>亮度:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spBrightness">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="minimum">
<number>-10000</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbBrightness">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>开</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbLightOff">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>关</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,170 @@
#include "absmovesetwidget.h"
#include "rs_settings.h"
#include "deviceinfo.h"
#include "deviceproxy.h"
ABSMoveSetWidget::ABSMoveSetWidget(QWidget *parent)
:QFrame(parent)
,ui(new Ui::ABSMoveSetWidget)
{
ui->setupUi(this);
loadSet();
}
void ABSMoveSetWidget::loadSet()
{
// 加载PTP位置设置
RS_SETTINGS->beginGroup("device/ABSMove/Vel");
double XAxisVel = RS_SETTINGS->readNumDEntry("/XAxis");
double YAxisVel = RS_SETTINGS->readNumDEntry("/YAxis");
double ZAxisVel = RS_SETTINGS->readNumDEntry("/ZAxis");
double ZAAxisVel = RS_SETTINGS->readNumDEntry("/ZAAxis");
RS_SETTINGS->endGroup();
ui->dsbXAxisVel->setValue(XAxisVel);
ui->dsbYAxisVel->setValue(YAxisVel);
ui->dsbZAxisVel->setValue(ZAxisVel);
ui->dsbZAAxisVel->setValue(ZAAxisVel);
RS_SETTINGS->beginGroup("device/ABSMove/Safe");
double X1 = RS_SETTINGS->readNumDEntry("/X1");
double X2 = RS_SETTINGS->readNumDEntry("/X2");
double Y1 = RS_SETTINGS->readNumDEntry("/Y1");
double Y2 = RS_SETTINGS->readNumDEntry("/Y2");
double CompensationX1 = RS_SETTINGS->readNumDEntry("/CompensationX1");
double CompensationX2 = RS_SETTINGS->readNumDEntry("/CompensationX2");
double CompensationOffset = RS_SETTINGS->readNumDEntry("/CompensationOffset");
double CompensationMaxValue = RS_SETTINGS->readNumDEntry("/CompensationMaxValue");
RS_SETTINGS->endGroup();
ui->dsbX1->setValue(X1);
ui->dsbX2->setValue(X2);
ui->dsbY1->setValue(Y1);
ui->dsbY2->setValue(Y2);
ui->dsbCompensationX1->setValue(CompensationX1);
ui->dsbCompensationX2->setValue(CompensationX2);
ui->dsbCompensationOffset->setValue(CompensationOffset);
ui->dsbCompensationMaxValue->setValue(CompensationMaxValue);
//ui->dsbZ1->setValue(Z1);
//ui->label_9->setVisible(false);
//ui->dsbZZA->setVisible(false);
//DEV->ZZA = ZZA;
}
void ABSMoveSetWidget::on_dsbXAxisVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Vel");
RS_SETTINGS->writeEntry("/XAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("X轴绝对运动速度改变为%1mm/s").arg(value));
}
void ABSMoveSetWidget::on_dsbYAxisVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Vel");
RS_SETTINGS->writeEntry("/YAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Y轴绝对运动速度改变为%1mm/s").arg(value));
}
void ABSMoveSetWidget::on_dsbZAxisVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Vel");
RS_SETTINGS->writeEntry("/ZAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z1轴绝对运动速度改变为%1mm/s").arg(value));
}
void ABSMoveSetWidget::on_dsbZAAxisVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Vel");
RS_SETTINGS->writeEntry("/ZAAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z轴绝对运动速度改变为%1mm/s").arg(value));
}
void ABSMoveSetWidget::on_dsbX1_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Safe");
RS_SETTINGS->writeEntry("/X1", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("安全范围X1改变为%1mm/s").arg(value));
}
void ABSMoveSetWidget::on_dsbX2_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Safe");
RS_SETTINGS->writeEntry("/X2", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("安全范围X2改变为%1mm/s").arg(value));
}
void ABSMoveSetWidget::on_dsbY1_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Safe");
RS_SETTINGS->writeEntry("/Y1", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("安全范围Y1改变为%1mm/s").arg(value));
}
void ABSMoveSetWidget::on_dsbY2_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ABSMove/Safe");
RS_SETTINGS->writeEntry("/Y2", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("安全范围Y2改变为%1mm/s").arg(value));
}
//void ABSMoveSetWidget::on_dsbZZA_valueChanged(double value)
//{
// RS_SETTINGS->beginGroup("device/ABSMove/Safe");
// RS_SETTINGS->writeEntry("/ZZA", value);
// RS_SETTINGS->endGroup();
// DEVICE_INFO->printDeviceSystemInfo(QString("安全范围Z+ZA改变为%1mm/s").arg(value));
// //DEV->ZZA = value;
//}
//void ABSMoveSetWidget::on_dsbZ1_valueChanged(double arg1)
//{
// RS_SETTINGS->beginGroup("device/ABSMove/Safe");
// RS_SETTINGS->writeEntry("/Z1", arg1);
// RS_SETTINGS->endGroup();
// DEVICE_INFO->printDeviceSystemInfo(QString("加工偏差:%1mm/s").arg(arg1));
// //DEV->ZZA = value;
//}
void ABSMoveSetWidget::on_dsbCompensationX1_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/ABSMove/Safe");
RS_SETTINGS->writeEntry("/CompensationX1", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("补偿范围X1改变为%1mm/s").arg(arg1));
}
void ABSMoveSetWidget::on_dsbCompensationX2_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/ABSMove/Safe");
RS_SETTINGS->writeEntry("/CompensationX2", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("补偿范围X2改变为%1mm/s").arg(arg1));
}
void ABSMoveSetWidget::on_dsbCompensationOffset_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/ABSMove/Safe");
RS_SETTINGS->writeEntry("/CompensationOffset", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("补偿偏移改变为:%1mm/s").arg(arg1));
}
void ABSMoveSetWidget::on_dsbCompensationMaxValue_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/ABSMove/Safe");
RS_SETTINGS->writeEntry("/CompensationMaxValue", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("最大补偿值改变为:%1mm/s").arg(arg1));
}

View File

@@ -0,0 +1,44 @@
#ifndef ABSMOVESETWIDGET_H
#define ABSMOVESETWIDGET_H
#include <QFrame>
#include "ui_absmovesetwidget.h"
class ABSMoveSetWidget:public QFrame
{
Q_OBJECT
public:
explicit ABSMoveSetWidget(QWidget* parent=nullptr);
private slots:
void on_dsbXAxisVel_valueChanged(double value);
void on_dsbYAxisVel_valueChanged(double value);
void on_dsbZAxisVel_valueChanged(double value);
void on_dsbZAAxisVel_valueChanged(double value);
void on_dsbX1_valueChanged(double value);
void on_dsbX2_valueChanged(double value);
void on_dsbY1_valueChanged(double value);
void on_dsbY2_valueChanged(double value);
//void on_dsbZZA_valueChanged(double value);
//void on_dsbZ1_valueChanged(double arg1);
void on_dsbCompensationX1_valueChanged(double arg1);
void on_dsbCompensationX2_valueChanged(double arg1);
void on_dsbCompensationOffset_valueChanged(double arg1);
void on_dsbCompensationMaxValue_valueChanged(double arg1);
private:
void loadSet();
private:
Ui::ABSMoveSetWidget* ui;
};
#endif // ABSMOVESETWIDGET_H

View File

@@ -0,0 +1,793 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ABSMoveSetWidget</class>
<widget class="QWidget" name="ABSMoveSetWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>332</width>
<height>317</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>速度</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>X:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbXAxisVel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm/s</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>800.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
<item>
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Y:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbYAxisVel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm/s</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>800.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1">
<item>
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Z1:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbZAxisVel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm/s</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>200.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,1">
<item>
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Z:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbZAAxisVel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm/s</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>20.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>防撞区域设置(单位mm)</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,1">
<item>
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>X2:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbX2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="maximum">
<double>500.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_9" stretch="0,1">
<item>
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Y2:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbY2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,1">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>X1:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbX1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="maximum">
<double>500.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_8" stretch="0,1">
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Y1:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbY1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>运动补偿范围(单位mm)</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,1">
<item>
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>X1:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbCompensationX1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="maximum">
<double>500.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_10" stretch="0,1">
<item>
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>X2:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbCompensationX2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="maximum">
<double>500.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_11" stretch="0,1">
<item>
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>偏移:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbCompensationOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="maximum">
<double>500.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_12" stretch="0,1">
<item>
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Max补偿:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbCompensationMaxValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="maximum">
<double>500.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DMDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global">dmdoublespinbox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,19 @@
#include "cameradcwidget.h"
#include <QFrame>
#include <QVBoxLayout>
CameraDCWidget::CameraDCWidget(const QString& title,QWidget* parent)
:QDockWidget(title,parent)
,cameraWidget(new CameraWidget(this))
{
auto frame = new QFrame(this);
auto layout = new QVBoxLayout;
frame->setLayout(layout);
layout->setMargin(0);
layout->addWidget(cameraWidget);
setWidget(frame);
}

View File

@@ -0,0 +1,17 @@
#ifndef CAMERADCWIDGET_H
#define CAMERADCWIDGET_H
#include<QDockWidget>
#include "camerawidget.h"
#include "devicesysteminfowidget.h"
class CameraDCWidget:public QDockWidget
{
Q_OBJECT
public:
CameraDCWidget(const QString& title,QWidget* parent = nullptr);
CameraWidget *cameraWidget;
};
#endif // CAMERADCWIDGET_H

312
device/ui/camerawidget.cpp Normal file
View File

@@ -0,0 +1,312 @@
#include "camerawidget.h"
#include <QDir>
#include <QDateTime>
#include <QDebug>
#include <QMessageBox>
#include "lightsource.h"
CameraWidget::CameraWidget(QWidget *parent)
: QFrame(parent)
, ui(new Ui::CameraWidget)
{
ui->setupUi(this);
initWidget();
}
CameraWidget::~CameraWidget()
{
delete ui;
delete myImage;
if(readCameraImageThread->isRunning())
{
readCameraImageThread->requestInterruption();
readCameraImageThread->wait();
delete readCameraImageThread;
}
if(myCamera)
{
myCamera->Close();
delete myCamera;
myCamera = nullptr;
}
}
void CameraWidget::initWidget()
{
//设置窗口属性
this->setWindowTitle("相机");
//this->setWindowFlags(Qt::WindowCloseButtonHint|Qt::Dialog);
//this->setWindowModality(Qt::ApplicationModal);
//this->setFixedSize(this->width(),this->height());
// 保证QLabel 可缩放
ui->lbShow->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored);
//初始化变量
isOpenDevice = false;
//生成保存图片文件夹
QString imagePath = QDir::currentPath()+"/myImage/";
QDir dstDir(imagePath);
if(!dstDir.exists())
{
if(!dstDir.mkdir(imagePath))
{
qDebug()<<"创建Image文件夹失败"<<endl;
}
}
//图像指针对象
myImage = new Mat();
readCameraImageThread = new ReadCameraImageThread();
connect(readCameraImageThread,SIGNAL(messageSGL()),this,SLOT(slotDisplay()));
connect(readCameraImageThread,SIGNAL(messageImageSGL(QImage)),this,SLOT(slotDisplayImage(QImage)));
on_pbFind_clicked();
on_pbOpen_clicked();
}
void CameraWidget::saveImage(QString format)
{
if(ui->lbShow->pixmap() == nullptr)
{
QMessageBox::warning(this,"警告","保存失败,未采集到图像");
return;
}
QString savePath = QDir::currentPath()+"/myImage/";
QString imagePath = QDir::currentPath()+"/myImage/";
QString curDate = QDateTime::currentDateTime().toString("yyyyMMdd-hhmmss.zzz");
QString saveName = savePath + curDate + "." + format;
const QPixmap *curImage = ui->lbShow->pixmap();
qDebug() <<"saveName:"<<saveName;
if(curImage->save(saveName))
{
qDebug()<<"保存成功!";
}
else
{
qDebug()<<"保存失败!";
}
}
// 显示单张图像
void CameraWidget::display(const Mat* imagePtr)
{
qDebug()<<"single display ok"<<endl;
// 判断是黑白、彩色
QImage* qMyImage = new QImage();
if(imagePtr->channels()>1)
{
*qMyImage = QImage((const unsigned char*)(imagePtr->data),imagePtr->cols,imagePtr->rows,QImage::Format_RGB888);
}
else
{
*qMyImage = QImage((const unsigned char*)(imagePtr->data),imagePtr->cols,imagePtr->rows,QImage::Format_Indexed8);
}
*qMyImage = (*qMyImage).scaled(ui->lbShow->size(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
//显示图像
ui->lbShow->setPixmap(QPixmap::fromImage(*qMyImage));
delete qMyImage;
}
void CameraWidget::slotDisplay()
{
qDebug()<<"continuous display ok";
QImage* qMyImage = new QImage();
if(myImage->channels()>1)
{
*qMyImage = QImage((const unsigned char*)(myImage->data),myImage->cols,myImage->rows,QImage::Format_RGB888);
}
else
{
*qMyImage = QImage((const unsigned char*)(myImage->data),myImage->cols,myImage->rows,QImage::Format_Indexed8);
}
*qMyImage = (*qMyImage).scaled(ui->lbShow->size(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
//显示图像
ui->lbShow->setPixmap(QPixmap::fromImage(*qMyImage));
delete qMyImage;
}
void CameraWidget::slotDisplayImage(QImage myImage)
{
myImage = myImage.scaled(ui->lbShow->size(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
ui->lbShow->setPixmap(QPixmap::fromImage(myImage));
}
void CameraWidget::on_pbFind_clicked()
{
ui->cbDevices->clear();
memset(&deviceList,0,sizeof (MV_CC_DEVICE_INFO_LIST));
// 枚举子网内所有设备
int nRet = CMvCamera::EnumDevices(MV_GIGE_DEVICE | MV_USB_DEVICE,&deviceList);
if(MV_OK != nRet)
{
return;
}
for(unsigned int i=0; i<deviceList.nDeviceNum;i++)
{
MV_CC_DEVICE_INFO* pDeviceInfo = deviceList.pDeviceInfo[i];
QString strModelName = "";
if(pDeviceInfo->nTLayerType == MV_USB_DEVICE)
{
strModelName = (char*)pDeviceInfo->SpecialInfo.stUsb3VInfo.chModelName;
}
else if(pDeviceInfo->nTLayerType == MV_GIGE_DEVICE)
{
strModelName = (char*)pDeviceInfo->SpecialInfo.stGigEInfo.chModelName;
}
else
{
QMessageBox::warning(this,"警告","未知设备枚举");
return;
}
qDebug()<<"strModelName: "<<strModelName;
ui->cbDevices->addItem(strModelName);
}
}
void CameraWidget::on_pbOpen_clicked()
{
if(isOpenDevice)
{
return;
}
QString deviceModel = ui->cbDevices->currentText();
if(deviceModel == "")
{
//QMessageBox::warning(this,"警告","请选择设备");
return;
}
myCamera = CAMERAFIND;
if(nullptr==myCamera)
{
return;
}
int nIndex = ui->cbDevices->currentIndex();
//打开设备
int nRet = myCamera->Open(deviceList.pDeviceInfo[nIndex]);
qDebug()<<"Connect: "<<nRet<<endl;
if(MV_OK != nRet)
{
delete myCamera;
myCamera = nullptr;
QMessageBox::warning(this,"警告","打开设备失败!");
return;
}
qDebug()<<"TriggerMode:"<<myCamera->SetEnumValue("TriggerMode",1);
qDebug()<<"TriggerSource:"<<myCamera->SetEnumValue("TriggerSource",7);
qDebug()<<"SetExposureTime:"<<myCamera->SetFloatValue("ExposureTime",myCamera->ExposureTime);
qDebug()<<"StartCamera:"<<myCamera->StartGrabbing();
readCameraImageThread->getCameraPtr(myCamera);
readCameraImageThread->getImagePtr(myImage);
isOpenDevice = true;
ui->lbShow->setText("打开设备成功!");
}
void CameraWidget::on_pbClose_clicked()
{
if(myCamera)
{
on_pbStop_clicked();
myCamera->Close();
delete myCamera;
myCamera = nullptr;
isOpenDevice = false;
}
}
void CameraWidget::on_pbSingle_clicked()
{
if(!isOpenDevice)
{
QMessageBox::warning(this,"警告","采集失败,请打开设备!");
return;
}
LIGHTSOURCEFIND->LightOn(4);
Sleep(20);
Mat *image =new Mat();
//qDebug()<<"single SoftTriger:"<<myCamera->CommandExecute("TriggerSoftware");
// qDebug()<<"single ReadBuffer:"<<myCamera->ReadBuffer(*image);
myCamera->GetImage(*image,false);
display(image);
LIGHTSOURCEFIND->LightOff(4);
delete image;
}
void CameraWidget::on_pbStart_clicked()
{
if(!isOpenDevice)
{
QMessageBox::warning(this,"警告","采集失败,请打开设备!");
return;
}
LIGHTSOURCEFIND->LightOn(4);
Sleep(20);
if(!readCameraImageThread->isRunning())
{
readCameraImageThread->start();
}
}
void CameraWidget::on_pbStop_clicked()
{
if(readCameraImageThread->isRunning())
{
readCameraImageThread->requestInterruption();
readCameraImageThread->wait();
LIGHTSOURCEFIND->LightOff(1);
}
}
void CameraWidget::on_pbSaveBmp_clicked()
{
saveImage("bmp");
}
//void CameraWidget::on_pbSavePng_clicked()
//{
// saveImage("png");
//}
void CameraWidget::on_pbEnableOrDisableCrossHairLine_clicked()
{
if("开十字线"==ui->pbEnableOrDisableCrossHairLine->text())
{
readCameraImageThread->setEnableCrossHairLine(true);
ui->pbEnableOrDisableCrossHairLine->setText("关十字线");
}
else
{
readCameraImageThread->setEnableCrossHairLine(false);
ui->pbEnableOrDisableCrossHairLine->setText("开十字线");
}
}
void CameraWidget::on_pbSavePNG_clicked()
{
saveImage("png");
}

44
device/ui/camerawidget.h Normal file
View File

@@ -0,0 +1,44 @@
#ifndef CAMERAWIDGET_H
#define CAMERAWIDGET_H
#include <QFrame>
#include "cmvcamera.h"
#include "readcameraimagethread.h"
#include "ui_camerawidget.h"
class CameraWidget: public QFrame
{
Q_OBJECT
public:
CameraWidget(QWidget *parent = nullptr);
~CameraWidget();
void initWidget();
void saveImage(QString format);
void display(const Mat* magePtr);
private slots:
void slotDisplay();
void slotDisplayImage(QImage myImage);
void on_pbFind_clicked();
void on_pbOpen_clicked();
void on_pbClose_clicked();
void on_pbSingle_clicked();
void on_pbStart_clicked();
void on_pbStop_clicked();
void on_pbSaveBmp_clicked();
//void on_pbSavePng_clicked();
void on_pbEnableOrDisableCrossHairLine_clicked();
void on_pbSavePNG_clicked();
private:
Ui::CameraWidget *ui;
bool isOpenDevice{false};
MV_CC_DEVICE_INFO_LIST deviceList;
CMvCamera *myCamera = nullptr;
Mat *myImage = nullptr;
ReadCameraImageThread *readCameraImageThread = nullptr;
};
#endif // CAMERAWIDGET_H

226
device/ui/camerawidget.ui Normal file
View File

@@ -0,0 +1,226 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CameraWidget</class>
<widget class="QWidget" name="CameraWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>337</width>
<height>454</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>CameraWidget</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0">
<item>
<widget class="QWidget" name="widget" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>220</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,10">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>设备型号:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cbDevices">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="lbShow">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>设备</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="pbFind">
<property name="text">
<string>查找设备</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbOpen">
<property name="text">
<string>打开设备</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbClose">
<property name="text">
<string>关闭设备</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>采集</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="pbSingle">
<property name="text">
<string>单次采集</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbStart">
<property name="text">
<string>连续采集</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbStop">
<property name="text">
<string>停止采集</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>保存</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,1,1">
<item>
<widget class="QPushButton" name="pbSaveBmp">
<property name="text">
<string>保存BMP</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbSavePNG">
<property name="text">
<string>保存PNG</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>其它</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="1,2">
<item>
<widget class="QPushButton" name="pbEnableOrDisableCrossHairLine">
<property name="text">
<string>关十字线</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>244</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

383
device/ui/dd_motor_test.cpp Normal file
View File

@@ -0,0 +1,383 @@
#include"dd_motor_test.h"
#include "deviceinfo.h"
#include "rs_settings.h"
#include "deviceproxy.h"
#include <QDebug>
dd_motor_test_widget::dd_motor_test_widget(QWidget *parent):
QFrame(parent),
ui(new Ui::dd_motor_test_widget)
{
ui->setupUi(this);
// 获取文本光标(不是鼠标光标)
init();
}
dd_motor_test_widget::~dd_motor_test_widget()
{
delete ui;
}
void dd_motor_test_widget::init()
{
limit_state[0] = NORMAL;
limit_state[1] = NORMAL;
limit_state[2] = NORMAL;
enable_state = 0;
loadSet();
updateEnablePBStyleSheet(0);
// 使能状态变化信号和槽连接
connect(DEV,SIGNAL(DDEnableStateSGL(int)),this,SLOT(updateEnablePBStyleSheet(int)));
// 限位状态变化信号和槽连接
connect(DEV,SIGNAL(DDLimitStateSGL(int ,LIMIT_STATE)),this,SLOT(updatePBStyleSheet(int ,LIMIT_STATE)));
return;
}
void dd_motor_test_widget::loadSet()
{
RS_SETTINGS->beginGroup("device/DDMotor");
double dsbStepDDt = RS_SETTINGS->readNumDEntry("/step");
double dsbVelDD = RS_SETTINGS->readNumDEntry("/Vel");
int index_moter = RS_SETTINGS->readNumEntry("/motor");
int index_mode = RS_SETTINGS->readNumEntry("/mode");
RS_SETTINGS->endGroup();
ui->dsbStepDD->setValue(dsbStepDDt);
ui->dsbVelDD->setValue(dsbVelDD);
ui->cmbMotor->setCurrentIndex(index_moter);
ui->cmbMoveMode->setCurrentIndex(index_mode);
RS_SETTINGS->beginGroup("device/LaserMark");
double dsbZ0Offset = RS_SETTINGS->readNumDEntry("/Z0Offset");
double dsbZ2Offset = RS_SETTINGS->readNumDEntry("/Z2Offset");
RS_SETTINGS->endGroup();
ui->dsbZ0Offset->setValue(dsbZ0Offset);
ui->dsbZ2Offset->setValue(dsbZ2Offset);
return;
}
void dd_motor_test_widget::on_cmbMoveMode_currentIndexChanged(int index)
{
if (index == 2)
{
ui->dsbStepDD->setMinimum(-50);
}
else
{
ui->dsbStepDD->setMinimum(0);
}
RS_SETTINGS->beginGroup("device/DDMotor");
RS_SETTINGS->writeEntry("/mode", index);
RS_SETTINGS->endGroup();
}
void dd_motor_test_widget::on_dsbStepDD_valueChanged(double value)
{
//if (ui->cmbMoveMode->currentIndex() != 0)
{
RS_SETTINGS->beginGroup("device/DDMotor");
RS_SETTINGS->writeEntry("/step", value);
RS_SETTINGS->endGroup();
if (ui->cmbMoveMode->currentIndex() == 1)
DEVICE_INFO->printDeviceSystemInfo(QString("相对运动定位值改变为:%1mm").arg(value));
else if (ui->cmbMoveMode->currentIndex() == 2)
DEVICE_INFO->printDeviceSystemInfo(QString("绝对运动定位值改变为:%1mm").arg(value));
}
}
void dd_motor_test_widget::on_pbVelM10_clicked()
{
ui->dsbVelDD->setValue(ui->dsbVelDD->value()*10);
}
void dd_motor_test_widget::on_pbVelD10_clicked()
{
ui->dsbVelDD->setValue(ui->dsbVelDD->value()/10);
}
void dd_motor_test_widget::on_dsbVelDD_valueChanged(double value)
{
{
RS_SETTINGS->beginGroup("device/DDMotor");
RS_SETTINGS->writeEntry("/Vel", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("速度改变完成,当前速度为:%1mm/s").arg(value));
}
}
void dd_motor_test_widget::updateEnablePBStyleSheet(int state)
{
bool flag = false;
flag = state & (1 << ui->cmbMotor->currentIndex());
enable_state = state;
if(flag)
{
ui->pbEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 20px;\n"
" border-style: outset; \n"
" background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.772727 rgba(0, 178, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" \n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.392045 rgba(0, 160, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" \n"
" }"));
}
else
{
ui->pbEnable->setStyleSheet(QString::fromUtf8("QPushButton {\n"
" color: #333;\n"
" border: 2px solid #555;\n"
" border-radius: 20px;\n"
" border-style: outset;\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.693182 rgba(159, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" padding: 5px;\n"
" color: rgb(255, 255, 255);\n"
" }\n"
"\n"
"QPushButton:hover {\n"
" background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.573864 rgba(195, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n"
" }"));
}
}
void dd_motor_test_widget::updatePBStyleSheet(int motor,LIMIT_STATE state)
{
if ((motor >= 0) && (motor <= 2))
{
limit_state[motor] = state;
}
if (ui->cmbMotor->currentIndex() != motor)
return;
switch (state)
{
case LEFT_LIMIT:
ui->pbMoveN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(197, 25, 9);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 10, 2);\n"
"}"));
break;
case RIGHT_LIMIT:
ui->pbMoveP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(197, 25, 9);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 10, 2);\n"
"}"));
break;
case LEFT_SLIMIT:
ui->pbMoveN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(255, 235, 12);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 255, 127);\n"
"}\n"));
break;
case RIGHT_SLIMIT:
ui->pbMoveP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(255, 235, 12);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(255, 255, 127);\n"
"}\n"));
break;
case NORMAL:
ui->pbMoveP->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(0, 160, 0);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 180, 0);\n"
"}\n"));
ui->pbMoveN->setStyleSheet(QString::fromUtf8("QPushButton {\n"
"color: #333;\n"
"border: 1px solid #555;\n"
"border-radius: 2px;\n"
"border-style: outset;\n"
"background-color: rgb(0, 160, 0);\n"
"padding: 5px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: rgb(0, 180, 0);\n"
"}\n"));
break;
}
}
void dd_motor_test_widget::on_cmbMotor_currentIndexChanged(int index)
{
RS_SETTINGS->beginGroup("device/DDMotor");
RS_SETTINGS->writeEntry("/motor", index);
RS_SETTINGS->endGroup();
updateEnablePBStyleSheet(enable_state);
updatePBStyleSheet(index,limit_state[index]);
}
void dd_motor_test_widget::on_pbMoveP_pressed()
{
if(ui->cmbMoveMode->currentIndex() == 0)
{
connect(ui->pbMoveP,SIGNAL(released()),this,SLOT(pbMovePReleasedHandl()));
if(ui->cmbMotor->currentIndex() == 0)
{
DEV->DAxisCMoveP();
}
if(ui->cmbMotor->currentIndex() == 1)
{
DEV->Z0AxisCMoveP();
}
if(ui->cmbMotor->currentIndex() == 2)
{
DEV->Z2AxisCMoveP();
}
}
else if(ui->cmbMoveMode->currentIndex() == 1)
{
if(ui->cmbMotor->currentIndex() == 0)
{
DEV->DAxisSMoveP();
}
if(ui->cmbMotor->currentIndex() == 1)
{
DEV->Z0AxisSMoveP();
}
if(ui->cmbMotor->currentIndex() == 2)
{
DEV->Z2AxisSMoveP();
}
}
else
{
DEV->ABSMove_DZ0Z2();
}
}
void dd_motor_test_widget::pbMovePReleasedHandl()
{
disconnect(ui->pbMoveP,SIGNAL(released()),this,SLOT(pbMovePReleasedHandl()));
if(ui->cmbMotor->currentIndex() == 0)
DEV->DAxisCMovePEnd();
if(ui->cmbMotor->currentIndex() == 1)
DEV->Z0AxisCMovePEnd();
if(ui->cmbMotor->currentIndex() == 2)
DEV->Z2AxisCMovePEnd();
}
void dd_motor_test_widget::on_pbMoveN_pressed()
{
if(ui->cmbMoveMode->currentIndex() == 0)
{
connect(ui->pbMoveN,SIGNAL(released()),this,SLOT(pbMoveNReleasedHandl()));
if(ui->cmbMotor->currentIndex() == 0)
{
DEV->DAxisCMoveN();
}
if(ui->cmbMotor->currentIndex() == 1)
{
DEV->Z0AxisCMoveN();
}
if(ui->cmbMotor->currentIndex() == 2)
{
DEV->Z2AxisCMoveN();
}
}
else if(ui->cmbMoveMode->currentIndex() == 1)
{
if(ui->cmbMotor->currentIndex() == 0)
{
DEV->DAxisSMoveN();
}
if(ui->cmbMotor->currentIndex() == 1)
{
DEV->Z0AxisSMoveN();
}
if(ui->cmbMotor->currentIndex() == 2)
{
DEV->Z2AxisSMoveN();
}
}
else
{
DEV->ABSMove_DZ0Z2();
}
}
void dd_motor_test_widget::pbMoveNReleasedHandl()
{
disconnect(ui->pbMoveN,SIGNAL(released()),this,SLOT(pbMoveNReleasedHandl()));
if(ui->cmbMotor->currentIndex() == 0)
DEV->DAxisCMoveNEnd();
if(ui->cmbMotor->currentIndex() == 1)
DEV->Z0AxisCMoveNEnd();
if(ui->cmbMotor->currentIndex() == 2)
DEV->Z2AxisCMoveNEnd();
}
void dd_motor_test_widget::on_pbEnable_clicked()
{
if(ui->cmbMotor->currentIndex() == 0)
DEV->enableDisableDAxis();
if(ui->cmbMotor->currentIndex() == 1)
DEV->enableDisableZ0Axis();
if(ui->cmbMotor->currentIndex() == 2)
DEV->enableDisableZ2Axis();
}
void dd_motor_test_widget::on_dsbZ0Offset_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/LaserMark");
RS_SETTINGS->writeEntry("/Z0Offset", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z0轴工作位置改变完成当前位置为%1mm").arg(value));
}
void dd_motor_test_widget::on_dsbZ2Offset_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/LaserMark");
RS_SETTINGS->writeEntry("/Z2Offset", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴工作位置改变完成当前位置为%1mm").arg(value));
}

53
device/ui/dd_motor_test.h Normal file
View File

@@ -0,0 +1,53 @@
#ifndef DDMOTORTEST_H
#define DDMOTORTEST_H
#include <QFrame>
#include <QTextCursor>
#include "ui_dd_motor_test.h"
#include "base.h"
class dd_motor_test_widget:public QFrame
{
Q_OBJECT
public:
explicit dd_motor_test_widget(QWidget* parent=nullptr);
~dd_motor_test_widget();
private:
void init();
void loadSet();
private slots:
void on_cmbMoveMode_currentIndexChanged(int index);
void on_dsbStepDD_valueChanged(double value);
void on_pbVelM10_clicked();
void on_pbVelD10_clicked();
void on_dsbVelDD_valueChanged(double value);
void updateEnablePBStyleSheet(int state);
void updatePBStyleSheet(int motor,LIMIT_STATE state);
void on_cmbMotor_currentIndexChanged(int index);
void on_pbMoveP_pressed();
void pbMovePReleasedHandl();
void pbMoveNReleasedHandl();
void on_pbMoveN_pressed();
void on_pbEnable_clicked();
void on_dsbZ0Offset_valueChanged(double value);
void on_dsbZ2Offset_valueChanged(double value);
private:
Ui::dd_motor_test_widget* ui;
LIMIT_STATE limit_state[3];
int enable_state;
};
#endif // DEVICEALARM_H

691
device/ui/dd_motor_test.ui Normal file
View File

@@ -0,0 +1,691 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dd_motor_test_widget</class>
<widget class="QWidget" name="dd_motor_test_widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>762</width>
<height>376</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>738</width>
<height>352</height>
</rect>
</property>
<property name="contextMenuPolicy">
<enum>Qt::PreventContextMenu</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>模式选择</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="text">
<string>电机选择:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmbMotor">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<item>
<property name="text">
<string>DD马达</string>
</property>
</item>
<item>
<property name="text">
<string>Z0</string>
</property>
</item>
<item>
<property name="text">
<string>Z2</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="text">
<string>运动模式:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmbMoveMode">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<item>
<property name="text">
<string>连续运动</string>
</property>
</item>
<item>
<property name="text">
<string>相对位置运动</string>
</property>
</item>
<item>
<property name="text">
<string>绝对位置运动</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>运行操作</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_14">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>预测量偏移:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbZ0Offset">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>200.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QPushButton" name="pbMoveP">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
color: #333;
border: 1px solid #555;
border-radius: 2px;
border-style: outset;
color:rgb(255,255,255);
background-color: rgb(0, 160, 0);
padding: 5px;
}
QPushButton:hover {
background-color: rgb(0, 180, 0);
}</string>
</property>
<property name="text">
<string>正 向</string>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbStepDD">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>-50.000000000000000</double>
</property>
<property name="maximum">
<double>200.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbMoveN">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
color: #333;
border: 1px solid #555;
border-radius: 2px;
border-style: outset;
color:rgb(255,255,255);
background-color: rgb(0, 160, 0);
padding: 5px;
}
QPushButton:hover {
background-color: rgb(0, 180, 0);
}</string>
</property>
<property name="text">
<string>负 向</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_14">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>打标偏移:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbZ2Offset">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>200.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>速度及使能</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>速度:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbVelDD">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm/s</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>200.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbVelM10">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>x10</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbVelD10">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>/10</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pbEnable">
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
color: #333;
border: 2px solid #555;
border-radius: 20px;
border-style: outset;
background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.772727 rgba(0, 178, 0, 255), stop:1 rgba(255, 255, 255, 255));
padding: 5px;
color: rgb(255, 255, 255);
}
QPushButton:hover {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0.392045 rgba(0, 160, 0, 255), stop:1 rgba(255, 255, 255, 255));
}</string>
</property>
<property name="text">
<string>E</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DMDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global">dmdoublespinbox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,19 @@
#include "dd_motor_test_dc.h"
#include <QFrame>
#include <QVBoxLayout>
dd_motor_test_dc_widget::dd_motor_test_dc_widget(const QString& title,QWidget* parent)
:QDockWidget(title,parent)
,pdd_motor_test_widget(new dd_motor_test_widget(this))
{
auto frame = new QFrame(this);
auto layout = new QVBoxLayout;
frame->setLayout(layout);
layout->setMargin(0);
layout->addWidget(pdd_motor_test_widget);
setWidget(frame);
}

View File

@@ -0,0 +1,16 @@
#ifndef DDMOTORTESTDCWIDGET_H
#define DDMOTORTESTDCWIDGET_H
#include<QDockWidget>
#include "dd_motor_test.h"
class dd_motor_test_dc_widget:public QDockWidget
{
Q_OBJECT
public:
dd_motor_test_dc_widget(const QString& title,QWidget* parent = nullptr);
dd_motor_test_widget * pdd_motor_test_widget;
};
#endif // CAMERADCWIDGET_H

View File

@@ -0,0 +1,44 @@
#include "devecectluserwidget.h"
#include "ui_devecectluserwidget.h"
#include "rs_settings.h"
#include "deviceproxy.h"
#include "modbustcp.h"
#include "deviceinfo.h"
#include <QFileDialog>
#include "login.h"
#include "qc_applicationwindow.h"
DeveceCtlUserWidget::DeveceCtlUserWidget(QWidget *parent) :
QFrame(parent),
ui(new Ui::DeveceCtlUserWidget)
{
ui->setupUi(this);
}
DeveceCtlUserWidget::~DeveceCtlUserWidget()
{
delete ui;
}
void DeveceCtlUserWidget::on_pbVacuumSuckerOnOrOff_clicked()
{
if (DEV->devWorkpieceLockState == 0)
{
DEV->vacuumSuckerOpen();
DEV->VacuumBreakClose();
}
else
{
DEV->vacuumSuckerClose();
DEV->VacuumBreakOpen();
}
DEV->workpieceHeight = DEV->Palletheight + MAXHEIGHT;
}
void DeveceCtlUserWidget::on_pbLoadAndUnloadPos_clicked()
{
DEV->toLoadAndUnloadPos();
}

View File

@@ -0,0 +1,36 @@
#ifndef DEVECECTLUSERWIDGET_H
#define DEVECECTLUSERWIDGET_H
#include <QFrame>
#include "myexception.h"
#include "base.h"
#include <QMessageBox>
#include <QTextCursor>
#include <QMap>
namespace Ui {
class DeveceCtlUserWidget;
}
class DeveceCtlUserWidget : public QFrame
{
Q_OBJECT
public:
explicit DeveceCtlUserWidget(QWidget *parent = nullptr);
~DeveceCtlUserWidget();
private slots:
void on_pbVacuumSuckerOnOrOff_clicked();
void on_pbLoadAndUnloadPos_clicked();
private:
Ui::DeveceCtlUserWidget *ui;
};
#endif // DEVECECTLUSERWIDGET_H

View File

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeveceCtlUserWidget</class>
<widget class="QWidget" name="DeveceCtlUserWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>182</width>
<height>705</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
</font>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(253, 253, 253);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="pbVacuumSuckerOnOrOff">
<property name="minimumSize">
<size>
<width>0</width>
<height>90</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(253, 253, 253);</string>
</property>
<property name="text">
<string>样品释放</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbLoadAndUnloadPos">
<property name="minimumSize">
<size>
<width>0</width>
<height>90</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(253, 253, 253);</string>
</property>
<property name="text">
<string>手动上料</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>498</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,16 @@
#include "devicealarmdcwidget.h"
#include <QVBoxLayout>
DeviceAlarmDCWidget::DeviceAlarmDCWidget(const QString& title,QWidget* parent)
:QDockWidget(title,parent)
,deviceAlarmWidget(new DeviceAlarmWidget(this))
{
auto frame = new QFrame(this);
auto layout = new QVBoxLayout;
frame->setLayout(layout);
layout->setMargin(0);
layout->addWidget(deviceAlarmWidget);
setWidget(frame);
}

View File

@@ -0,0 +1,19 @@
#ifndef DEVICEDCALARMWIDGET_H
#define DEVICEDCALARMWIDGET_H
#include "devicealarmwidget.h"
#include <QDockWidget>
class DeviceAlarmDCWidget: public QDockWidget
{
Q_OBJECT
public:
DeviceAlarmDCWidget(const QString& title,QWidget* parent = nullptr);
protected:
DeviceAlarmWidget* deviceAlarmWidget;
};
#endif // DEVICEDCALARMWIDGET_H

View File

@@ -0,0 +1,58 @@
#include"devicealarmwidget.h"
#include "deviceinfo.h"
#include <QDebug>
DeviceAlarmWidget::DeviceAlarmWidget(QWidget *parent):
QFrame(parent),
ui(new Ui::DeviceAlarmWidget)
{
ui->setupUi(this);
// 获取文本光标(不是鼠标光标)
cursorPosition = ui->textEdit->textCursor();
connect(DEVICE_INFO,SIGNAL(deviceSalamInfoSGL(const QString,SYS_INFO_LEVEL)),this,SLOT(insertInformationToText(const QString&,SYS_INFO_LEVEL)));
}
DeviceAlarmWidget::~DeviceAlarmWidget()
{
delete ui;
}
void DeviceAlarmWidget::insertInformationToText(const QString text,SYS_INFO_LEVEL level)
{
//光标移动到文档首部
cursorPosition.movePosition(QTextCursor::Start,QTextCursor::MoveAnchor);
//插入换行符
cursorPosition.insertText("\n");
//光标移动到文档首部
cursorPosition.movePosition(QTextCursor::Start,QTextCursor::MoveAnchor);
//插入信息
cursorPosition.insertText(text);
//选中该行文字
cursorPosition.movePosition(QTextCursor::Start,QTextCursor::MoveAnchor);
//qDebug()<<"------salam text.length(): "<<text.length()<<endl;
cursorPosition.setPosition(cursorPosition.position() + text.length(),QTextCursor::KeepAnchor);
// 只选单词,不选数字
//cursorPosition.select(QTextCursor::WordUnderCursor);
//cursorPosition.select(QTextCursor::LineUnderCursor);
cursorPosition.select(QTextCursor::BlockUnderCursor);
QTextCharFormat fmt;
switch (level)
{
case D_NOTHING:
fmt.setForeground(QColor(0, 160, 0));
break;
case D_WARNING:
fmt.setForeground(QColor(220, 160, 14));
break;
case D_CRITICAL:
fmt.setForeground(QColor(180, 53, 21));
break;
}
// 把格式应用到光标所处在的字符上
cursorPosition.mergeCharFormat(fmt);
cursorPosition.clearSelection(); //撤销选中
}

View File

@@ -0,0 +1,27 @@
#ifndef DEVICEALARMWIDGET_H
#define DEVICEALARMWIDGET_H
#include <QFrame>
#include <QTextCursor>
#include "ui_devicealarmwidget.h"
#include "base.h"
class DeviceAlarmWidget:public QFrame
{
Q_OBJECT
public:
explicit DeviceAlarmWidget(QWidget* parent=nullptr);
~DeviceAlarmWidget();
public slots:
void insertInformationToText(const QString text,SYS_INFO_LEVEL level);
private:
Ui::DeviceAlarmWidget* ui;
QTextCursor cursorPosition;
};
#endif // DEVICEALARM_H

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeviceAlarmWidget</class>
<widget class="QWidget" name="DeviceAlarmWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>437</width>
<height>220</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTextEdit" name="textEdit">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'SimSun';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'SimSun';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,18 @@
#include "devicecontrolpaneldcwidget.h"
#include <QVBoxLayout>
#include <QDebug>
DeviceControlPanelDCWidget::DeviceControlPanelDCWidget(const QString& title,QWidget* parent)
:QDockWidget(title,parent)
,deviceControlPanelWidget(new DeviceControlPanelWidget(this))
{
auto frame = new QFrame(this);
auto layout = new QVBoxLayout;
frame->setLayout(layout);
layout->setMargin(0);
layout->addWidget(deviceControlPanelWidget);
setWidget(frame);
}

View File

@@ -0,0 +1,18 @@
#ifndef DEVICECONTROLPANELDCWIDGET_H
#define DEVICECONTROLPANELDCWIDGET_H
#include "devicecontrolpanelwidget.h"
#include <QDockWidget>
class DeviceControlPanelDCWidget: public QDockWidget
{
Q_OBJECT
public:
DeviceControlPanelDCWidget(const QString& title,QWidget* parent = nullptr);
protected:
DeviceControlPanelWidget* deviceControlPanelWidget;
};
#endif // DEVICECONTROLPANELDCWIDGET_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,220 @@
#ifndef DEVICECONTROLPANELWIDGET_H
#define DEVICECONTROLPANELWIDGET_H
#include <QFrame>
#include "myexception.h"
#include "base.h"
#include <QMessageBox>
#include "ui_devicecontrolpanelwidget.h"
#include <QMap>
class DeviceControlPanelWidget:public QFrame
{
Q_OBJECT
public:
explicit DeviceControlPanelWidget(QWidget* parent=nullptr);
~DeviceControlPanelWidget();
private:
void init();
void loadSet();
private slots:
//使能
void on_pbXEnable_clicked();
void on_pbYEnable_clicked();
void on_pbZEnable_clicked();
void on_pbZAEnable_clicked();
// 设置轴速度
void on_dsbXAxisRMoveVel_valueChanged(double vel);
void on_dsbYAxisRMoveVel_valueChanged(double vel);
void on_dsbZAxisRMoveVel_valueChanged(double vel);
void on_dsbZAAxisRMoveVel_valueChanged(double vel);
// 相对移动
void rbContinuedOrRbSingleStepClickedHandl();
void on_dsbRMoveStepDist_valueChanged(double value);
void on_pbXAxisP_pressed();
void on_pbXAxisN_pressed();
void on_pbYAxisP_pressed();
void on_pbYAxisN_pressed();
void on_pbZAxisP_pressed();
void on_pbZAxisN_pressed();
void on_pbZAAxisP_pressed();
void on_pbZAAxisN_pressed();
void pbXAxisPReleasedHandl();
void pbXAxisNReleasedHandl();
void pbYAxisPReleasedHandl();
void pbYAxisNReleasedHandl();
void pbZAxisPReleasedHandl();
void pbZAxisNReleasedHandl();
void pbZAAxisPReleasedHandl();
void pbZAAxisNReleasedHandl();
//绝对
void on_cbABSXAxisIsMove_clicked();
void on_cbABSYAxisIsMove_clicked();
void on_cbABSZAxisIsMove_clicked();
void on_cbABSZAAxisIsMove_clicked();
void on_dsbXAxisABSPos_valueChanged(double value);
void on_dsbYAxisABSPos_valueChanged(double value);
void on_dsbZAxisABSPos_valueChanged(double value);
void on_dsbZAAxisABSPos_valueChanged(double value);
void on_pbABSMove_clicked();
//相机、测距头、加工头位置转换
void on_pbMHToCamera_clicked();
void on_pbRHToCamera_clicked();
void on_pbCameraToMH_clicked();
void on_pbCameraToRH_clicked();
void on_pbRHToMH_clicked();
void on_pbMHToRH_clicked();
//操作
void on_pbDEVInit_clicked();
//void on_pbReset_clicked();
void on_pbEStop_clicked();
void on_pbStop_clicked();
void on_pbSemiAutoMach_clicked();
// 对零
void on_pbRangeSensorToZero_clicked();
// 面扫描补偿
void on_pbCompSurfaceScan_clicked();
// // 面扫描
// void on_pbSurfaceScan_clicked();
// 补偿开关pbMHOnOrOff
void on_pbMHCompOnOrOff_clicked();
// void on_pbRHCompOnOrOff_clicked();
// 真空吸盘开关
void on_pbVacuumSuckerOnOrOff_clicked();
// 激光器操控
void on_pbLaserOnOrOff_clicked();
// 更新轴使能状态
void updateXAxisEnablePBStyleSheet(bool state);
void updateYAxisEnablePBStyleSheet(bool state);
void updateZAxisEnablePBStyleSheet(bool state);
void updateZAAxisEnablePBStyleSheet(bool state);
//更新登录权限
void updateLogInPower(bool state);
void updateEStopPBStyleSheet(bool state);
void updateDEVInitPBStyleSheet(bool state);
//void updateResetPBStyleSheet(bool state);
void updateXAxisPBStyleSheet(LIMIT_STATE state);
void updateYAxisPBStyleSheet(LIMIT_STATE state);
void updateZAxisPBStyleSheet(LIMIT_STATE state);
void updateZAAxisPBStyleSheet(LIMIT_STATE state);
void updatePBStyleSheet(bool state);
//void on_pbMachCodeBrowse_clicked();
void on_pbLoadAndUnloadPos_clicked();
//void on_pbSScanStartPos_clicked();
void on_pbRSToZeroPos_clicked();
//void on_pbMachStartPos_clicked();
//更新加工状态
void updatePbSemiAutoMachStyleSheet(bool state);
void updatePbStopStyleSheet(bool state);
void updateCmbType(bool state);
void updateVacuumSuckerOnOrOff(bool state);
void GetRunType();
// Z轴到常用位置
//void on_pbZAAxisCPMove_clicked();
void on_pbXAxisRMoveVelM10_clicked();
void on_pbXAxisRMoveVelD10_clicked();
void on_pbYAxisRMoveVelM10_clicked();
void on_pbYAxisRMoveVelD10_clicked();
void on_pbZAxisRMoveVelM10_clicked();
void on_pbZAxisRMoveVelD10_clicked();
void on_pbZAAxisRMoveVelM10_clicked();
void on_pbZAAxisRMoveVelD10_clicked();
void on_pbRMoveStepDistM10_clicked();
void on_pbRMoveStepDistD10_clicked();
//void addCbZAAxisCPItem(const QString& textValue,double value);
//void cbZAAxisCPCtTextChangedHandl(const QString & text);
void laserOpenFHandl();
void laserCloseFHandl();
//void suspendBufferFHandl();
//void continueBufferFHandl();
void vacuumSuckerCloseFHandl();
void vacuumSuckerOpenFHandl();
void MHCompOpenFHandl();
void MotionCompOpenFHandl();
void MHCompCloseFHandl();
void MotionCompCloseFHandl();
void SETRfidTextFHandl(char * str);
void setXAxisCtPos(double value);
void setYAxisCtPos(double value);
void setZAxisCtPos(double value);
void setZAAxisCtPos(double value);
void ShangliaoSolt(bool);
void XialiaoSolt(bool);
// 异常信息提示
void showExceptionInfoDialog(const QString& text,QMessageBox::Icon value = QMessageBox::Critical);
void AutoShowExceptionInfoDialog(const QString& text);
void ShowSmallAreasDialog();
// 异常处理
void exceptionHandl(MyException mye);
void AutoExceptionHandl(MyException mye);
void on_pbLaserApTestPos_clicked();
//void on_pbHeightFindPos_clicked();
void on_pbEdgeSearchPos_clicked();
void on_pbCompenTestPos_clicked();
void on_pbFindEdge_clicked();
void on_cmbType_currentTextChanged(const QString &strValue);
void on_pbLaserMarking_clicked();
//void on_pbSuspend_clicked();
void on_pushButton_clicked();
void on_chkAuto_clicked();
// void on_cbCheckAlarm_clicked();
void on_pbGetRFID_clicked();
void on_pbMotionCompOnOrOff_clicked();
void on_pbGlobalCameraPos_clicked();
void on_pbXiaoJiaGong_clicked();
void on_pbGetGlobalCamera_clicked();
//void on_pbSelectFile_clicked();
void on_leMachCodeFileName_currentTextChanged(const QString &arg1);
void on_spbPowerAdjust_valueChanged(int arg1);
private:
Ui::DeviceControlPanelWidget* ui;
QMap<QString,double> ZAAxisCPosMap;
double XAxisCtPos{0.0};
double YAxisCtPos{0.0};
double ZAxisCtPos{0.0};
double ZAAxisCtPos{0.0};
};
#endif // DEVICECONTROLPANELWIDGET_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
#include "devicectluserdcwidget.h"
#include <QVBoxLayout>
#include <QDebug>
DeviceCtlUserDCWidget::DeviceCtlUserDCWidget(const QString& title,QWidget* parent)
:QDockWidget(title,parent)
,devecectluserwidget(new DeveceCtlUserWidget(this))
{
auto frame = new QFrame(this);
auto layout = new QVBoxLayout;
frame->setLayout(layout);
layout->setMargin(0);
layout->addWidget(devecectluserwidget);
setWidget(frame);
}

View File

@@ -0,0 +1,20 @@
#ifndef DEVICECTLUSERDCWIDGET_H
#define DEVICECTLUSERDCWIDGET_H
#include "devecectluserwidget.h"
#include <QDockWidget>
class DeviceCtlUserDCWidget: public QDockWidget
{
Q_OBJECT
public:
DeviceCtlUserDCWidget(const QString& title,QWidget* parent = nullptr);
protected:
DeveceCtlUserWidget* devecectluserwidget;
};
#endif // DEVICECONTROLPANELDCWIDGET_H

View File

@@ -0,0 +1,15 @@
#include "devicesetdcwidget.h"
DeviceSetDCWidget::DeviceSetDCWidget(const QString& title,QWidget* parent):
QDockWidget(title,parent),
deviceSetWidget(new DeviceSetWidget(this))
{
auto frame = new QFrame(this);
auto layout = new QVBoxLayout;
frame->setLayout(layout);
layout->setMargin(0);
layout->addWidget(deviceSetWidget);
setWidget(frame);
}

View File

@@ -0,0 +1,15 @@
#ifndef DEVICESETDCWIDGET_H
#define DEVICESETDCWIDGET_H
#include <QDockWidget>
#include "devicesetwidget.h"
class DeviceSetDCWidget: public QDockWidget
{
Q_OBJECT
public:
DeviceSetDCWidget(const QString& title,QWidget* parent = nullptr);
protected:
DeviceSetWidget* deviceSetWidget;
};
#endif // DEVICESETDCWIDGET_H

View File

@@ -0,0 +1,83 @@
#include "devicesetwidget.h"
#include "deviceproxy.h"
DeviceSetWidget::DeviceSetWidget(QWidget* parent):
QFrame(parent),
ui(new Ui::DeviceSetWidget),
aBSMoveSetWidget(new ABSMoveSetWidget),
mRCameraSetWidget(new MRCameraSetWidget),
processCriticalPosSetWidget(new ProcessCriticalPosSetWidget),
rSToZeroSetWidget(new RSToZeroSetWidget),
sScanCompSetWidget(new SScanCompSetWidget),
toHomeSetWidget(new ToHomeSetWidget),
zAAxisCPosSetWidget(new ZAAxisCPosSetWidget),
generalSetWidget(new GeneralSetWidget),
ioSetWidget(new IOSetWidget),
pdd_motor_test_widget(new dd_motor_test_widget),
pSerialDeviceTest(new SerialDeviceTest),
pLaserMarkWidget(new LaserMarkWidget),
pWorkFileEditWidget(new WORKFILEEDITWIDGET),
pSmallAreasParamWidget(new SmallAreasParamWidget)
//pLogIn(new LogIn)
{
ui->setupUi(this);
ui->stackedWidget->addWidget(generalSetWidget);
widgetMap["通用设置"] = generalSetWidget;
ui->stackedWidget->addWidget(aBSMoveSetWidget);
widgetMap["绝对定位"] = aBSMoveSetWidget;
ui->stackedWidget->addWidget(mRCameraSetWidget);
widgetMap["加工头测距头相机"] = mRCameraSetWidget;
ui->stackedWidget->addWidget(processCriticalPosSetWidget);
widgetMap["过程位置"] = processCriticalPosSetWidget;
ui->stackedWidget->addWidget(rSToZeroSetWidget);
widgetMap["对零"] = rSToZeroSetWidget;
ui->stackedWidget->addWidget(sScanCompSetWidget);
widgetMap["面扫描"] = sScanCompSetWidget;
ui->stackedWidget->addWidget(toHomeSetWidget);
widgetMap["回零"] = toHomeSetWidget;
ui->stackedWidget->addWidget(zAAxisCPosSetWidget);
widgetMap["Z常用位置"] = zAAxisCPosSetWidget;
ui->stackedWidget->addWidget(ioSetWidget);
widgetMap["I/O设置"] = ioSetWidget;
ui->stackedWidget->addWidget(pdd_motor_test_widget);
widgetMap["DD马达"] = pdd_motor_test_widget;
ui->stackedWidget->addWidget(pSerialDeviceTest);
widgetMap["串口设备"] = pSerialDeviceTest;
ui->stackedWidget->addWidget(pLaserMarkWidget);
widgetMap["打标设置"] = pLaserMarkWidget;
ui->stackedWidget->addWidget(pWorkFileEditWidget);
widgetMap["加工编辑"] = pWorkFileEditWidget;
ui->stackedWidget->addWidget(pSmallAreasParamWidget);
widgetMap["特定区域"] = pSmallAreasParamWidget;
// ui->stackedWidget->addWidget(pLogIn);
// widgetMap["登录/登出"] = pLogIn;
ui->lwSetItem->addItems(widgetMap.keys());
setStackWidget("通用设置");
connect(ui->lwSetItem,SIGNAL(currentTextChanged(const QString &)),this,SLOT(setStackWidget(const QString &)));
connect(DEV,SIGNAL(MsgLogInSuccess(bool)),this,SLOT(updateLogInPower(bool)));
DEV->MsgLogInSuccess(false);
connect(DEV,SIGNAL(RunSGL(bool)),this,SLOT(updateRunState(bool)));
}
void DeviceSetWidget::setStackWidget(const QString &value)
{
ui->stackedWidget->setCurrentWidget(widgetMap[value]);
}
void DeviceSetWidget::updateLogInPower(bool state)
{
ui->stackedWidget->setEnabled(state);
}
void DeviceSetWidget::updateRunState(bool state)
{
ioSetWidget->setEnabled(state);
}
void DeviceSetWidget::show()
{
QFrame::show();
if (DEV->bUserPower == false)
this->hide();
}

View File

@@ -0,0 +1,54 @@
#ifndef DEVICESETWIDGET_H
#define DEVICESETWIDGET_H
#include <QFrame>
#include "ui_devicesetwidget.h"
#include "absmovesetwidget.h"
#include "mrccamerasetwidget.h"
#include "processcriticalpossetwidget.h"
#include "rstozerosetwidget.h"
#include "sscancompsetwidget.h"
#include "tohomesetwidget.h"
#include "zaaxiscpossetwidget.h"
#include "generalsetwidget.h"
#include "iosetwidget.h"
#include "dd_motor_test.h"
#include "serialdevicetest.h"
#include "login.h"
#include "lasermarkwidget.h"
#include "workfileeditwidget.h"
#include "SmallAreasParamWidget.h"
class DeviceSetWidget:public QFrame
{
Q_OBJECT
public:
explicit DeviceSetWidget(QWidget* parent=nullptr);
public slots:
void setStackWidget(const QString & value);
void updateLogInPower(bool state);
void updateRunState(bool state);
private:
Ui::DeviceSetWidget* ui;
ABSMoveSetWidget* aBSMoveSetWidget;
MRCameraSetWidget* mRCameraSetWidget;
ProcessCriticalPosSetWidget* processCriticalPosSetWidget;
RSToZeroSetWidget* rSToZeroSetWidget;
SScanCompSetWidget* sScanCompSetWidget;
ToHomeSetWidget* toHomeSetWidget;
ZAAxisCPosSetWidget* zAAxisCPosSetWidget;
GeneralSetWidget* generalSetWidget;
IOSetWidget* ioSetWidget;
dd_motor_test_widget * pdd_motor_test_widget;
SerialDeviceTest * pSerialDeviceTest;
LaserMarkWidget * pLaserMarkWidget;
WORKFILEEDITWIDGET * pWorkFileEditWidget;
SmallAreasParamWidget * pSmallAreasParamWidget;
//LogIn * pLogIn;
QMap<QString,QWidget *> widgetMap;
void show();
};
#endif // DEVICESETWIDGET_H

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeviceSetWidget</class>
<widget class="QWidget" name="DeviceSetWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>558</width>
<height>314</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="lwSetItem">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page"/>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,15 @@
#include "devicestateinfodcwidget.h"
DeviceStateInfoDCWidget::DeviceStateInfoDCWidget(const QString& title,QWidget* parent)
:QDockWidget(title,parent)
,deviceStateInfoWidget(new DeviceStateInfoWidget)
{
auto frame = new QFrame(this);
auto layout = new QVBoxLayout;
frame->setLayout(layout);
layout->setMargin(0);
layout->addWidget(deviceStateInfoWidget);
setWidget(frame);
}

View File

@@ -0,0 +1,16 @@
#ifndef DEVICESTATEINFODCWIDGET_H
#define DEVICESTATEINFODCWIDGET_H
#include <QDockWidget>
#include "devicestateinfowidget.h"
class DeviceStateInfoDCWidget:public QDockWidget
{
Q_OBJECT
public:
DeviceStateInfoDCWidget(const QString& title,QWidget* parent = nullptr);
protected:
DeviceStateInfoWidget* deviceStateInfoWidget;
};
#endif // DEVICESTATEINFODCWIDGET_H

View File

@@ -0,0 +1,231 @@
#include "devicestateinfowidget.h"
#include "deviceproxy.h"
#include "modbustcp.h"
DeviceStateInfoWidget::DeviceStateInfoWidget(QWidget* parent)
:QFrame(parent)
,ui(new Ui::DeviceStateInfoWidget)
{
ui->setupUi(this);
connect(DEV,SIGNAL(RSValueChangedSGL(double)),this,SLOT(setRSValue(double)));
connect(DEV,SIGNAL(XAxisCtPosSGL(double)),this,SLOT(setXFPos(double)));
connect(DEV,SIGNAL(YAxisCtPosSGL(double)),this,SLOT(setYFPos(double)));
connect(DEV,SIGNAL(ZAxisCtPosSGL(double)),this,SLOT(setZFPos(double)));
connect(DEV,SIGNAL(ZAAxisCtPosSGL(double)),this,SLOT(setZAFPos(double)));
connect(DEV,SIGNAL(DAxisCtPosSGL(double)),this,SLOT(setDFPos(double)));
connect(DEV,SIGNAL(Z0AxisCtPosSGL(double)),this,SLOT(setZ0FPos(double)));
connect(DEV,SIGNAL(Z2AxisCtPosSGL(double)),this,SLOT(setZ2FPos(double)));
connect(DEV,SIGNAL(StepNameSGL(int)),this,SLOT(setStepName(int)));
connect(DEV,SIGNAL(TransferPLCSGL(int)),this,SLOT(setTransferPLC(int)));
connect(DEV,SIGNAL(SeparatePLCSGL(int)),this,SLOT(setSeparatePLC(int)));
str[0] = "到上料位";
str[1] = "上 料 中";
str[2] = "光路检测";
str[3] = "光路检测";
str[4] = "到对零位";
str[5] = "对 零";
str[6] = "到寻边位";
str[7] = "寻 边";
str[8] = "到对零位";
str[9] = "对 零";
str[10] = "扫 描";
str[11] = "扫 描";
str[12] = "扫 描";
str[13] = "加 工";
str[14] = "光路检测";
str[15] = "光路检测";
str[16] = "到对零位";
str[17] = "对 零";
str[18] = "扫 描";
str[19] = "扫 描";
str[20] = "扫 描";
str[21] = "加 工";
str[22] = "到打标位";
str[23] = "激光打标";
str[24] = "编号拍照";
str[25] = "编号拍照";
str[26] = "到下料位";
str[27] = "下 料";
str[28] = "等待运行";
str[29] = "等待运行";
str[30] = "等待运行";
str[31] = "光路检测1";
str[32] = "光路检测2";
str[33] = "等待运行";
str[34] = "晶锭预测量";
str[35] = "区域加工";
strSts[0] = "未连接";
strSts[1] = "故 障";
strSts[2] = "待 机";
strSts[3] = "初始化中";
strSts[4] = "停 止";
strSts[5] = "运 行";
strSts[6] = "运行上料";
strSts[7] = "运行下料";
strSts[8] = "运行送碇";
}
DeviceStateInfoWidget::~DeviceStateInfoWidget()
{
}
void DeviceStateInfoWidget::setXFPos(double XFPos)
{
QString str;
str = QString::number(XFPos,'f',4)+"mm";
ui->lbXAxisFPOS->setText(str);
}
void DeviceStateInfoWidget::setYFPos(double YFPos)
{
ui->lbYAxisFPOS->setText(QString::number(YFPos,'f',4)+"mm");
}
void DeviceStateInfoWidget::setZFPos(double ZFPos)
{
ui->lbZAxisFPOS->setText(QString::number(ZFPos,'f',4)+"mm");
}
void DeviceStateInfoWidget::setZAFPos(double ZAFPos)
{
ui->lbZAAxisFPOS->setText(QString::number(ZAFPos,'f',4)+"mm");
}
void DeviceStateInfoWidget::setZ0FPos(double Z0FPos)
{
ui->lbZ0AxisFPOS->setText(QString::number(Z0FPos,'f',4)+"mm");
}
void DeviceStateInfoWidget::setZ2FPos(double Z2FPos)
{
ui->lbZ2AxisFPOS->setText(QString::number(Z2FPos,'f',4)+"mm");
}
void DeviceStateInfoWidget::setDFPos(double DFPos)
{
ui->lbDAxisFPOS->setText(QString::number(DFPos,'f',4)+"mm");
}
void DeviceStateInfoWidget::setRSValue(double value)
{
ui->lbRSValue->setText(QString::number(value,'f',4)+"mm");
}
void DeviceStateInfoWidget::setStepName(int step)
{
if (step > 10000)
{
if (JIADINGJIAGONG != 1)
ui->lbStepName->setText(QString::number((1800 - (step - 10000))/10.0,'f',1)+""); //lihongchang jia
else
ui->lbStepName->setText(QString::number((180 - (step - 10000))/10.0,'f',1)+"");
}
else
{
ui->lbStepName->setText(str[step]);
}
}
void DeviceStateInfoWidget::setTransferPLC(int sts)
{
int mysts = sts + 1;
if (mysts == 5)
mysts += MODBUSTCP->TransferPLCSts;
if (mysts > 8)
ui->lbTransferPLC->setText("未知状态");
else
{
ui->lbTransferPLC->setText(strSts[mysts]);
}
}
void DeviceStateInfoWidget::setSeparatePLC(int sts)
{
int mysts = sts + 1;
if (mysts > 5)
ui->lbSeparatePLC->setText("未知状态");
else
{
ui->lbSeparatePLC->setText(strSts[mysts]);
}
}
void DeviceStateInfoWidget::on_pbTransferPLCInit_clicked()
{
int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->InitAddr,10000);
if (ret < 0)
{
QMessageBox::information(this, "提示", "命令执行中,请稍候");
}
}
void DeviceStateInfoWidget::on_pbTransferPLCRun_clicked()
{
int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->RunAddr,1000);
if (ret < 0)
{
QMessageBox::information(this, "提示", "命令执行中,请稍候");
}
}
void DeviceStateInfoWidget::on_pbTransferPLCStop_clicked()
{
int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->StopAddr,1000);
if (ret < 0)
{
QMessageBox::information(this, "提示", "命令执行中,请稍候");
}
}
void DeviceStateInfoWidget::on_pbTransferPLCClearAlarm_clicked()
{
int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->ClearAlarmAddr,1000);
if (ret < 0)
{
QMessageBox::information(this, "提示", "命令执行中,请稍候");
}
}
void DeviceStateInfoWidget::on_pbSeparatePLCInit_clicked()
{
int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->InitAddr,10000);
if (ret < 0)
{
QMessageBox::information(this, "提示", "命令执行中,请稍候");
}
}
void DeviceStateInfoWidget::on_pbSeparatePLCRun_clicked()
{
int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->RunAddr,1000);
if (ret < 0)
{
QMessageBox::information(this, "提示", "命令执行中,请稍候");
}
}
void DeviceStateInfoWidget::on_pbSeparatePLCStop_clicked()
{
int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->StopAddr,1000);
if (ret < 0)
{
QMessageBox::information(this, "提示", "命令执行中,请稍候");
}
}
void DeviceStateInfoWidget::on_pbSeparatePLCClearAlarm_clicked()
{
int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->ClearAlarmAddr,1000);
if (ret < 0)
{
QMessageBox::information(this, "提示", "命令执行中,请稍候");
}
}

View File

@@ -0,0 +1,49 @@
#ifndef DEVICESTATEINFOWIDGET_H
#define DEVICESTATEINFOWIDGET_H
#include <QFrame>
#include "ui_devicestateinfowidget.h"
class DeviceStateInfoWidget:public QFrame
{
Q_OBJECT
public:
explicit DeviceStateInfoWidget(QWidget* parent = nullptr);
~DeviceStateInfoWidget();
public slots:
void setXFPos(double XFPos);
void setYFPos(double YFPos);
void setZFPos(double ZFPos);
void setZAFPos(double ZAFPos);
void setRSValue(double value);
void setZ0FPos(double Z0FPos);
void setZ2FPos(double Z2FPos);
void setDFPos(double DFPos);
void setStepName(int step);
void setTransferPLC(int sts);
void setSeparatePLC(int sts);
private slots:
void on_pbTransferPLCInit_clicked();
void on_pbTransferPLCRun_clicked();
void on_pbTransferPLCStop_clicked();
void on_pbTransferPLCClearAlarm_clicked();
void on_pbSeparatePLCInit_clicked();
void on_pbSeparatePLCRun_clicked();
void on_pbSeparatePLCStop_clicked();
void on_pbSeparatePLCClearAlarm_clicked();
private:
Ui::DeviceStateInfoWidget* ui;
QString str[50];
QString strSts[50];
};
#endif // DEVICESTATEINFOWIDGET_H

View File

@@ -0,0 +1,803 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeviceStateInfoWidget</class>
<widget class="QWidget" name="DeviceStateInfoWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>629</width>
<height>363</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>605</width>
<height>339</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="title">
<string>轴当前位置</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbXAxisFPOS">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Agency FB</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 85, 127);</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Z0:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbZ0AxisFPOS">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Agency FB</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 85, 127);</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbYAxisFPOS">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Agency FB</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 85, 127);</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Z1:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbZAxisFPOS">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Agency FB</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 85, 127);</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbZAAxisFPOS">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Agency FB</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 85, 127);</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QLabel" name="label_6">
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Z2:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbZ2AxisFPOS">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Agency FB</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 85, 127);</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>测距:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbRSValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Agency FB</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 85, 127);</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<widget class="QLabel" name="label_8">
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>DD:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbDAxisFPOS">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>Agency FB</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 85, 127);</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="title">
<string>传输PLC</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QPushButton" name="pbTransferPLCInit">
<property name="text">
<string>初始化</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbTransferPLCRun">
<property name="text">
<string>运 行</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbTransferPLCStop">
<property name="text">
<string>停 止</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbTransferPLCClearAlarm">
<property name="text">
<string>清除报警</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="title">
<string>分离PLC</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QPushButton" name="pbSeparatePLCInit">
<property name="text">
<string>初始化</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbSeparatePLCRun">
<property name="text">
<string>运 行</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbSeparatePLCStop">
<property name="text">
<string>停 止</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbSeparatePLCClearAlarm">
<property name="text">
<string>清除报警</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="title">
<string>当前步骤</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="lbStepName">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 85, 127);</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="title">
<string>传输PLC状态</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="lbTransferPLC">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 85, 127);</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="title">
<string>分离PLC状态</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="lbSeparatePLC">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(0, 85, 127);</string>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,18 @@
#include "devicestateuserdcwidget.h"
#include <QVBoxLayout>
#include <QDebug>
DeviceStateUserDCWidget::DeviceStateUserDCWidget(const QString& title,QWidget* parent)
:QDockWidget(title,parent)
,devicestateuserwidget(new DeviceStateUserWidget(this))
{
auto frame = new QFrame(this);
auto layout = new QVBoxLayout;
frame->setLayout(layout);
layout->setMargin(0);
layout->addWidget(devicestateuserwidget);
setWidget(frame);
}

View File

@@ -0,0 +1,17 @@
#ifndef DEVICESTATEUSERDCWIDGET_H
#define DEVICESTATEUSERDCWIDGET_H
#include "devicestateuserwidget.h"
#include <QDockWidget>
class DeviceStateUserDCWidget: public QDockWidget
{
Q_OBJECT
public:
DeviceStateUserDCWidget(const QString& title,QWidget* parent = nullptr);
protected:
DeviceStateUserWidget* devicestateuserwidget;
};
#endif // DEVICESTATEUSERDCWIDGET_H

View File

@@ -0,0 +1,297 @@
#include "devicestateuserwidget.h"
#include "ui_devicestateuserwidget.h"
#include "deviceproxy.h"
#include "modbustcp.h"
#include "deviceinfo.h"
#include <QVector>
#include <QDebug>
#include <QFileDialog>
#include "rs_settings.h"
#include <QDateTime>
#include "deviceproxy.h"
#include "exceptioncode.h"
#include "bridgesgl.h"
#include "modbustcp.h"
#include "login.h"
#include "setvaluewidget.h"
DeviceStateUserWidget::DeviceStateUserWidget(QWidget *parent) :
QFrame(parent),
ui(new Ui::DeviceStateUserWidget)
{
ui->setupUi(this);
connect(DEV,SIGNAL(MsgSetValueSGL(int)),this,SLOT(SetParamValue(int)));
// connect(DEV,SIGNAL(RSValueChangedSGL(double)),this,SLOT(setRSValue(double)));
// connect(DEV,SIGNAL(XAxisCtPosSGL(double)),this,SLOT(setXFPos(double)));
// connect(DEV,SIGNAL(YAxisCtPosSGL(double)),this,SLOT(setYFPos(double)));
// connect(DEV,SIGNAL(ZAxisCtPosSGL(double)),this,SLOT(setZFPos(double)));
// connect(DEV,SIGNAL(ZAAxisCtPosSGL(double)),this,SLOT(setZAFPos(double)));
// connect(DEV,SIGNAL(DAxisCtPosSGL(double)),this,SLOT(setDFPos(double)));
// connect(DEV,SIGNAL(Z0AxisCtPosSGL(double)),this,SLOT(setZ0FPos(double)));
// connect(DEV,SIGNAL(Z2AxisCtPosSGL(double)),this,SLOT(setZ2FPos(double)));
// connect(DEV,SIGNAL(TransferPLCSGL(int)),this,SLOT(setTransferPLC(int)));
// connect(DEV,SIGNAL(SeparatePLCSGL(int)),this,SLOT(setSeparatePLC(int)));
// strSts[0] = "未连接";
// strSts[1] = "故 障";
// strSts[2] = "待 机";
// strSts[3] = "初始化中";
// strSts[4] = "停 止";
// strSts[5] = "运 行";
// strSts[6] = "运行上料";
// strSts[7] = "运行下料";
// strSts[8] = "运行送碇";
}
DeviceStateUserWidget::~DeviceStateUserWidget()
{
delete ui;
}
//void DeviceStateUserWidget::setXFPos(double XFPos)
//{
// QString str;
// str = QString::number(XFPos,'f',4)+"mm";
// ui->lbXAxisFPOS->setText(str);
//}
//void DeviceStateUserWidget::setYFPos(double YFPos)
//{
// ui->lbYAxisFPOS->setText(QString::number(YFPos,'f',4)+"mm");
//}
//void DeviceStateUserWidget::setZFPos(double ZFPos)
//{
// ui->lbZAxisFPOS->setText(QString::number(ZFPos,'f',4)+"mm");
//}
//void DeviceStateUserWidget::setZAFPos(double ZAFPos)
//{
// ui->lbZAAxisFPOS->setText(QString::number(ZAFPos,'f',4)+"mm");
//}
//void DeviceStateUserWidget::setZ0FPos(double Z0FPos)
//{
// ui->lbZ0AxisFPOS->setText(QString::number(Z0FPos,'f',4)+"mm");
//}
//void DeviceStateUserWidget::setZ2FPos(double Z2FPos)
//{
// ui->lbZ2AxisFPOS->setText(QString::number(Z2FPos,'f',4)+"mm");
//}
//void DeviceStateUserWidget::setDFPos(double DFPos)
//{
// ui->lbDAxisFPOS->setText(QString::number(DFPos,'f',4)+"mm");
//}
//void DeviceStateUserWidget::setRSValue(double value)
//{
// ui->lbRSValue->setText(QString::number(value,'f',4)+"mm");
//}
//void DeviceStateUserWidget::setTransferPLC(int sts)
//{
// int mysts = sts + 1;
// if (mysts == 5)
// mysts += MODBUSTCP->TransferPLCSts;
// if (mysts > 8)
// ui->lbTransferPLC->setText("未知状态");
// else
// {
// ui->lbTransferPLC->setText(strSts[mysts]);
// }
//}
//void DeviceStateUserWidget::setSeparatePLC(int sts)
//{
// int mysts = sts + 1;
// if (mysts > 5)
// ui->lbSeparatePLC->setText("未知状态");
// else
// {
// ui->lbSeparatePLC->setText(strSts[mysts]);
// }
//}
//void DeviceStateUserWidget::on_pbTransferPLCInit_clicked()
//{
// int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->InitAddr,10000);
// if (ret < 0)
// {
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
// }
//}
//void DeviceStateUserWidget::on_pbTransferPLCRun_clicked()
//{
// int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->RunAddr,1000);
// if (ret < 0)
// {
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
// }
//}
//void DeviceStateUserWidget::on_pbTransferPLCStop_clicked()
//{
// int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->StopAddr,1000);
// if (ret < 0)
// {
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
// }
//}
//void DeviceStateUserWidget::on_pbTransferPLCClearAlarm_clicked()
//{
// int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->ClearAlarmAddr,1000);
// if (ret < 0)
// {
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
// }
//}
//void DeviceStateUserWidget::on_pbSeparatePLCInit_clicked()
//{
// int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->InitAddr,10000);
// if (ret < 0)
// {
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
// }
//}
//void DeviceStateUserWidget::on_pbSeparatePLCRun_clicked()
//{
// int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->RunAddr,1000);
// if (ret < 0)
// {
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
// }
//}
//void DeviceStateUserWidget::on_pbSeparatePLCStop_clicked()
//{
// int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->StopAddr,1000);
// if (ret < 0)
// {
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
// }
//}
//void DeviceStateUserWidget::on_pbSeparatePLCClearAlarm_clicked()
//{
// int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->ClearAlarmAddr,1000);
// if (ret < 0)
// {
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
// }
//}
void DeviceStateUserWidget::SetParamValue(int value)
{
if (flag == 0)
{
if ((value != 4) || (value != 6) || (value != 8))
{
}
else
{
// QString str;
// str = QString()
// ui->tbSize->setText(str);
}
}
else if (flag == 1)
{
}
else if (flag == 2)
{
}
}
void DeviceStateUserWidget::on_pbRun_clicked()
{
DEV->semiAutoMach();
}
void DeviceStateUserWidget::on_pbUser_clicked()
{
LogIn * login = new(LogIn);
login->exec();
}
void DeviceStateUserWidget::on_pbStop_clicked()
{
//if (DEV->bUserPower)
{
DEV->stop();
DEVICE_INFO->printDeviceSystemInfo("界面停止按钮按下!");
}
}
void DeviceStateUserWidget::on_pbSuspend_clicked()
{
{
if (DEV->SuspendFlag)
DEV->SuspendFlag = false;
else
DEV->SuspendFlag = true;
emit DEV->StopStateSGL(!DEV->SuspendFlag);
}
}
void DeviceStateUserWidget::on_pbReset_clicked()
{
DEV->DEVInit();
bool isdevIsInit = DEV->getDevIsInit();
if (isdevIsInit == false)
return;
DEV->laserCtlCnn();
DEV->AirValveClose();
DEV->CuCeGaoOpen();
bool isreset = DEV->getDevIsReset();
if (isreset == false)
DEV->reset();
// if (MODBUSTCP->PLCSts[1] == 1)
// {
// MODBUSTCP->SeparatePLCRun(MODBUSTCP->InitAddr,10000);
// }
// else
// QMessageBox::information(this, "提示", "分离PLC不在 待机 状态,不能执行 初始化 操作!");
// if (MODBUSTCP->PLCSts[0] == 1)
// MODBUSTCP->TransferPLCRun(MODBUSTCP->InitAddr,10000);
// else
// QMessageBox::information(this, "提示", "传输PLC不在 待机 状态,不能执行 初始化 操作!");
}
void DeviceStateUserWidget::on_tbSize_clicked()
{
flag = 0;
SetValueWidget * setValueWidget = new(SetValueWidget);
setValueWidget->exec();
}
void DeviceStateUserWidget::on_tbDepth_clicked()
{
flag = 1;
SetValueWidget * setValueWidget = new(SetValueWidget);
setValueWidget->exec();
}
void DeviceStateUserWidget::on_tbNumber_clicked()
{
flag = 2;
SetValueWidget * setValueWidget = new(SetValueWidget);
setValueWidget->exec();
}

View File

@@ -0,0 +1,78 @@
#ifndef DEVICESTATEUSERWIDGET_H
#define DEVICESTATEUSERWIDGET_H
#include <QFrame>
#include "myexception.h"
#include "base.h"
#include <QMessageBox>
#include <QMap>
namespace Ui {
class DeviceStateUserWidget;
}
class DeviceStateUserWidget : public QFrame
{
Q_OBJECT
public:
explicit DeviceStateUserWidget(QWidget *parent = nullptr);
~DeviceStateUserWidget();
public slots:
// void setXFPos(double XFPos);
// void setYFPos(double YFPos);
// void setZFPos(double ZFPos);
// void setZAFPos(double ZAFPos);
// void setRSValue(double value);
// void setZ0FPos(double Z0FPos);
// void setZ2FPos(double Z2FPos);
// void setDFPos(double DFPos);
// void setTransferPLC(int sts);
// void setSeparatePLC(int sts);
void SetParamValue(int value);
private slots:
// void on_pbTransferPLCInit_clicked();
// void on_pbTransferPLCRun_clicked();
// void on_pbTransferPLCStop_clicked();
// void on_pbTransferPLCClearAlarm_clicked();
// void on_pbSeparatePLCInit_clicked();
// void on_pbSeparatePLCRun_clicked();
// void on_pbSeparatePLCStop_clicked();
// void on_pbSeparatePLCClearAlarm_clicked();
void on_pbRun_clicked();
void on_pbUser_clicked();
void on_pbStop_clicked();
void on_pbSuspend_clicked();
void on_pbReset_clicked();
void on_tbSize_clicked();
void on_tbDepth_clicked();
void on_tbNumber_clicked();
private:
Ui::DeviceStateUserWidget *ui;
int flag{-1};
//QString strSts[50];
};
#endif // DEVICESTATEUSERWIDGET_H

View File

@@ -0,0 +1,766 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeviceStateUserWidget</class>
<widget class="QWidget" name="DeviceStateUserWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1253</width>
<height>782</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
</font>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(253, 253, 253);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>70</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/Image/logo.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>337</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_13">
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>26</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>激光加工平台系统</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>428</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbUser">
<property name="minimumSize">
<size>
<width>132</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(80, 240, 73);</string>
</property>
<property name="text">
<string>用 户</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>400</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(253, 253, 253);</string>
</property>
<property name="title">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>加工尺寸:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tbSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QToolButton{
background-color:rgba(0,0,0,0);
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>加工深度:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tbDepth">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">QToolButton{
background-color:rgba(0,0,0,0);
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>加工编号:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_16">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tbNumber">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">QToolButton{
background-color:rgba(0,0,0,0);
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>工艺文件:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_19">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tbWorkFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">QToolButton{
background-color:rgba(0,0,0,0);
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frameSts">
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 255, 0);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>当前状态:运行</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>120</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(173, 216, 230);</string>
</property>
<property name="title">
<string/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="pbRun">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(253, 253, 253);</string>
</property>
<property name="text">
<string>运 行</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbSuspend">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(253, 253, 253);</string>
</property>
<property name="text">
<string>暂 停</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbStop">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(253, 253, 253);</string>
</property>
<property name="text">
<string>停 止</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbReset">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>100</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(253, 253, 253);</string>
</property>
<property name="text">
<string>复 位</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'微软雅黑'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'SimSun'; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'SimSun'; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<property name="styleSheet">
<string notr="true">background-color: rgb(253, 253, 253);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QWidget" name="widget_2" native="true">
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">image: url(:/Image/2.jpg);</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="value">
<number>24</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>软件版本V1.0</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_17">
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>今日加工13</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_18">
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>历史加工1123</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_14">
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>2024-01-24 14:04:04</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,17 @@
#include "devicesysteminfodcwidget.h"
#include "devicesysteminfowidget.h"
#include <QVBoxLayout>
DeviceSystemInfoDCWidget::DeviceSystemInfoDCWidget(const QString& title,QWidget* parent)
:QDockWidget(title,parent)
,deviceSystemInfoWidget(new DeviceSystemInfoWidget(this))
{
auto frame = new QFrame(this);
auto layout = new QVBoxLayout;
frame->setLayout(layout);
layout->setMargin(0);
layout->addWidget(deviceSystemInfoWidget);
setWidget(frame);
}

View File

@@ -0,0 +1,19 @@
#ifndef DEVICESYSTEMINFODCWIDGET_H
#define DEVICESYSTEMINFODCWIDGET_H
#include <QDockWidget>
#include "devicesysteminfowidget.h"
class DeviceSystemInfoDCWidget: public QDockWidget
{
Q_OBJECT
public:
DeviceSystemInfoDCWidget(const QString& title,QWidget* parent = nullptr);
protected:
DeviceSystemInfoWidget* deviceSystemInfoWidget;
};
#endif // DEVICESYSTEMINFODCWIDGET_H

View File

@@ -0,0 +1,59 @@
#include"devicesysteminfowidget.h"
#include "ui_devicesysteminfowidget.h"
#include <QPainter>
#include <QDebug>
#include "deviceinfo.h"
DeviceSystemInfoWidget::DeviceSystemInfoWidget(QWidget *parent):
QFrame(parent),
ui(new Ui::DeviceSystemInfoWidget)
{
ui->setupUi(this);
// 获取文本光标(不是鼠标光标)
cursorPosition = ui->textEdit->textCursor();
//insertInformationToText("杭州");
//insertInformationToText("中国");
connect(DEVICE_INFO,SIGNAL(deviceSystemInfoSGL(const QString,SYS_INFO_LEVEL)),this,SLOT(insertInformationToText(const QString&,SYS_INFO_LEVEL)));
}
DeviceSystemInfoWidget::~DeviceSystemInfoWidget()
{
delete ui;
}
void DeviceSystemInfoWidget::insertInformationToText(const QString text,SYS_INFO_LEVEL level)
{
cursorPosition.movePosition(QTextCursor::Start,QTextCursor::MoveAnchor);
cursorPosition.insertText("\n");
cursorPosition.movePosition(QTextCursor::Start,QTextCursor::MoveAnchor);
cursorPosition.insertText(text);
//选中该行文字
cursorPosition.movePosition(QTextCursor::Start,QTextCursor::MoveAnchor);
//qDebug()<<"------text.length(): "<<text.length()<<endl;
cursorPosition.setPosition(cursorPosition.position() + text.length(),QTextCursor::KeepAnchor);
// 只选单词,不选数字
//cursorPosition.select(QTextCursor::WordUnderCursor);
//cursorPosition.select(QTextCursor::LineUnderCursor);
cursorPosition.select(QTextCursor::BlockUnderCursor);
QTextCharFormat fmt;
switch (level)
{
case D_NOTHING:
fmt.setForeground(QColor(255, 255, 255));
break;
case D_WARNING:
fmt.setForeground(QColor(255, 160, 14));
break;
case D_CRITICAL:
fmt.setForeground(QColor(255, 53, 21));
break;
}
// 把格式应用到光标所处在的字符上
cursorPosition.mergeCharFormat(fmt);
cursorPosition.clearSelection(); //撤销选中
}

View File

@@ -0,0 +1,29 @@
#ifndef DEVICESYSTEMINFOWIDGET_H
#define DEVICESYSTEMINFOWIDGET_H
#include <QFrame>
#include <QTextCursor>
#include <QString>
#include "base.h"
namespace Ui {
class DeviceSystemInfoWidget;
}
class DeviceSystemInfoWidget:public QFrame
{
Q_OBJECT
public:
explicit DeviceSystemInfoWidget(QWidget* parent=nullptr);
~DeviceSystemInfoWidget();
private slots:
void insertInformationToText(const QString text,SYS_INFO_LEVEL level);
private:
Ui::DeviceSystemInfoWidget* ui;
QTextCursor cursorPosition;
};
#endif // DEVICESYSTEMINFOWIDGET_H

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeviceSystemInfoWidget</class>
<widget class="QWidget" name="DeviceSystemInfoWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>438</width>
<height>216</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTextEdit" name="textEdit">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'SimSun';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'SimSun';&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,362 @@
#include "generalsetwidget.h"
#include "deviceproxy.h"
#include "rs_settings.h"
#include "deviceinfo.h"
#include "IPG_laser.h"
#include "imagebox.h"
#include "modbustcp.h"
GeneralSetWidget::GeneralSetWidget(QWidget* parent):
QFrame(parent),
ui(new Ui::GeneralSetWidget)
{
ui->setupUi(this);
QStringList doTextList;
for(auto i=0;i<8;i++)
{
doTextList.append("设置参数"+QString::number(i+1));
}
ui->cmbSetParam->addItems(doTextList);
connect(ui->cmbSetParam,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cmbSetParam_currentTextChanged(QString)));
connect(DEV,SIGNAL(show_Q_PP_SGL()),this,SLOT(show_Q_PP()));
loadSet();
//ui->pbLaserSet2->setVisible(false);
}
void GeneralSetWidget::loadSet()
{
RS_SETTINGS->beginGroup("device/Comm/NET");
QString ip = RS_SETTINGS->readEntry("/ip");
int port = RS_SETTINGS->readNumEntry("/port");
RS_SETTINGS->endGroup();
ui->leIP->setIp(ip);
ui->sbPort->setValue(port);
RS_SETTINGS->beginGroup("device/ZAAxisSafe");
double ZAAxisSafePos = RS_SETTINGS->readNumDEntry("/pos");
double ZAAxisSafeVel = RS_SETTINGS->readNumDEntry("/vel");
RS_SETTINGS->endGroup();
ui->dsbZAAxisSafePos->setValue(ZAAxisSafePos);
ui->dsbZAAxisSafeVel->setValue(ZAAxisSafeVel);
RS_SETTINGS->beginGroup("device/Rposition");
//double FindCameraPos = RS_SETTINGS->readNumDEntry("/FindCamera");
double PanFindHeightPos = RS_SETTINGS->readNumDEntry("/Palletheight");
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/Rposition");
double FindEdageOffset = RS_SETTINGS->readNumDEntry("/FindEdageOffset");
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/Rposition");
double PixelSize = RS_SETTINGS->readNumDEntry("/PixelSize");
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/Rposition");
double GlobalCameraOffset = RS_SETTINGS->readNumDEntry("/GlobalCameraOffset");
RS_SETTINGS->endGroup();
//ui->dsbFindCamera->setValue(FindCameraPos);
ui->dsbPanFindHeight->setValue(PanFindHeightPos);
ui->dsbFindEdageOffset->setValue(FindEdageOffset);
//ui->dsbPixelSize->setValue(PixelSize);
ui->dsbGlobalCameraOffset->setValue(GlobalCameraOffset);
RS_SETTINGS->beginGroup("device/Para");
DEV->R_detection_pm = RS_SETTINGS->readNumDEntry("/dsbPPM");
RS_SETTINGS->endGroup();
ui->dsbPP_M->setValue(DEV->R_detection_pm);
RS_SETTINGS->beginGroup("device/Para");
DEV->R_detection_po = RS_SETTINGS->readNumDEntry("/dsbPPO");
RS_SETTINGS->endGroup();
ui->dsbPP_O->setValue(DEV->R_detection_po);
}
void GeneralSetWidget::on_leIP_IPChanged(QString value)
{
RS_SETTINGS->beginGroup("device/Comm/NET");
RS_SETTINGS->writeEntry("/ip", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("待连接IP(控制器)改变为:%1").arg(value));
}
void GeneralSetWidget::on_sbPort_valueChanged(int value)
{
RS_SETTINGS->beginGroup("device/Comm/NET");
RS_SETTINGS->writeEntry("/port", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("待连接Port(控制器)设置为:%1").arg(value));
}
void GeneralSetWidget::on_dsbZAAxisSafePos_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ZAAxisSafe");
RS_SETTINGS->writeEntry("/pos", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z轴安全位置设置为%1mm").arg(value));
}
void GeneralSetWidget::on_dsbZAAxisSafeVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/ZAAxisSafe");
RS_SETTINGS->writeEntry("/vel", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z轴回安全位置速度设置为%1mm/s").arg(value));
}
void GeneralSetWidget::cmbSetParam_currentTextChanged(const QString &value)
{
if (IPGLASER->m_hComm == nullptr)
{
IPGLASER->OpenComm();
}
IPGLASER->LaserClose();
IPGLASER->getIPGLaerPara("IPGLaser");
if (IPGLASER->m_hComm == nullptr)
{
IPGLASER->OpenComm();
}
int ret;
if (value == "设置参数1")
{
ret = IPGLASER->SetParam(1);
}
else if (value == "设置参数2")
{
ret = IPGLASER->SetParam(2);
}
else if (value == "设置参数3")
{
ret = IPGLASER->SetParam(3);
}
else if (value == "设置参数4")
{
ret = IPGLASER->SetParam(4);
}
else if (value == "设置参数5")
{
ret = IPGLASER->SetParam(5);
}
else if (value == "设置参数6")
{
ret = IPGLASER->SetParam(6);
}
else if (value == "设置参数7")
{
ret = IPGLASER->SetParam(7);
}
else if (value == "设置参数8")
{
ret = IPGLASER->SetParam(8);
}
if (ret != 0)
{
QMessageBox msg(this);
DEVICE_INFO->printDeviceSalamInfo("参数设置错误!");
msg.setWindowTitle("异常提示");
msg.setText("参数设置错误!");
msg.setIcon(QMessageBox::Critical);
msg.exec();
return;
}
}
void GeneralSetWidget::on_dsbPanFindHeight_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/Palletheight", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("托盘高度设置为:%1mm/s").arg(value));
}
//void GeneralSetWidget::on_chkPID_clicked()
//{
// if (ui->chkPID->checkState() == Qt::Checked)
// {
// DEV->PidFlag = true;
// }
// else
// {
// DEV->PidFlag = false;
// }
//}
void GeneralSetWidget::on_pbLaserCnn_clicked()
{
//DEV->laserCtlCnn();
if (IPGLASER->m_hComm == nullptr)
{
IPGLASER->getIPGLaerPara("IPGLaser");
bool ret = IPGLASER->OpenComm();
if (!ret)
{
QMessageBox msg(this);
DEVICE_INFO->printDeviceSalamInfo("激光器串口打开错误!");
msg.setWindowTitle("异常提示");
msg.setText("激光器串口打开错误!");
msg.setIcon(QMessageBox::Critical);
msg.exec();
return;
}
}
}
void GeneralSetWidget::on_pbLaserClose_clicked()
{
bool ret;
int retclose;
retclose = IPGLASER->LaserClose();
ret = IPGLASER->CloseComm();
if (!ret || (retclose < 0))
{
{
QMessageBox msg(this);
DEVICE_INFO->printDeviceSalamInfo("激光器串口关闭错误!");
msg.setWindowTitle("异常提示");
msg.setText("激光器串口关闭错误!");
msg.setIcon(QMessageBox::Critical);
msg.exec();
return;
}
}
DEV->devLaserOpenTime = 0;
}
void GeneralSetWidget::on_pbLaserSet2_clicked()
{
if (ui->cmbBiaoDing->currentText() == "T标定")
DEV->BiaoDingFlag = true;
else
DEV->BiaoDingFlag = false;
DEV->GetRatioP1P2();
}
void GeneralSetWidget::on_dsbFindEdageOffset_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/FindEdageOffset", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("寻边Y轴偏移改变为%1mm/s").arg(arg1));
}
//void GeneralSetWidget::on_dsbPixelSize_valueChanged(double arg1)
//{
// RS_SETTINGS->beginGroup("device/Rposition");
// RS_SETTINGS->writeEntry("/PixelSize", arg1);
// RS_SETTINGS->endGroup();
// //DEVICE_INFO->printDeviceSystemInfo(QString("像素尺寸改变为:%1mm/s").arg(arg1));
//}
void GeneralSetWidget::on_dsbGlobalCameraOffset_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/GlobalCameraOffset", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("全局相机偏移改变为:%1mm/s").arg(arg1));
}
void GeneralSetWidget::on_pbSetPP_clicked()
{
QString strPower;
strPower = QString::number(ui->dsbSetPPValue->value(),'f',2);
int ret = IPGLASER->SetSingleParam("32",strPower);
if (ret != 0)
{
QMessageBox msg(this);
DEVICE_INFO->printDeviceSalamInfo("参数设置错误!");
msg.setWindowTitle("异常提示");
msg.setText("参数设置错误!");
msg.setIcon(QMessageBox::Critical);
msg.exec();
return;
}
QMessageBox msg(this);
DEVICE_INFO->printDeviceSalamInfo("参数设置成功!");
msg.setWindowTitle("提示");
msg.setText("参数设置成功!");
msg.setIcon(QMessageBox::Critical);
msg.exec();
return;
}
void GeneralSetWidget::show_Q_PP()
{
ui->dsbQ_T->setValue(DEV->R_detection_pt);
ui->dsbQ_S->setValue(DEV->R_detection_ps);
ui->dsbPP_T->setValue(DEV->getPP(DEV->R_detection_pt,true));
ui->dsbPP_S->setValue(DEV->getPP(DEV->R_detection_ps,false));
ui->dsbR->setValue(DEV->mode*1000);
}
void GeneralSetWidget::on_show_image_clicked()
{
//DEV->imageGet();
ImageBox *form = new ImageBox;
form->show();
}
void GeneralSetWidget::on_dsbPP_M_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Para");
RS_SETTINGS->writeEntry("/dsbPPM", arg1);
RS_SETTINGS->endGroup();
}
void GeneralSetWidget::on_dsbPP_O_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Para");
RS_SETTINGS->writeEntry("/dsbPPO", arg1);
RS_SETTINGS->endGroup();
}
void GeneralSetWidget::on_Empty_clicked()
{
char* ip;
DEV->StopElectricResistanceCheckFlag = false;
int step = 0;
bool hasToBuffer = false;
QByteArray ba = MODBUSTCP->ipAddr_electric_resistance.toLatin1(); // must AF_LOCAL
ip=ba.data();
//bool ret = rms.RMS_Connect(ip,QString("10001").toUShort());
bool ret = DEV->rms.RMS_Connect("192.168.1.10",QString("10001").toUShort());
if (!ret)
{
//DEV->rms.RMS_Disconnect();
return;
}
DEV->rms.RMS_Read_Empty();
}
void GeneralSetWidget::on_oneDot_clicked()
{
double single = DEV->rms.RMS_Read_Single();
ui->dsbR->setValue(single*1000);
//ui->dsbR->setValue(DEV->TypeForTest);
}

View File

@@ -0,0 +1,55 @@
#ifndef GENERALSETWIDGET_H
#define GENERALSETWIDGET_H
#include "ui_generalsetwidget.h"
#include "RMS_Dll_global.h"
#include "rms_dll.h"
class GeneralSetWidget:public QFrame
{
Q_OBJECT
public:
explicit GeneralSetWidget(QWidget* parent=nullptr);
public slots:
void on_leIP_IPChanged(QString value);
void on_sbPort_valueChanged(int value);
void on_dsbZAAxisSafePos_valueChanged(double value);
void on_dsbZAAxisSafeVel_valueChanged(double value);
void cmbSetParam_currentTextChanged(const QString &value);
private slots:
void on_dsbPanFindHeight_valueChanged(double value);
//void on_chkPID_clicked();
void on_pbLaserCnn_clicked();
void on_pbLaserClose_clicked();
void on_pbLaserSet2_clicked();
void on_dsbFindEdageOffset_valueChanged(double arg1);
// void on_dsbPixelSize_valueChanged(double arg1);
void on_dsbGlobalCameraOffset_valueChanged(double arg1);
void on_pbSetPP_clicked();
void show_Q_PP();
void on_show_image_clicked();
void on_dsbPP_M_valueChanged(double arg1);
void on_dsbPP_O_valueChanged(double arg1);
void on_oneDot_clicked();
void on_Empty_clicked();
private:
void loadSet();
private:
Ui::GeneralSetWidget* ui;
};
#endif // GENERALSETWIDGET_H

File diff suppressed because it is too large Load Diff

25
device/ui/imagebox.cpp Normal file
View File

@@ -0,0 +1,25 @@
#include "imagebox.h"
#include "ui_imagebox.h"
#include "deviceproxy.h"
#include <QFileDialog>
ImageBox::ImageBox(QWidget *parent) :
QWidget(parent),
ui(new Ui::ImageBox)
{
ui->setupUi(this);
ui->label->setPixmap(QPixmap::fromImage(DEV->imageR));
}
ImageBox::~ImageBox()
{
delete ui;
}
void ImageBox::on_pushButton_clicked()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("png file"), qApp->applicationDirPath(),
tr("Files (*.png)"));
DEV->imageR.save(fileName);
}

25
device/ui/imagebox.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef IMAGEBOX_H
#define IMAGEBOX_H
#include <QWidget>
namespace Ui {
class ImageBox;
}
class ImageBox : public QWidget
{
Q_OBJECT
public:
explicit ImageBox(QWidget *parent = nullptr);
~ImageBox();
private slots:
void on_pushButton_clicked();
private:
Ui::ImageBox *ui;
};
#endif // IMAGEBOX_H

45
device/ui/imagebox.ui Normal file
View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ImageBox</class>
<widget class="QWidget" name="ImageBox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>587</width>
<height>523</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>60</x>
<y>30</y>
<width>450</width>
<height>450</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>400</x>
<y>490</y>
<width>93</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>保存图片</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

741
device/ui/iosetwidget.cpp Normal file
View File

@@ -0,0 +1,741 @@
#include "iosetwidget.h"
#include "rs_settings.h"
#include "deviceinfo.h"
#include "deviceproxy.h"
IOSetWidget::IOSetWidget(QWidget *parent)
:QFrame(parent)
,ui(new Ui::IOSetWidget)
{
ui->setupUi(this);
QStringList doTextList;
for(auto i=0;i<16;i++)
{
doTextList.append(QString::number(i));
}
ui->cbLaserDONum->addItems(doTextList);
ui->cbRedLightDONum->addItems(doTextList);
ui->cbGreenLightDONum->addItems(doTextList);
ui->cbYellowLightDONum->addItems(doTextList);
ui->cbVacuumSuckerDONum->addItems(doTextList);
ui->cbFanDONum->addItems(doTextList);
ui->cbDoorDINum1->addItems(doTextList);
ui->cbDoorDINum2->addItems(doTextList);
ui->cbEStopDINum->addItems(doTextList);
ui->cbRunBtnDINum->addItems(doTextList);
ui->cbRunBtnDONum->addItems(doTextList);
ui->cbStopBtnDINum->addItems(doTextList);
ui->cbStopBtnDONum->addItems(doTextList);
ui->cbLightSourceDONum->addItems(doTextList);
ui->cbAirValveDONum->addItems(doTextList);
ui->cbCucegaoDONum->addItems(doTextList);
ui->cbPin18DONum->addItems(doTextList);
ui->cbLightDONum->addItems(doTextList);
//ui->cbAirValveDONum_2->addItems(doTextList);
ui->cbAirValveOpenDINum->addItems(doTextList);
ui->cbAirValveCloseDINum->addItems(doTextList);
ui->cbCuCeGaoDINum->addItems(doTextList);
ui->cbAllPressureDINum->addItems(doTextList);
ui->cbUPS->addItems(doTextList);
loadSet();
connect(ui->cbRedLightDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbRedLightDONumCtTextChangedHandl(QString)));
connect(ui->cbYellowLightDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbYellowDONumCtTextChangedHandl(QString)));
connect(ui->cbGreenLightDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbGreenLightDONumCtTextChangedHandl(QString)));
connect(ui->cbLaserDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbLaserDONumCtTextChangedHandl(QString)));
connect(ui->cbVacuumSuckerDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbVacuumSuckerDONumCtTextChangedHandl(QString)));
connect(ui->cbFanDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbFanDONum_currentTextChanged(QString)));
connect(ui->cbRunBtnDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbRunBtnDONum_currentTextChanged(QString)));
connect(ui->cbStopBtnDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbStopBtnDONum_currentTextChanged(QString)));
connect(ui->cbLightSourceDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbLightSourceDONum_currentTextChanged(QString)));
connect(ui->cbAirValveDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbAirValveDONum_currentTextChanged(QString)));
connect(ui->cbCucegaoDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbCucegaoDONum_currentTextChanged(QString)));
//connect(ui->cbAirValveDONum_2,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbAirValveDONum_2_currentTextChanged(QString)));
connect(ui->cbPin18DONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbPin18DONum_currentTextChanged(QString)));
connect(ui->cbLightDONum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbLightDONum_currentTextChanged(QString)));
connect(ui->cbStopBtnDINum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbStopBtnDINum_currentTextChanged(QString)));
connect(ui->cbRunBtnDINum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbRunBtnDINum_currentTextChanged(QString)));
connect(ui->cbEStopDINum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbEStopDINum_currentTextChanged(QString)));
connect(ui->cbDoorDINum1,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbDoorDINum1_currentTextChanged(QString)));
connect(ui->cbDoorDINum2,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbDoorDINum2_currentTextChanged(QString)));
connect(ui->cbAirValveOpenDINum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbAirValveOpenDINum_currentTextChanged(QString)));
connect(ui->cbAirValveCloseDINum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbAirValveCloseDINum_currentTextChanged(QString)));
connect(ui->cbCuCeGaoDINum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbCuCeGaoDINum_currentTextChanged(QString)));
connect(ui->cbAllPressureDINum,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbAllPressureDINum_currentTextChanged(QString)));
connect(ui->cbUPS,SIGNAL(currentTextChanged(const QString &)),this,SLOT(cbUPS_currentTextChanged(QString)));
connect(DEV,SIGNAL(InStateSGL(int)),this,SLOT(setInState(int)));
}
void IOSetWidget::loadSet()
{
RS_SETTINGS->beginGroup("device/RS");
int RSECATAddr = RS_SETTINGS->readNumEntry("/ECATAddr");
RS_SETTINGS->endGroup();
ui->sbRSECATAddr->setValue(RSECATAddr);
RS_SETTINGS->beginGroup("device/DO");
int DOECATAddr = RS_SETTINGS->readNumEntry("/ECATAddr");
RS_SETTINGS->endGroup();
ui->sbDOECATAddr->setValue(DOECATAddr);
RS_SETTINGS->beginGroup("device/DI");
int DIECATAddr = RS_SETTINGS->readNumEntry("/ECATAddr");
RS_SETTINGS->endGroup();
ui->sbDIECATAddr->setValue(DIECATAddr);
RS_SETTINGS->beginGroup("device/DO");
QString redLightDONum = RS_SETTINGS->readEntry("/redLight");
RS_SETTINGS->endGroup();
ui->cbRedLightDONum->setCurrentText(redLightDONum);
RS_SETTINGS->beginGroup("device/DO");
QString yellowLightDONum = RS_SETTINGS->readEntry("/yellowLight");
RS_SETTINGS->endGroup();
ui->cbYellowLightDONum->setCurrentText(yellowLightDONum);
RS_SETTINGS->beginGroup("device/DO");
QString greenLightDONum = RS_SETTINGS->readEntry("/greenLight");
RS_SETTINGS->endGroup();
ui->cbGreenLightDONum->setCurrentText(greenLightDONum);
RS_SETTINGS->beginGroup("device/DO");
QString laserDONum = RS_SETTINGS->readEntry("/laser");
RS_SETTINGS->endGroup();
ui->cbLaserDONum->setCurrentText(laserDONum);
DEV->devLaserNum = laserDONum.toInt();
RS_SETTINGS->beginGroup("device/DO");
QString vacuumSuckerDONum = RS_SETTINGS->readEntry("/vacuumSucker");
RS_SETTINGS->endGroup();
ui->cbVacuumSuckerDONum->setCurrentText(vacuumSuckerDONum);
RS_SETTINGS->beginGroup("device/DO");
QString fanDONum = RS_SETTINGS->readEntry("/fan");
RS_SETTINGS->endGroup();
ui->cbFanDONum->setCurrentText(fanDONum);
RS_SETTINGS->beginGroup("device/DO");
QString stopBtnDONum = RS_SETTINGS->readEntry("/stopBtn");
RS_SETTINGS->endGroup();
ui->cbStopBtnDONum->setCurrentText(stopBtnDONum);
RS_SETTINGS->beginGroup("device/DO");
QString runBtnDONum = RS_SETTINGS->readEntry("/runBtn");
RS_SETTINGS->endGroup();
ui->cbRunBtnDONum->setCurrentText(runBtnDONum);
RS_SETTINGS->beginGroup("device/DO");
QString lightSourceDONum = RS_SETTINGS->readEntry("/Vacuumbreak");
RS_SETTINGS->endGroup();
ui->cbLightSourceDONum->setCurrentText(lightSourceDONum);
RS_SETTINGS->beginGroup("device/DO");
QString LightDoStr = RS_SETTINGS->readEntry("/Light");
RS_SETTINGS->endGroup();
ui->cbLightDONum->setCurrentText(LightDoStr);
DEV->devLightNum = LightDoStr.toInt();
RS_SETTINGS->beginGroup("device/DI");
QString runBtnDINumStr = RS_SETTINGS->readEntry("/runBtn");
RS_SETTINGS->endGroup();
ui->cbRunBtnDINum->setCurrentText(runBtnDINumStr);
RS_SETTINGS->beginGroup("device/DI");
QString stopBtnDINumStr = RS_SETTINGS->readEntry("/stopBtn");
RS_SETTINGS->endGroup();
ui->cbStopBtnDINum->setCurrentText(stopBtnDINumStr);
RS_SETTINGS->beginGroup("device/DI");
QString estopBtnDINumStr = RS_SETTINGS->readEntry("/EstopBtn");
RS_SETTINGS->endGroup();
ui->cbEStopDINum->setCurrentText(estopBtnDINumStr);
RS_SETTINGS->beginGroup("device/DI");
QString door1DINumStr = RS_SETTINGS->readEntry("/doorDetection1");
RS_SETTINGS->endGroup();
ui->cbDoorDINum1->setCurrentText(door1DINumStr);
RS_SETTINGS->beginGroup("device/DI");
QString door2DINumStr = RS_SETTINGS->readEntry("/doorDetection2");
RS_SETTINGS->endGroup();
ui->cbDoorDINum2->setCurrentText(door2DINumStr);
RS_SETTINGS->beginGroup("device/DI");
QString AirValveCloseDINumStr = RS_SETTINGS->readEntry("/AirValveCloseDINum");
RS_SETTINGS->endGroup();
ui->cbAirValveCloseDINum->setCurrentText(AirValveCloseDINumStr);
RS_SETTINGS->beginGroup("device/DI");
QString CuCeGaoDINumStr = RS_SETTINGS->readEntry("/CuCeGaoDINum");
RS_SETTINGS->endGroup();
ui->cbCuCeGaoDINum->setCurrentText(CuCeGaoDINumStr);
RS_SETTINGS->beginGroup("device/DI");
QString AirValveOpenDINumStr = RS_SETTINGS->readEntry("/AirValveOpenDINum");
RS_SETTINGS->endGroup();
ui->cbAirValveOpenDINum->setCurrentText(AirValveOpenDINumStr);
RS_SETTINGS->beginGroup("device/DI");
QString CuCeGaoDINumDINumStr = RS_SETTINGS->readEntry("/CuCeGaoDINum");
RS_SETTINGS->endGroup();
ui->cbCuCeGaoDINum->setCurrentText(CuCeGaoDINumDINumStr);
RS_SETTINGS->beginGroup("device/DO");
QString AirValveDoStr = RS_SETTINGS->readEntry("/AirValveDo");
QString AirValveDoStr2 = RS_SETTINGS->readEntry("/AirValveDo2");
RS_SETTINGS->endGroup();
ui->cbAirValveDONum->setCurrentText(AirValveDoStr);
RS_SETTINGS->beginGroup("device/DO");
QString CuCeGaoDoStr = RS_SETTINGS->readEntry("/CuCeGaoDo");
RS_SETTINGS->endGroup();
ui->cbCucegaoDONum->setCurrentText(CuCeGaoDoStr);
//ui->cbAirValveDONum_2->setCurrentText(AirValveDoStr2);
RS_SETTINGS->beginGroup("device/DO");
QString Pin18DoStr = RS_SETTINGS->readEntry("/Pin18Do");
RS_SETTINGS->endGroup();
ui->cbPin18DONum->setCurrentText(Pin18DoStr);
RS_SETTINGS->beginGroup("device/DI");
QString AllPressureDINumStr = RS_SETTINGS->readEntry("/AllPressureDINum");
RS_SETTINGS->endGroup();
ui->cbAllPressureDINum->setCurrentText(AllPressureDINumStr);
RS_SETTINGS->beginGroup("device/DI");
QString UPSStr = RS_SETTINGS->readEntry("/UPS");
RS_SETTINGS->endGroup();
ui->cbUPS->setCurrentText(UPSStr);
runBtnDINum = runBtnDINumStr.toInt();
stopBtnDINum = stopBtnDINumStr.toInt();
estopBtnDINum = estopBtnDINumStr.toInt();
door1DINum = door1DINumStr.toInt();
door2DINum = door2DINumStr.toInt();
airValveOpenNum = AirValveOpenDINumStr.toInt();
airValveCloseNum = AirValveCloseDINumStr.toInt();
CuCeGaoNumDo = CuCeGaoDoStr.toInt();
CuCeGaoNumDi = CuCeGaoDINumStr.toInt();
AllPressureDINum = AllPressureDINumStr.toInt();
UPS = UPSStr.toInt();
DEV->runBtnDINum = runBtnDINum;
DEV->stopBtnDINum = stopBtnDINum;
DEV->estopBtnDINum = estopBtnDINum;
DEV->door1DINum = door1DINum;
DEV->door2DINum = door2DINum;
DEV->airValveOpenNum = airValveOpenNum;
DEV->airValveCloseNum = airValveCloseNum;
DEV->airValveDoNum = AirValveDoStr.toInt();
DEV->airValveDoNum2 = AirValveDoStr2.toInt();
DEV->CuCeGaoDoNum = CuCeGaoDoStr.toInt();
DEV->CuCeGaoDINum = CuCeGaoDINumStr.toInt();
DEV->AllPressureDINum = AllPressureDINum;
DEV->UPSDINum = UPS;
//ui->label_26->setVisible(false);
//ui->cbLightSourceDONum->setVisible(false);
//ui->chkLightSource->setVisible(false);
}
void IOSetWidget::on_sbRSECATAddr_valueChanged(int value)
{
RS_SETTINGS->beginGroup("device/RS");
RS_SETTINGS->writeEntry("/ECATAddr", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("测距传感器ECAT地址设置为%1").arg(value));
}
void IOSetWidget::on_sbDOECATAddr_valueChanged(int value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/ECATAddr", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("扩展DO模块ECAT地址设置为%1").arg(value));
}
void IOSetWidget::on_sbDIECATAddr_valueChanged(int value)
{
RS_SETTINGS->beginGroup("device/DI");
RS_SETTINGS->writeEntry("/ECATAddr", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("扩展DI模块ECAT地址设置为%1").arg(value));
}
void IOSetWidget::cbRedLightDONumCtTextChangedHandl(QString value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/redLight", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("红灯DO通道改变为%1").arg(value));
}
void IOSetWidget::cbLaserDONumCtTextChangedHandl(QString value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/laser", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("激光器DO通道改变为%1").arg(value));
DEV->devLaserNum = value.toInt();
}
void IOSetWidget::cbYellowDONumCtTextChangedHandl(QString value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/yellowLight", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("黄灯DO通道改变为%1").arg(value));
}
void IOSetWidget::cbVacuumSuckerDONumCtTextChangedHandl(QString value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/vacuumSucker", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("真空吸盘DO通道改变为%1").arg(value));
}
void IOSetWidget::cbGreenLightDONumCtTextChangedHandl(QString value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/greenLight", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("绿灯DO通道改变为%1").arg(value));
}
void IOSetWidget::on_chkRed_clicked()
{
bool flag;
flag = ui->chkRed->isChecked();
if (flag)
{
DEV->redLightOpen();
}
else
DEV->redLightClose();
}
void IOSetWidget::on_chkYallow_clicked()
{
bool flag;
flag = ui->chkYallow->isChecked();
if (flag)
{
DEV->yellowLightOpen();
}
else
DEV->yellowLightClose();
}
void IOSetWidget::on_chkGreen_clicked()
{
bool flag;
flag = ui->chkGreen->isChecked();
if (flag)
{
DEV->greenLightOpen();
}
else
DEV->greenLightClose();
}
void IOSetWidget::on_chkStopBtn_clicked()
{
bool flag;
flag = ui->chkStopBtn->isChecked();
if (flag)
{
DEV->StopBtnOpen();
}
else
DEV->StopBtnClose();
}
void IOSetWidget::on_chkRunBtn_clicked()
{
bool flag;
flag = ui->chkRunBtn->isChecked();
if (flag)
{
DEV->RunBtnOpen();
}
else
DEV->RunBtnClose();
}
void IOSetWidget::on_chkVacuumSucker_clicked()
{
bool flag;
flag = ui->chkVacuumSucker->isChecked();
if (flag)
{
DEV->vacuumSuckerOpen();
}
else
DEV->vacuumSuckerClose();
}
void IOSetWidget::on_chkLaser_clicked()
{
bool flag;
flag = ui->chkLaser->isChecked();
if (flag)
{
DEV->laserOpen();
}
else
DEV->laserClose();
}
void IOSetWidget::on_chkFan_clicked()
{
bool flag;
flag = ui->chkFan->isChecked();
if (flag)
{
DEV->FanOpen();
}
else
DEV->FanClose();
}
void IOSetWidget::on_chkLightSource_clicked()
{
bool flag;
flag = ui->chkLightSource->isChecked();
if (flag)
{
DEV->VacuumBreakOpen();
}
else
DEV->VacuumBreakClose();
}
void IOSetWidget::cbFanDONum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/fan", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("漩涡风机DO通道改变为%1").arg(value));
}
void IOSetWidget::cbLightSourceDONum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/Vacuumbreak", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("相机光源DO通道改变为%1").arg(value));
}
void IOSetWidget::cbRunBtnDONum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/runBtn", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("运行按钮DO通道改变为%1").arg(value));
}
void IOSetWidget::cbStopBtnDONum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/stopBtn", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("停止按钮DO通道改变为%1").arg(value));
}
void IOSetWidget::cbAirValveDONum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/AirValveDo", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("光学片DO通道改变为%1").arg(value));
DEV->airValveDoNum = value.toInt();
}
void IOSetWidget::cbCucegaoDONum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/CuCeGaoDo", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("粗测高头DO通道改变为%1").arg(value));
DEV->CuCeGaoDoNum = value.toInt();
}
void IOSetWidget::cbPin18DONum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/Pin18Do", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Pin引脚DO通道改变为%1").arg(value));
}
void IOSetWidget::cbLightDONum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DO");
RS_SETTINGS->writeEntry("/Light", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("机台照明灯DO通道改变为%1").arg(value));
DEV->devLightNum = value.toInt();
}
void IOSetWidget::cbStopBtnDINum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DI");
RS_SETTINGS->writeEntry("/stopBtn", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("停止按钮DI通道改变为%1").arg(value));
}
void IOSetWidget::cbRunBtnDINum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DI");
RS_SETTINGS->writeEntry("/runBtn", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("运行按钮DI通道改变为%1").arg(value));
}
void IOSetWidget::cbEStopDINum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DI");
RS_SETTINGS->writeEntry("/EstopBtn", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("急停按钮DI通道改变为%1").arg(value));
}
void IOSetWidget::cbDoorDINum1_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DI");
RS_SETTINGS->writeEntry("/doorDetection1", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("门禁按钮1 DI通道改变为%1").arg(value));
}
void IOSetWidget::cbAirValveOpenDINum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DI");
RS_SETTINGS->writeEntry("/AirValveOpenDINum", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("整形片开 DI通道改变为%1").arg(value));
DEV->airValveOpenNum = value.toInt();
}
void IOSetWidget::cbAirValveCloseDINum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DI");
RS_SETTINGS->writeEntry("/AirValveCloseDINum", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("整形片关 DI通道改变为%1").arg(value));
DEV->airValveCloseNum = value.toInt();
}
void IOSetWidget::cbCuCeGaoDINum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DI");
RS_SETTINGS->writeEntry("/CuCeGaoDINum", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("粗测高头 DI通道改变为%1").arg(value));
DEV->CuCeGaoDINum = value.toInt();
}
void IOSetWidget::cbDoorDINum2_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DI");
RS_SETTINGS->writeEntry("/doorDetection2", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("门禁按钮2 DI通道改变为%1").arg(value));
}
void IOSetWidget::cbAllPressureDINum_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DI");
RS_SETTINGS->writeEntry("/AllPressureDINum", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("总气压 DI通道改变为%1").arg(value));
DEV->airValveCloseNum = value.toInt();
}
void IOSetWidget::cbUPS_currentTextChanged(const QString &value)
{
RS_SETTINGS->beginGroup("device/DI");
RS_SETTINGS->writeEntry("/UPS", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("UPS DI通道改变为%1").arg(value));
DEV->airValveCloseNum = value.toInt();
}
void IOSetWidget::setInState(int value)
{
int mask;
mask = 1;
mask = mask<<runBtnDINum;
mask = (value&mask);
if(mask)
ui->chkRunBtnIn->setCheckState(Qt::Checked);
else
ui->chkRunBtnIn->setCheckState(Qt::Unchecked);
mask = 1;
mask = mask<<stopBtnDINum;
mask = (value&mask);
if(mask)
ui->chkStopBtnIn->setCheckState(Qt::Checked);
else
ui->chkStopBtnIn->setCheckState(Qt::Unchecked);
mask = 1;
mask = mask<<estopBtnDINum;
mask = (value&mask);
if(mask)
ui->chkEStopIn->setCheckState(Qt::Checked);
else
ui->chkEStopIn->setCheckState(Qt::Unchecked);
mask = 1;
mask = mask<<door1DINum;
mask = (value&mask);
if(mask)
ui->chkDoorIn1->setCheckState(Qt::Checked);
else
ui->chkDoorIn1->setCheckState(Qt::Unchecked);
mask = 1;
mask = mask<<door2DINum;
mask = (value&mask);
if(mask)
ui->chkdoorIn2->setCheckState(Qt::Checked);
else
ui->chkdoorIn2->setCheckState(Qt::Unchecked);
mask = 1;
mask = mask<<airValveOpenNum;
mask = (value&mask);
if(mask)
ui->chkAirValveOpenDINum->setCheckState(Qt::Checked);
else
ui->chkAirValveOpenDINum->setCheckState(Qt::Unchecked);
DEV->airValveDiOpenSts = mask;
mask = 1;
mask = mask<<airValveCloseNum;
mask = (value&mask);
if(mask)
ui->chkAirValveCloseDINum->setCheckState(Qt::Checked);
else
ui->chkAirValveCloseDINum->setCheckState(Qt::Unchecked);
DEV->airValveDiCloseSts = mask;
mask = 1;
mask = mask<<CuCeGaoNumDi;
mask = (value&mask);
if(mask)
ui->chkCuCeGaoDINum->setCheckState(Qt::Checked);
else
ui->chkCuCeGaoDINum->setCheckState(Qt::Unchecked);
//DEV->CuCeGaoDINum = mask;
mask = 1;
mask = mask<<AllPressureDINum;
mask = (value&mask);
if(mask)
ui->chkAllPressureDINum->setCheckState(Qt::Checked);
else
ui->chkAllPressureDINum->setCheckState(Qt::Unchecked);
mask = 1;
mask = mask<<UPS;
mask = (value&mask);
if(mask)
ui->chkUPS->setCheckState(Qt::Checked);
else
ui->chkUPS->setCheckState(Qt::Unchecked);
}
void IOSetWidget::on_chkCucegao_clicked()
{
bool flag;
flag = ui->chkCucegao->isChecked();
if (flag)
{
//DEV->AirValveOpen2();
DEV->CuCeGaoOpen();
}
else
{
DEV->CuCeGaoClose();
//DEV->AirValveClose2();
}
}
void IOSetWidget::on_chkAirValve_clicked()
{
bool flag;
flag = ui->chkAirValve->isChecked();
if (flag)
{
//DEV->AirValveOpen2();
DEV->AirValveOpen();
}
else
{
DEV->AirValveClose();
//DEV->AirValveClose2();
}
}
void IOSetWidget::on_chkPin18_clicked()
{
bool flag;
flag = ui->chkPin18->isChecked();
if (flag)
{
DEV->Pin18Open();
}
else
{
DEV->Pin18Close();
}
}
void IOSetWidget::on_chkLight_clicked()
{
bool flag;
flag = ui->chkLight->isChecked();
if (flag)
{
DEV->LightOpen();
}
else
DEV->LightClose();
}

90
device/ui/iosetwidget.h Normal file
View File

@@ -0,0 +1,90 @@
#ifndef IOSETWIDGET_H
#define IOSETWIDGET_H
#include <QFrame>
#include "ui_iosetwidget.h"
class IOSetWidget:public QFrame
{
Q_OBJECT
public:
explicit IOSetWidget(QWidget* parent=nullptr);
public slots:
void on_sbRSECATAddr_valueChanged(int value);
void on_sbDOECATAddr_valueChanged(int value);
void on_sbDIECATAddr_valueChanged(int value);
void cbRedLightDONumCtTextChangedHandl(QString value);
void cbLaserDONumCtTextChangedHandl(QString value);
void cbYellowDONumCtTextChangedHandl(QString value);
void cbVacuumSuckerDONumCtTextChangedHandl(QString value);
void cbGreenLightDONumCtTextChangedHandl(QString value);
void cbFanDONum_currentTextChanged(const QString &value);
void cbLightSourceDONum_currentTextChanged(const QString &value);
void cbRunBtnDONum_currentTextChanged(const QString &value);
void cbStopBtnDONum_currentTextChanged(const QString &value);
void cbStopBtnDINum_currentTextChanged(const QString &value);
void cbRunBtnDINum_currentTextChanged(const QString &value);
void cbEStopDINum_currentTextChanged(const QString &value);
void cbDoorDINum1_currentTextChanged(const QString &value);
void cbDoorDINum2_currentTextChanged(const QString &value);
void cbAirValveDONum_currentTextChanged(const QString &value);
void cbCucegaoDONum_currentTextChanged(const QString &value);
void cbPin18DONum_currentTextChanged(const QString &value);
void cbLightDONum_currentTextChanged(const QString &value);
// void cbAirValveDONum_2_currentTextChanged(const QString &value);
void cbAirValveOpenDINum_currentTextChanged(const QString &value);
void cbAirValveCloseDINum_currentTextChanged(const QString &value);
void cbCuCeGaoDINum_currentTextChanged(const QString &value);
void setInState(int value);
void cbAllPressureDINum_currentTextChanged(const QString &value);
void cbUPS_currentTextChanged(const QString &value);
private slots:
void on_chkRed_clicked();
void on_chkYallow_clicked();
void on_chkGreen_clicked();
void on_chkStopBtn_clicked();
void on_chkRunBtn_clicked();
void on_chkVacuumSucker_clicked();
void on_chkLaser_clicked();
void on_chkFan_clicked();
void on_chkLightSource_clicked();
void on_chkAirValve_clicked();
void on_chkCucegao_clicked();
void on_chkPin18_clicked();
void on_chkLight_clicked();
private:
void loadSet();
int runBtnDINum;
int stopBtnDINum;
int estopBtnDINum;
int door1DINum;
int door2DINum;
int airValveOpenNum;
int airValveCloseNum;
int CuCeGaoNumDo;
int CuCeGaoNumDi;
int AllPressureDINum;
int UPS;
private:
Ui::IOSetWidget* ui;
};
#endif // IOSETWIDGET_H

1796
device/ui/iosetwidget.ui Normal file

File diff suppressed because it is too large Load Diff

244
device/ui/lasermark.ui Normal file
View File

@@ -0,0 +1,244 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LaserMarkWidget</class>
<widget class="QWidget" name="LaserMarkWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>369</width>
<height>238</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>打标参数</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>激光频率:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="sbLaserFrequency">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>30000</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>字符高度:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="dsbCharHeight">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>字符宽度:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="dsbCharWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>字符间距:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="dsbCharInterval">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>激光脉宽:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="sbLaserPulseWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>字符数量</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>189</width>
<height>23</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>RFID字符个数</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMSpinBox" name="sbRfid">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>50</number>
</property>
<property name="stepType">
<enum>QAbstractSpinBox::DefaultStepType</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DMSpinBox</class>
<extends>QSpinBox</extends>
<header location="global">dmspinbox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,131 @@
#include "lasermarkwidget.h"
#include "deviceproxy.h"
#include "rs_settings.h"
#include "deviceinfo.h"
LaserMarkWidget::LaserMarkWidget(QWidget* parent):
QFrame(parent),
ui(new Ui::LaserMarkWidget)
{
ui->setupUi(this);
loadSet();
}
void LaserMarkWidget::loadSet()
{
RS_SETTINGS->beginGroup("device/LaserMark");
int RFIDCount = RS_SETTINGS->readNumEntry("/RFIDCount");
RS_SETTINGS->endGroup();
ui->sbRfid->setValue(RFIDCount);
{
RS_SETTINGS->beginGroup("device/LaserMark");
double charHeight = RS_SETTINGS->readNumDEntry("/CharHeight");
RS_SETTINGS->endGroup();
ui->dsbCharHeight->setValue(charHeight);
DEV->laserMarkHeight = charHeight;
}
{
RS_SETTINGS->beginGroup("device/LaserMark");
double CharWidth = RS_SETTINGS->readNumDEntry("/CharWidth");
RS_SETTINGS->endGroup();
ui->dsbCharWidth->setValue(CharWidth);
DEV->laserMarkWidth = CharWidth;
}
{
RS_SETTINGS->beginGroup("device/LaserMark");
double CharInterval = RS_SETTINGS->readNumDEntry("/CharInterval");
RS_SETTINGS->endGroup();
ui->dsbCharInterval->setValue(CharInterval);
DEV->laserMarkInternal = CharInterval;
}
{
RS_SETTINGS->beginGroup("device/LaserMark");
int LaserFrequency = RS_SETTINGS->readNumEntry("/LaserFrequency");
RS_SETTINGS->endGroup();
ui->sbLaserFrequency->setValue(LaserFrequency);
DEV->laserMarkFrequency = LaserFrequency;
}
{
RS_SETTINGS->beginGroup("device/LaserMark");
int LaserPulseWidth = RS_SETTINGS->readNumEntry("/LaserPulseWidth");
RS_SETTINGS->endGroup();
ui->sbLaserPulseWidth->setValue(LaserPulseWidth);
DEV->laserMarkPulseWidth = LaserPulseWidth;
}
}
void LaserMarkWidget::on_sbRfid_valueChanged(int arg1)
{
RS_SETTINGS->beginGroup("device/LaserMark");
RS_SETTINGS->writeEntry("/RFIDCount", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("RFID字符个数改变为%1/s").arg(arg1));
}
void LaserMarkWidget::on_dsbCharHeight_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/LaserMark");
RS_SETTINGS->writeEntry("/CharHeight", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("字符高度改变为:%1mm/s").arg(arg1));
DEV->laserMarkHeight = arg1;
}
void LaserMarkWidget::on_dsbCharWidth_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/LaserMark");
RS_SETTINGS->writeEntry("/CharWidth", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("字符宽度改变为:%1mm/s").arg(arg1));
DEV->laserMarkWidth = arg1;
}
void LaserMarkWidget::on_dsbCharInterval_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/LaserMark");
RS_SETTINGS->writeEntry("/CharInterval", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("字符间隔改变为:%1mm/s").arg(arg1));
DEV->laserMarkInternal = arg1;
}
void LaserMarkWidget::on_sbLaserFrequency_valueChanged(int arg1)
{
RS_SETTINGS->beginGroup("device/LaserMark");
RS_SETTINGS->writeEntry("/LaserFrequency", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("打标激光器频率改变为:%1").arg(arg1));
DEV->laserMarkFrequency = arg1;
}
void LaserMarkWidget::on_sbLaserPulseWidth_valueChanged(int arg1)
{
RS_SETTINGS->beginGroup("device/LaserMark");
RS_SETTINGS->writeEntry("/LaserPulseWidth", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("打标激光器脉宽改变为:%1").arg(arg1));
DEV->laserMarkPulseWidth = arg1;
}

View File

@@ -0,0 +1,29 @@
#ifndef LASERMARKWIDGET_H
#define LASERMARKWIDGET_H
#include "ui_lasermark.h"
class LaserMarkWidget:public QFrame
{
Q_OBJECT
public:
explicit LaserMarkWidget(QWidget* parent=nullptr);
private slots:
void on_sbRfid_valueChanged(int arg1);
void on_dsbCharHeight_valueChanged(double arg1);
void on_dsbCharWidth_valueChanged(double arg1);
void on_dsbCharInterval_valueChanged(double arg1);
void on_sbLaserFrequency_valueChanged(int arg1);
void on_sbLaserPulseWidth_valueChanged(int arg1);
private:
Ui::LaserMarkWidget* ui;
void loadSet();
};
#endif // LASERMARKWIDGET_H

161
device/ui/login.ui Normal file
View File

@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LogIn</class>
<widget class="QDialog" name="LogIn">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>470</width>
<height>313</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>470</width>
<height>313</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QLineEdit" name="Password">
<property name="geometry">
<rect>
<x>170</x>
<y>120</y>
<width>171</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>xhyq</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>60</x>
<y>120</y>
<width>101</width>
<height>31</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>51</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>密码:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QPushButton" name="LogInUser">
<property name="geometry">
<rect>
<x>170</x>
<y>180</y>
<width>171</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>登 录</string>
</property>
</widget>
<widget class="QComboBox" name="cmbType">
<property name="geometry">
<rect>
<x>170</x>
<y>80</y>
<width>171</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<item>
<property name="text">
<string>用户</string>
</property>
</item>
<item>
<property name="text">
<string>厂家</string>
</property>
</item>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>60</x>
<y>80</y>
<width>101</width>
<height>31</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>51</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>权限选择:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
<tabstops>
<tabstop>Password</tabstop>
<tabstop>LogInUser</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,538 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MRCameraSetWidget</class>
<widget class="QWidget" name="MRCameraSetWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>483</width>
<height>363</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>469</width>
<height>349</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="title">
<string>轴当前位置</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,1">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>X:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbXAxisCtPos">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8" stretch="0,1">
<item>
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Y:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbYAxisCtPos">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9" stretch="0,1">
<item>
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Z1:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbZAxisCtPos">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10" stretch="0,1">
<item>
<widget class="QLabel" name="label_9">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Z:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbZAAxisCtPos">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="title">
<string>标定</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="pbMHPosRecord">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>加工头位置:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lbMHCalibPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pbRHPosRecord">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>测距头位置:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="lbRHCalibPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pbCameraPosRecord">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string>相机位置:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="lbCameraCalibPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="title">
<string>相机|测距头|加工头位置切换速度</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>X:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbXAxisVel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm/s</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>800.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Y:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbYAxisVel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm/s</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>800.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>33</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DMDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global">dmdoublespinbox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,130 @@
#include "mrccamerasetwidget.h"
#include "deviceproxy.h"
#include "rs_settings.h"
#include "deviceproxy.h"
#include "rs_settings.h"
#include "deviceinfo.h"
MRCameraSetWidget::MRCameraSetWidget(QWidget* parent)
:QFrame(parent)
,ui(new Ui::MRCameraSetWidget)
{
ui->setupUi(this);
loadSet();
connect(DEV,SIGNAL(XAxisCtPosSGL(double)),this,SLOT(setXAxisCtPos(double)));
connect(DEV,SIGNAL(YAxisCtPosSGL(double)),this,SLOT(setYAxisCtPos(double)));
connect(DEV,SIGNAL(ZAxisCtPosSGL(double)),this,SLOT(setZAxisCtPos(double)));
connect(DEV,SIGNAL(ZAAxisCtPosSGL(double)),this,SLOT(setZAAxisCtPos(double)));
}
void MRCameraSetWidget::loadSet()
{
RS_SETTINGS->beginGroup("device/MRHCamera/calibPos");
double MHXAxis = RS_SETTINGS->readNumDEntry("/MHXAxis");
double MHYAxis = RS_SETTINGS->readNumDEntry("/MHYAxis");
ui->lbMHCalibPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(MHXAxis,'f',4)).arg(QString::number(MHYAxis,'f',4)));
double RHXAxis = RS_SETTINGS->readNumDEntry("/RHXAxis");
double RHYAxis = RS_SETTINGS->readNumDEntry("/RHYAxis");
ui->lbRHCalibPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(RHXAxis,'f',4)).arg(QString::number(RHYAxis,'f',4)));
double cameraXAxis = RS_SETTINGS->readNumDEntry("/cameraXAxis");
double cameraYAxis = RS_SETTINGS->readNumDEntry("/cameraYAxis");
ui->lbCameraCalibPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(cameraXAxis,'f',4)).arg(QString::number(cameraYAxis,'f',4)));
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/MRHCamera/switchVel");
double XAxis = RS_SETTINGS->readNumDEntry("/XAxis");
double YAxis = RS_SETTINGS->readNumDEntry("/YAxis");
ui->dsbXAxisVel->setValue(XAxis);
ui->dsbYAxisVel->setValue(YAxis);
RS_SETTINGS->endGroup();
}
void MRCameraSetWidget::on_dsbXAxisVel_valueChanged(const double& value)
{
RS_SETTINGS->beginGroup("device/MRHCamera/switchVel");
RS_SETTINGS->writeEntry("/XAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("加工头|测距头|相机切换X轴速度改变为%1mm/s").arg(QString::number(value,'f',4)));
}
void MRCameraSetWidget::on_dsbYAxisVel_valueChanged(const double& value)
{
RS_SETTINGS->beginGroup("device/MRHCamera/switchVel");
RS_SETTINGS->writeEntry("/YAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("加工头|测距头|相机切换Y轴速度改变为%1mm/s").arg(QString::number(value,'f',4)));
}
void MRCameraSetWidget::on_pbMHPosRecord_clicked()
{
ui->lbMHCalibPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
RS_SETTINGS->beginGroup("device/MRHCamera/calibPos");
RS_SETTINGS->writeEntry("/MHXAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/MHYAxis", YAxisCtPos);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/MRHCamera");
RS_SETTINGS->writeEntry("/MHIsCalib", 1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("加工头标定位置改变为:(X)%1mm;(Y)%2mm").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
}
void MRCameraSetWidget::on_pbRHPosRecord_clicked()
{
ui->lbRHCalibPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
RS_SETTINGS->beginGroup("device/MRHCamera/calibPos");
RS_SETTINGS->writeEntry("/RHXAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/RHYAxis", YAxisCtPos);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/MRHCamera");
RS_SETTINGS->writeEntry("/RHIsCalib", 1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("测距头标定位置改变为:(X)%1mm;(Y)%2mm").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
}
void MRCameraSetWidget::on_pbCameraPosRecord_clicked()
{
ui->lbCameraCalibPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
RS_SETTINGS->beginGroup("device/MRHCamera/calibPos");
RS_SETTINGS->writeEntry("/cameraXAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/cameraYAxis", YAxisCtPos);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/MRHCamera");
RS_SETTINGS->writeEntry("/cameraIsCalib", 1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("相机标定位置改变为:(X)%1mm;(Y)%2mm").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
}
void MRCameraSetWidget::setXAxisCtPos(double value)
{
XAxisCtPos = value;
ui->lbXAxisCtPos->setText(QString("%1mm").arg(QString::number(value,'f',4)));
}
void MRCameraSetWidget::setYAxisCtPos(double value)
{
YAxisCtPos = value;
ui->lbYAxisCtPos->setText(QString("%1mm").arg(QString::number(value,'f',4)));
}
void MRCameraSetWidget::setZAxisCtPos(double value)
{
ZAxisCtPos = value;
ui->lbZAxisCtPos->setText(QString("%1mm").arg(QString::number(value,'f',4)));
}
void MRCameraSetWidget::setZAAxisCtPos(double value)
{
ZAAxisCtPos = value;
ui->lbZAAxisCtPos->setText(QString("%1mm").arg(QString::number(value,'f',4)));
}

View File

@@ -0,0 +1,35 @@
#ifndef MRCAMERASETWIDGET_H
#define MRCAMERASETWIDGET_H
#include <QFrame>
#include "ui_mrcamerasetwidget.h"
class MRCameraSetWidget:public QFrame
{
Q_OBJECT
public:
explicit MRCameraSetWidget(QWidget* parent=nullptr);
public slots:
void on_dsbXAxisVel_valueChanged(const double& value);
void on_dsbYAxisVel_valueChanged(const double& value);
void on_pbMHPosRecord_clicked();
void on_pbRHPosRecord_clicked();
void on_pbCameraPosRecord_clicked();
void setXAxisCtPos(double value);
void setYAxisCtPos(double value);
void setZAxisCtPos(double value);
void setZAAxisCtPos(double value);
private:
void loadSet();
private:
Ui::MRCameraSetWidget* ui;
double XAxisCtPos{0.0};
double YAxisCtPos{0.0};
double ZAxisCtPos{0.0};
double ZAAxisCtPos{0.0};
};
#endif // MRCAMERASETWIDGET_H

View File

@@ -0,0 +1,209 @@
#include "processcriticalpossetwidget.h"
#include "deviceproxy.h"
#include "rs_settings.h"
#include "deviceinfo.h"
ProcessCriticalPosSetWidget::ProcessCriticalPosSetWidget(QWidget* parent)
:QFrame(parent)
,ui(new Ui::ProcessCriticalPosSetWidget)
{
ui->setupUi(this);
loadSet();
connect(DEV,SIGNAL(XAxisCtPosSGL(double)),this,SLOT(setXAxisCtPos(double)));
connect(DEV,SIGNAL(YAxisCtPosSGL(double)),this,SLOT(setYAxisCtPos(double)));
connect(DEV,SIGNAL(ZAxisCtPosSGL(double)),this,SLOT(setZAxisCtPos(double)));
connect(DEV,SIGNAL(ZAAxisCtPosSGL(double)),this,SLOT(setZAAxisCtPos(double)));
}
void ProcessCriticalPosSetWidget::loadSet()
{
RS_SETTINGS->beginGroup("device/LoadAndUnloadPos");
double XAxisPos = RS_SETTINGS->readNumDEntry("/XAxis");
double YAxisPos = RS_SETTINGS->readNumDEntry("/YAxis");
double ZAxisPos = RS_SETTINGS->readNumDEntry("/ZAxis");
ui->lbLoadAndUnloadPos->setText(QString("(X)%1mm;(Y)%2mm;(Z1)%3mm;").arg(QString::number(XAxisPos,'f',4)).arg(QString::number(YAxisPos,'f',4)).arg(QString::number(ZAxisPos,'f',4)));
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/LaserApTestPos");
XAxisPos = RS_SETTINGS->readNumDEntry("/XAxis");
YAxisPos = RS_SETTINGS->readNumDEntry("/YAxis");
ZAxisPos = RS_SETTINGS->readNumDEntry("/ZAAxis");
RS_SETTINGS->endGroup();
ui->lbLaserApTestPos->setText(QString("(X)%1mm;(Y)%2mm;(Z)%3mm;").arg(QString::number(XAxisPos,'f',4)).arg(QString::number(YAxisPos,'f',4)).arg(QString::number(ZAxisPos,'f',4)));
RS_SETTINGS->beginGroup("device/RSToZeroPos");
XAxisPos = RS_SETTINGS->readNumDEntry("/XAxis");
YAxisPos = RS_SETTINGS->readNumDEntry("/YAxis");
ui->lbRSToZeroPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisPos,'f',4)).arg(QString::number(YAxisPos,'f',4)));
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/HeightFindPos");
XAxisPos = RS_SETTINGS->readNumDEntry("/XAxis");
YAxisPos = RS_SETTINGS->readNumDEntry("/YAxis");
ui->lbHeightFindPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisPos,'f',4)).arg(QString::number(YAxisPos,'f',4)));
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/CompenTestPos");
XAxisPos = RS_SETTINGS->readNumDEntry("/XAxis");
YAxisPos = RS_SETTINGS->readNumDEntry("/YAxis");
ui->lbCompenTestPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisPos,'f',4)).arg(QString::number(YAxisPos,'f',4)));
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/EdgeSearchPos");
XAxisPos = RS_SETTINGS->readNumDEntry("/XAxis");
YAxisPos = RS_SETTINGS->readNumDEntry("/YAxis");
ui->lbEdgeSearchPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisPos,'f',4)).arg(QString::number(YAxisPos,'f',4)));
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/LaserMarkPos");
XAxisPos = RS_SETTINGS->readNumDEntry("/XAxis");
YAxisPos = RS_SETTINGS->readNumDEntry("/YAxis");
ui->lbLaserMarkPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisPos,'f',4)).arg(QString::number(YAxisPos,'f',4)));
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/GlobalCameraPos");
XAxisPos = RS_SETTINGS->readNumDEntry("/XAxis");
YAxisPos = RS_SETTINGS->readNumDEntry("/YAxis");
ui->lbGlobalCamera->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisPos,'f',4)).arg(QString::number(YAxisPos,'f',4)));
RS_SETTINGS->endGroup();
// ui->label_7->setVisible(false);
// ui->pbHeightFindPosRecord->setVisible(false);
// ui->lbHeightFindPos->setVisible(false);
}
void ProcessCriticalPosSetWidget::on_pbLoadAndUnloadPosRecord_clicked()
{
ui->lbLoadAndUnloadPos->setText(QString("(X)%1mm;(Y)%2mm;(Z1)%3mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(YAxisCtPos).arg(QString::number(ZAxisCtPos,'f',4)));
RS_SETTINGS->beginGroup("device/LoadAndUnloadPos");
RS_SETTINGS->writeEntry("/XAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/YAxis", YAxisCtPos);
RS_SETTINGS->writeEntry("/ZAxis", ZAxisCtPos);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("上下料位置改变为:(X)%1mm;(Y)%2mm; (Z1)%3mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)).arg(QString::number(ZAxisCtPos,'f',4)));
}
void ProcessCriticalPosSetWidget::on_pbRSToZeroPosRecord_clicked()
{
ui->lbRSToZeroPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
RS_SETTINGS->beginGroup("device/RSToZeroPos");
RS_SETTINGS->writeEntry("/XAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/YAxis", YAxisCtPos);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("测距传感器对零位置改变为:(X)%1mm; (Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
}
//void ProcessCriticalPosSetWidget::on_pbSScanStartPosRecord_clicked()
//{
// ui->lbSScanStartPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
// RS_SETTINGS->beginGroup("device/SScanStartPos");
// RS_SETTINGS->writeEntry("/XAxis", XAxisCtPos);
// RS_SETTINGS->writeEntry("/YAxis", YAxisCtPos);
// RS_SETTINGS->endGroup();
// DEVICE_INFO->printDeviceSystemInfo(QString("扫描补偿起始位置改变为:(X)%1mm; (Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
//}
//void ProcessCriticalPosSetWidget::on_pbMachStartPosRecord_clicked()
//{
// ui->lbMachStartPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
// RS_SETTINGS->beginGroup("device/MachStartPos");
// RS_SETTINGS->writeEntry("/XAxis", XAxisCtPos);
// RS_SETTINGS->writeEntry("/YAxis", YAxisCtPos);
// RS_SETTINGS->endGroup();
// DEVICE_INFO->printDeviceSystemInfo(QString("加工起始位置改变为:(X)%1mm; (Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
//}
void ProcessCriticalPosSetWidget::setXAxisCtPos(double value)
{
XAxisCtPos = value;
ui->lbXAxisCtPos->setText(QString("%1mm").arg(QString::number(value,'f',4)));
}
void ProcessCriticalPosSetWidget::setYAxisCtPos(double value)
{
YAxisCtPos = value;
ui->lbYAxisCtPos->setText(QString("%1mm").arg(QString::number(value,'f',4)));
}
void ProcessCriticalPosSetWidget::setZAxisCtPos(double value)
{
ZAxisCtPos = value;
ui->lbZAxisCtPos->setText(QString("%1mm").arg(QString::number(value,'f',4)));
}
void ProcessCriticalPosSetWidget::setZAAxisCtPos(double value)
{
ZAAxisCtPos = value;
ui->lbZAAxisCtPos->setText(QString("%1mm").arg(QString::number(value,'f',4)));
}
void ProcessCriticalPosSetWidget::on_pbLaserApTestPos_clicked()
{
ui->lbLaserApTestPos->setText(QString("(X)%1mm;(Y)%2mm;(Z)%3mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)).arg(QString::number(ZAAxisCtPos,'f',4)));
RS_SETTINGS->beginGroup("device/LaserApTestPos");
RS_SETTINGS->writeEntry("/XAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/YAxis", YAxisCtPos);
RS_SETTINGS->writeEntry("/ZAAxis", ZAAxisCtPos);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("功率测量位置改变为:(X)%1mm; (Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
}
void ProcessCriticalPosSetWidget::on_pbHeightFindPosRecord_clicked()
{
ui->lbHeightFindPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
RS_SETTINGS->beginGroup("device/HeightFindPos");
RS_SETTINGS->writeEntry("/XAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/YAxis", YAxisCtPos);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("电阻测量位置改变为:(X)%1mm; (Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
}
void ProcessCriticalPosSetWidget::on_pbCompenTestPosRecord_clicked()
{
ui->lbCompenTestPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
RS_SETTINGS->beginGroup("device/CompenTestPos");
RS_SETTINGS->writeEntry("/XAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/YAxis", YAxisCtPos);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("上料准备位置改变为:(X)%1mm; (Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
}
void ProcessCriticalPosSetWidget::on_pbEdgeSearch_clicked()
{
ui->lbEdgeSearchPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
RS_SETTINGS->beginGroup("device/EdgeSearchPos");
RS_SETTINGS->writeEntry("/XAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/YAxis", YAxisCtPos);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("寻边位置改变为:(X)%1mm; (Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
}
void ProcessCriticalPosSetWidget::on_pbLaserMark_clicked()
{
ui->lbLaserMarkPos->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
RS_SETTINGS->beginGroup("device/LaserMarkPos");
RS_SETTINGS->writeEntry("/XAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/YAxis", YAxisCtPos);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("打标位置改变为:(X)%1mm; (Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
}
void ProcessCriticalPosSetWidget::on_pbGlobalCamera_clicked()
{
ui->lbGlobalCamera->setText(QString("(X)%1mm;(Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
RS_SETTINGS->beginGroup("device/GlobalCameraPos");
RS_SETTINGS->writeEntry("/XAxis", XAxisCtPos);
RS_SETTINGS->writeEntry("/YAxis", YAxisCtPos);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("全局相机位置改变为:(X)%1mm; (Y)%2mm;").arg(QString::number(XAxisCtPos,'f',4)).arg(QString::number(YAxisCtPos,'f',4)));
}

View File

@@ -0,0 +1,48 @@
#ifndef PROCESSCRITICALPOSSETWIDGET_H
#define PROCESSCRITICALPOSSETWIDGET_H
#include <QFrame>
#include "ui_processcriticalpossetwidget.h"
class ProcessCriticalPosSetWidget:public QFrame
{
Q_OBJECT
public:
explicit ProcessCriticalPosSetWidget(QWidget* parent=nullptr);
private slots:
void on_pbLoadAndUnloadPosRecord_clicked();
void on_pbRSToZeroPosRecord_clicked();
//void on_pbSScanStartPosRecord_clicked();
//void on_pbMachStartPosRecord_clicked();
void setXAxisCtPos(double value);
void setYAxisCtPos(double value);
void setZAxisCtPos(double value);
void setZAAxisCtPos(double value);
void on_pbLaserApTestPos_clicked();
void on_pbHeightFindPosRecord_clicked();
void on_pbCompenTestPosRecord_clicked();
void on_pbEdgeSearch_clicked();
void on_pbLaserMark_clicked();
void on_pbGlobalCamera_clicked();
private:
void loadSet();
private:
Ui::ProcessCriticalPosSetWidget* ui;
double XAxisCtPos{0.0};
double YAxisCtPos{0.0};
double ZAxisCtPos{0.0};
double ZAAxisCtPos{0.0};
};
#endif // PROCESSCRITICALPOSSETWIDGET_H

View File

@@ -0,0 +1,682 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProcessCriticalPosSetWidget</class>
<widget class="QWidget" name="ProcessCriticalPosSetWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>389</width>
<height>406</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>375</width>
<height>392</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>121</height>
</size>
</property>
<property name="title">
<string>轴当前位置</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>X:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbXAxisCtPos">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1">
<item>
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Y:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbYAxisCtPos">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,1">
<item>
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Z1:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbZAxisCtPos">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,1">
<item>
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Z:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbZAAxisCtPos">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>记录位置</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
<item>
<widget class="QPushButton" name="pbLoadAndUnloadPosRecord">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>上下料位置:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbLoadAndUnloadPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,0,1">
<item>
<widget class="QPushButton" name="pbRSToZeroPosRecord">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>对零位置:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbRSToZeroPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,0,1">
<item>
<widget class="QPushButton" name="pbHeightFindPosRecord">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>电阻测量位置:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbHeightFindPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_8" stretch="0,0,1">
<item>
<widget class="QPushButton" name="pbCompenTestPosRecord">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>上料准备位:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbCompenTestPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_10" stretch="0,0,1">
<item>
<widget class="QPushButton" name="pbLaserApTestPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>功率测量位置:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbLaserApTestPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_11" stretch="0,0,1">
<item>
<widget class="QPushButton" name="pbEdgeSearch">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>寻边位置:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbEdgeSearchPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_12" stretch="0,0,1">
<item>
<widget class="QPushButton" name="pbLaserMark">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>打标位置:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbLaserMarkPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_13" stretch="0,0,1">
<item>
<widget class="QPushButton" name="pbGlobalCamera">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>全局相机位置:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbGlobalCamera">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,50 @@
#include "rstozerosetwidget.h"
#include "deviceproxy.h"
#include "rs_settings.h"
#include "deviceinfo.h"
RSToZeroSetWidget::RSToZeroSetWidget(QWidget* parent)
:QFrame(parent)
,ui(new Ui::RSToZeroSetWidget)
{
ui->setupUi(this);
loadSet();
}
void RSToZeroSetWidget::loadSet()
{
// 加载PTP位置设置
RS_SETTINGS->beginGroup("device/RSTZVel");
double Vel1 = RS_SETTINGS->readNumDEntry("/Vel1");
double Vel2 = RS_SETTINGS->readNumDEntry("/Vel2");
double Vel3 = RS_SETTINGS->readNumDEntry("/Vel3");
RS_SETTINGS->endGroup();
ui->dsbZAAxisToZero1Vel->setValue(Vel1);
ui->dsbZAAxisToZero2Vel->setValue(Vel2);
ui->dsbZAAxisToZero3Vel->setValue(Vel3);
}
void RSToZeroSetWidget::on_dsbZAAxisToZero1Vel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/RSTZVel");
RS_SETTINGS->writeEntry("/Vel1", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("Z轴回零速度1改变为%1mm/s").arg(value));
}
void RSToZeroSetWidget::on_dsbZAAxisToZero2Vel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/RSTZVel");
RS_SETTINGS->writeEntry("/Vel2", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("Z轴回零速度2改变为%1mm/s").arg(value));
}
void RSToZeroSetWidget::on_dsbZAAxisToZero3Vel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/RSTZVel");
RS_SETTINGS->writeEntry("/Vel3", value);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("Z轴回零速度3改变为%1mm/s").arg(value));
}

View File

@@ -0,0 +1,25 @@
#ifndef RSTOZEROSETWIDGET_H
#define RSTOZEROSETWIDGET_H
#include <QFrame>
#include "ui_rstozerosetwidget.h"
class RSToZeroSetWidget:public QFrame
{
Q_OBJECT
public:
explicit RSToZeroSetWidget(QWidget* parent=nullptr);
private slots:
void on_dsbZAAxisToZero1Vel_valueChanged(double value);
void on_dsbZAAxisToZero2Vel_valueChanged(double value);
void on_dsbZAAxisToZero3Vel_valueChanged(double value);
private:
void loadSet();
private:
Ui::RSToZeroSetWidget* ui;
};
#endif // RSTOZEROSETWIDGET_H

View File

@@ -0,0 +1,289 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RSToZeroSetWidget</class>
<widget class="QWidget" name="RSToZeroSetWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>307</width>
<height>115</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>293</width>
<height>101</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>41</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>速度1:</string>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbZAAxisToZero1Vel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>202</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm/s</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>20.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>速度2:</string>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbZAAxisToZero2Vel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>202</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm/s</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>20.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>速度3:</string>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbZAAxisToZero3Vel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>202</width>
<height>21</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>mm/s</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000100000000000</double>
</property>
<property name="maximum">
<double>20.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DMDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global">dmdoublespinbox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,873 @@
#include "serialdevicetest.h"
#include <QSettings>
#include <QString>
#include <QDebug>
#include "deviceinfo.h"
#include "deviceproxy.h"
#include "rs_settings.h"
#include <QFile>
bool bReadApFlag{false};
struct PID_PARAM {
float SetValue; //定义设定值
float ActualValue; //定义实际值
float err; //定义偏差值
float err_last; //定义上一个偏差值
float Kp, Ki, Kd; //定义比例、积分、微分系数
//float voltage; //定义电压值(控制执行器的变量)
float err_next;
};
PID_PARAM gtPid = { 0 };
SerialDeviceTest::SerialDeviceTest(QWidget *parent):
QFrame(parent),
ui(new Ui::SerialDeviceTest)
{
ui->setupUi(this);
// 获取文本光标(不是鼠标光标)
int brightness;
RS_SETTINGS->beginGroup("device/LightSource");
brightness = RS_SETTINGS->readNumEntry("/brightnessFind");
//Strobe = RS_SETTINGS->readNumEntry("/StrobeFind");
RS_SETTINGS->endGroup();
ui->spBrightness->setValue(brightness);
//ui->spStrobe->setValue(Strobe);
LIGHTSOURCEFIND->getSerialSet("lightsource");
LIGHTSOURCEFIND->getChnId("lightsource");
MODBUSTCP->getModbusPara("ModbusTCP");
//POWERMATT->getSerialSet("gonglvshuaijianqi");
POWERMETERLIGHT->getSerialSet("guanglugonglvji");
POWERMETERMACH->getSerialSet("jiagonggonglvji");
if (POWERMETERMACH->m_hComm == nullptr)
{
POWERMETERMACH->OpenComm();
}
if (POWERMETERLIGHT->m_hComm == nullptr)
{
POWERMETERLIGHT->OpenComm();
}
// if (POWERMATT->m_hComm == nullptr)
// {
// POWERMATT->OpenComm();
// }
// POWERMATT->setPos(-5485);
// gtPid.Kp = POWERMATT->pidP;
// gtPid.SetValue = POWERMATT->dstPower;
IPGLASER->getIPGLaerPara("IPGLaser");
if (IPGLASER->m_hComm == nullptr)
{
IPGLASER->OpenComm();
IPGLASER->SetParam(1);
}
HeartBeat();
HeartBeat_fl();
ReadApValue();
//PID_proc();
ui->grpCuHeightFind->setHidden(true);
connect(DEV,SIGNAL(PowerMeterValueSGL(float,float)),this,SLOT(updatePowerMeterValue(float,float)));
}
SerialDeviceTest::~SerialDeviceTest()
{
delete ui;
}
void SerialDeviceTest::updatePowerMeterValue(float value,float average_value)
{
QString strValue = QString::number(static_cast<double>(value),'f', 3) + " " + QString::number(static_cast<double>(average_value),'f', 3);
ui->lbPowerValue->setText(strValue);
}
void SerialDeviceTest::on_pbPowerRead_clicked()
{
float value = 0;
if (ui->cmbPowerMeterID->currentText() == "加工功率计")
{
// if (POWERMETERMACH->m_hComm == nullptr)
// {
// POWERMETERMACH->getSerialSet("jiagonggonglvji");
// bool ret = POWERMETERMACH->OpenComm();
// if (!ret)
// {
// showExceptionInfoDialog("加工功率计串口打开错误!");
// DEVICE_INFO->printDeviceSystemInfo("加工功率计串口打开错误!");
// return;
// }
// }
// int ret = POWERMETERMACH->GetValue(&value);
// if (ret != 0)
// {
// showExceptionInfoDialog("加工功率计数据读取失败!");
// DEVICE_INFO->printDeviceSystemInfo("加工功率计数据读取失败!");
// return;
// }
// POWERMETERMACH->CloseComm();
bReadApFlag = true;
}
if (ui->cmbPowerMeterID->currentText() == "光路功率计")
{
if (POWERMETERLIGHT->m_hComm == nullptr)
{
POWERMETERLIGHT->getSerialSet("guanglugonglvji");
bool ret = POWERMETERLIGHT->OpenComm();
if (!ret)
{
showExceptionInfoDialog("光路功率计串口打开错误!");
DEVICE_INFO->printDeviceSystemInfo("光路功率计串口打开错误!");
return;
}
}
int ret = POWERMETERLIGHT->GetValue(&value);
if (ret != 0)
{
showExceptionInfoDialog("光路功率计数据读取失败!");
DEVICE_INFO->printDeviceSystemInfo("光路功率计数据读取失败!");
return;
}
}
QString strValue = QString::number(static_cast<double>(value),'f', 4);
ui->lbPowerValue->setText(strValue);
}
void SerialDeviceTest::on_pbBarometer_clicked()
{
short value = 0;
if (BAROMETER->m_hComm == nullptr)
{
BAROMETER->getSerialSet("barometer");
bool ret = BAROMETER->OpenComm();
if (!ret)
{
showExceptionInfoDialog("气压计串口打开错误!");
DEVICE_INFO->printDeviceSystemInfo("气压计串口打开错误!");
return;
}
}
int ret = BAROMETER->GetHeightValue(18,1,&value);
if (ret != 0)
{
showExceptionInfoDialog("气压计数据读取失败!");
DEVICE_INFO->printDeviceSystemInfo("气压计数据读取失败!");
return;
}
double tmp = value / 10.0;
QString strValue = QString::number(tmp,'f', 4);
ui->lbBarometer->setText(strValue+ " Kpa");
}
void SerialDeviceTest::on_pbCuHeightFind_clicked()
{
double value = 0;
if (PANHEIGHTFIND->m_hComm == nullptr)
{
PANHEIGHTFIND->getSerialSet("cucegaotou");
bool ret = PANHEIGHTFIND->OpenComm();
if (!ret)
{
showExceptionInfoDialog("粗测高头串口打开错误!");
return;
}
}
int ret = PANHEIGHTFIND->GetHeightValue(1,&value);
if (ret != 0)
{
showExceptionInfoDialog("粗测高头数据读取失败!");
return;
}
QString strValue = QString::number(value,'f', 4);
ui->lbCuHeightFind->setText(strValue);
}
void SerialDeviceTest::showExceptionInfoDialog(const QString& text,QMessageBox::Icon value)
{
QMessageBox msg(this);
DEVICE_INFO->printDeviceSalamInfo(text);
msg.setWindowTitle("异常提示");
msg.setText(text);
msg.setIcon(value);
msg.exec();
return;
}
float PID_increment(float temp_val)
{
/*传入目标值*/
gtPid.ActualValue = temp_val;
/*计算目标值与实际值的误差*/
gtPid.err = (gtPid.SetValue - gtPid.ActualValue);
if (fabs(gtPid.err) < 0.001)
{
return 0;
}
/*PID算法实现*/
//float increment_val = gtPid.Kp*(gtPid.err - gtPid.err_next) + gtPid.Ki*gtPid.err + gtPid.Kd*(gtPid.err - 2 * gtPid.err_next + gtPid.err_last);
/*累加*/
/*传递误差*/
gtPid.err_last = gtPid.err_next;
gtPid.err_next = gtPid.err;
/*返回当前实际值*/
//return increment_val;
return gtPid.err * gtPid.Kp;
}
int writepidfile(QString strFileName, float power,int pos,float apValue)
{
QFile filePid(strFileName);
if(filePid.open(QFile::WriteOnly|QFile::Append))
{
QTextStream filePidOut(&filePid);
filePidOut << power<<","<<pos<<","<<apValue;
filePidOut << "\n";
}
filePid.close();
}
int writePowerfile(QString strFileName, float powerP1,float powerP2)
{
QFile filePid(strFileName);
QDateTime datetime = QDateTime::currentDateTime();
QString timestr = datetime.toString("yyyy-MM-dd HH:mm:ss");
if(filePid.open(QFile::WriteOnly|QFile::Append))
{
QTextStream filePidOut(&filePid);
filePidOut << timestr<<","<<powerP1<<","<<powerP2;
filePidOut << "\n";
}
filePid.close();
}
//void myPidProc()
//{
// int ret;
// float power = 0;
// float ApValue;
// int count = 0;
// int sts;
// QString filename;
// QDateTime datetime = QDateTime::currentDateTime();
// QString timestr = datetime.toString("ddHHmmzzz");
// RS_SETTINGS->beginGroup("device/SSCS");
// QString path = RS_SETTINGS->readEntry("/dataSavePath");
// RS_SETTINGS->endGroup();
// if(path.right(1)!=QString("/"))
// {
// path+=QString("/");
// }
// filename = path+"LookupTable_"+timestr+"_pid.csv";
// while (1)
// {
// if ((DEV->PidFlag) && (DEV->devLaserState == 1))
// {
// count++;
// if (count > 2)
// {
// ret = POWERMATT->GetSts(&sts);
// if (sts == 0)
// {
// POWERMETERLIGHT->GetValue(&power);
// if (power > 0.05)
// {
// ApValue = PID_increment(power);
// int pos;
// POWERMATT->GetPos(&pos);
// writepidfile(filename, power,pos,ApValue);
// if(fabs((pos + 5485) / 5485) > 0.2)
// {
// POWERMATT->setPos(-5485);
// }
// else
// POWERMATT->setRPos(ApValue);
// }
// else
// {
// count = 0;
// }
// }
// }
// Sleep(5000);
// }
// else
// {
// count = 0;
// Sleep(200);
// }
// }
//}
void myReadPowerValue()
{
float power = 0;
float powerP2 = 0;
QString filename;
QDateTime datetime = QDateTime::currentDateTime();
QString timestr = datetime.toString("yyyyMMddHHmmss");
//QString timestr = datetime.toString("ddHHmmzzz");
RS_SETTINGS->beginGroup("device/SSCS");
QString path = RS_SETTINGS->readEntry("/dataSavePath");
RS_SETTINGS->endGroup();
if(path.right(1)!=QString("/"))
{
path+=QString("/");
}
filename = path+"LookupTable_"+timestr+"_laser_test.csv";
RS_SETTINGS->beginGroup("device/Rposition");
double p1k = RS_SETTINGS->readNumDEntry("/p1k");
double p1b = RS_SETTINGS->readNumDEntry("/p1b");
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS");
double PowerThreshold = RS_SETTINGS->readNumDEntry("/PowerThreshold");
RS_SETTINGS->endGroup();
unsigned int checkCount = 0;
while (1)
{
if ((DEV->PidFlag) && (DEV->devLaserState == 1) && (DEV->devLaserCheck))
{
if (checkCount > 6)
{
POWERMETERLIGHT->GetValue(&power);
if (DEV->LaserApValueP1 > 0.005)
{
double piancha = (DEV->ApPercentage*p1k + p1b - power) / (DEV->ApPercentage*p1k + p1b) * 100;//lihongchang
if ((abs(piancha) > PowerThreshold))
//if (DEV->PidFlag) 这里自动调节?还是报警。调节范围是多少?这里要记录成文件。怎么调节,调节要关激光的!?下一次调节?
{
emit DEV->AutoExceptSGL(MyException(QString("P1光路异常 ")+ QString::number(piancha,'f', 3)+QString(",是否停止当前加工激光偏差提示?")));
if (DEV->DataCheckFlag)
{
DEV->devLaserCheck = false;
}
}
}
}
checkCount++;
Sleep(5000);
}
else
{
Sleep(200);
checkCount = 0;
}
}
}
void myPidProc()
{
float power = 0;
float powerP2 = 0;
QString filename;
QDateTime datetime = QDateTime::currentDateTime();
QString timestr = datetime.toString("yyyyMMddHHmmss");
//QString timestr = datetime.toString("ddHHmmzzz");
RS_SETTINGS->beginGroup("device/SSCS");
QString path = RS_SETTINGS->readEntry("/dataSavePath");
RS_SETTINGS->endGroup();
if(path.right(1)!=QString("/"))
{
path+=QString("/");
}
filename = path+"LookupTable_"+timestr+"_laser_test.csv";
RS_SETTINGS->beginGroup("device/Rposition");
double p1kt = RS_SETTINGS->readNumDEntry("/p1k_t");
double p1bt = RS_SETTINGS->readNumDEntry("/p1b_t");
double p1ks = RS_SETTINGS->readNumDEntry("/p1k_s");
double p1bs = RS_SETTINGS->readNumDEntry("/p1b_s");
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS");
double PowerThreshold = RS_SETTINGS->readNumDEntry("/PowerThreshold");
RS_SETTINGS->endGroup();
unsigned int checkCount = 0;
while (1)
{
if ((DEV->PidFlag) && (DEV->devLaserState == 1) && (DEV->devLaserCheck))
{
if (checkCount > 6)
{
POWERMETERLIGHT->GetValue(&power);
if (DEV->LaserApValueP1 > 0.005)
{
double piancha;
if (DEV->Mach_T_S_flag == 1)
{
power = p1kt * power + p1bt;
piancha = abs((DEV->R_detection_pt - power) * 100);//lihongchang
}
else
{
power = p1ks * power + p1bs;
piancha = abs((DEV->R_detection_ps - power) * 100);//lihongchang
}
if ((abs(piancha) > PowerThreshold))
//if (DEV->PidFlag) 这里自动调节?还是报警。调节范围是多少?这里要记录成文件。怎么调节,调节要关激光的!?下一次调节?
{
emit DEV->AutoExceptSGL(MyException(QString("P1光路异常 ")+ QString::number(piancha,'f', 3)+QString(",是否停止当前加工激光偏差提示?")));
if (DEV->DataCheckFlag)
{
DEV->devLaserCheck = false;
}
}
}
}
checkCount++;
Sleep(5000);
}
else
{
Sleep(200);
checkCount = 0;
}
// if ((DEV->PidFlag) && (DEV->devLaserState == 1) && (DEV->devLaserCheck))
// {
// //if (checkCount > 2)
// {
// POWERMETERMACH->GetValue(&powerP2);
// POWERMETERLIGHT->GetValue(&power);
// writePowerfile(filename, power,powerP2);
// }
// checkCount++;
// Sleep(2000);
// }
// else
// {
// Sleep(2000);
// checkCount = 0;
// }
}
}
int readPowerValueThread()
{
float value = 0;
float average_value = 0;
float average[10];
int index = 0;
while(1)
{
if (bReadApFlag)
{
if (POWERMETERMACH->m_hComm == nullptr)
{
POWERMETERMACH->getSerialSet("jiagonggonglvji");
bool ret = POWERMETERMACH->OpenComm();
if (!ret)
{
DEVICE_INFO->printDeviceSystemInfo("加工功率计串口打开错误!");
emit DEV->AutoExceptSGL(MyException(QString("加工功率计串口打开错误, ")+QString(",是否停止当前功率计读取?")));
if (DEV->DataCheckFlag)
{
bReadApFlag = false;
}
}
}
int ret = POWERMETERMACH->GetValue(&value);
if (ret != 0)
{
DEVICE_INFO->printDeviceSystemInfo("加工功率计数据读取失败!");
emit DEV->AutoExceptSGL(MyException(QString("加工功率计数据读取失败, ")+QString(",是否停止当前功率计读取?")));
if (DEV->DataCheckFlag)
{
bReadApFlag = false;
}
//return -1;
}
average[index] = value;
index++;
if (index >= 10) index = 0;
average_value = 0;
for (int i=0;i<10;i++)
{
average_value = average_value + average[i];
}
average_value = average_value / 10;
emit DEV->PowerMeterValueSGL(value,average_value);
}
else
{
memset(average,0,10*4);
index = 0;
}
Sleep(500);
}
}
void myHeartBeat()
{
MODBUSTCP->Heartbeat();
}
void myReadApValue()
{
readPowerValueThread();
}
void myHeartBeat_fl()
{
MODBUSTCP->Heartbeat_fl();
}
void SerialDeviceTest::readPowerValue()
{
//HeartBeat();
CreateThread(nullptr,
0,
(LPTHREAD_START_ROUTINE)myReadPowerValue,
this,
0,
NULL);
}
void SerialDeviceTest::PID_proc()
{
//HeartBeat();
CreateThread(nullptr,
0,
(LPTHREAD_START_ROUTINE)myPidProc,
this,
0,
NULL);
}
void SerialDeviceTest::HeartBeat()
{
//HeartBeat();
CreateThread(nullptr,
0,
(LPTHREAD_START_ROUTINE)myHeartBeat,
this,
0,
NULL);
}
void SerialDeviceTest::ReadApValue()
{
//HeartBeat();
CreateThread(nullptr,
0,
(LPTHREAD_START_ROUTINE)myReadApValue,
this,
0,
NULL);
}
void SerialDeviceTest::HeartBeat_fl()
{
//HeartBeat();
CreateThread(nullptr,
0,
(LPTHREAD_START_ROUTINE)myHeartBeat_fl,
this,
0,
NULL);
}
void ShangProc()
{
int ret;
// if (MODBUSTCP->TransferPLCSts != 0)
// {
// DEVICE_INFO->printDeviceSystemInfo("横移模块已在上下料中,上料失败!");
// DEV->lastTaskIsFinish= true;
// DEV->ShangLiaoFSGL(false);
// return;
// }
DEVICE_INFO->printDeviceSystemInfo("上料开始...");
if(1)
{
ret = DEV->ShangProc();
}
if (ret == 0)
{
DEVICE_INFO->printDeviceSystemInfo("上料完成");
DEV->ShangLiaoFSGL(true);
}
else
{
DEVICE_INFO->printDeviceSystemInfo("上料失败!");
DEV->ShangLiaoFSGL(false);
}
DEV->lastTaskIsFinish= true;
return;
}
void XiaProc()
{
int ret;
// if (MODBUSTCP->TransferPLCSts != 0)
// {
// DEVICE_INFO->printDeviceSystemInfo("横移模块已在上下料中,下料失败!");
// DEV->XiaLiaoFSGL(false);
// DEV->lastTaskIsFinish= true;
// return;
// }
DEVICE_INFO->printDeviceSystemInfo("下料开始...");
if(1)
{
ret = DEV->XiaProc();
}
if (ret == 0)
{
DEVICE_INFO->printDeviceSystemInfo("下料完成");
DEV->XiaLiaoFSGL(true);
}
else
{
DEV->XiaLiaoFSGL(false);
DEVICE_INFO->printDeviceSystemInfo("下料失败!");
}
DEV->lastTaskIsFinish= true;
return;
}
void SerialDeviceTest::on_pbXiaLiao_clicked()
{
DWORD ThreadID;
HANDLE thrdHandle;
if(!DEV->getDevIsReset())
{
DEV->emit exceptSGL(MyException(QString("设备未初始化,未复位,无法执行寻边定位。请先完成复位。"),MY_WARN));
return;
}
if(!DEV->getLastTaskIsFinish())
{
DEV->emit exceptSGL(MyException(QString("任务执行中,无法执行寻边定位。请先停止运动或等待任务结束。"),MY_WARN));
return;
}
if(DEV->bRunning)
{
DEV->emit exceptSGL(MyException(QString("自动运行执行中,请等待运行结束。"),MY_WARN));
return;
}
DEV->lastTaskIsFinish=false;
DEV->lastTaskName="下料";
thrdHandle = CreateThread(nullptr,
0,
(LPTHREAD_START_ROUTINE)XiaProc,
this,
0,
&ThreadID);
}
void SerialDeviceTest::on_pbShangLiao_clicked()
{
DWORD ThreadID;
HANDLE thrdHandle;
//这里是不是应该先运行到上下料位?
if(!DEV->getDevIsReset())
{
DEV->emit exceptSGL(MyException(QString("设备未初始化,未复位,无法执行寻边定位。请先完成复位。"),MY_WARN));
return;
}
if(!DEV->getLastTaskIsFinish())
{
DEV->emit exceptSGL(MyException(QString("任务执行中,无法执行寻边定位。请先停止运动或等待任务结束。"),MY_WARN));
return;
}
if(DEV->bRunning)
{
DEV->emit exceptSGL(MyException(QString("自动运行执行中,请等待运行结束。"),MY_WARN));
return;
}
DEV->lastTaskIsFinish=false;
DEV->lastTaskName="上料";
thrdHandle = CreateThread(nullptr,
0,
(LPTHREAD_START_ROUTINE)ShangProc,
this,
0,
&ThreadID);
}
void SerialDeviceTest::on_spBrightness_valueChanged(int value)
{
if (ui->cmbCameraID->currentIndex() == 0)
{
RS_SETTINGS->beginGroup("device/LightSource");
RS_SETTINGS->writeEntry("/brightnessFind", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("相机亮度设置完成,当前亮度为:%1/s").arg(value));
}
else
{
RS_SETTINGS->beginGroup("device/LightSource");
RS_SETTINGS->writeEntry("/brightnessGlobal", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("相机亮度设置完成,当前亮度为:%1/s").arg(value));
}
}
void SerialDeviceTest::on_cmbCameraID_currentIndexChanged(int index)
{
int brightness;
//int Strobe;
if (index == 0)
{
RS_SETTINGS->beginGroup("device/LightSource");
brightness = RS_SETTINGS->readNumEntry("/brightnessFind");
//Strobe = RS_SETTINGS->readNumEntry("/StrobeFind");
RS_SETTINGS->endGroup();
}
else
{
RS_SETTINGS->beginGroup("device/LightSource");
brightness = RS_SETTINGS->readNumEntry("/brightnessGlobal");
//Strobe = RS_SETTINGS->readNumEntry("/StrobeGlobal");
RS_SETTINGS->endGroup();
}
ui->spBrightness->setValue(brightness);
//ui->spStrobe->setValue(Strobe);
}
void SerialDeviceTest::on_pbBrightness_clicked()
{
if (LIGHTSOURCEFIND->m_hComm == nullptr)
{
bool ret = LIGHTSOURCEFIND->OpenComm();
if (!ret)
{
showExceptionInfoDialog("光源串口打开错误!");
DEVICE_INFO->printDeviceSystemInfo("光源串口打开错误!");
return;
}
}
int ret = LIGHTSOURCEFIND->LightOn(ui->cmbCameraID->currentIndex()+1);
if (ret != 0)
{
showExceptionInfoDialog("光源打开失败!");
DEVICE_INFO->printDeviceSystemInfo("光源打开失败!");
return;
}
}
void SerialDeviceTest::on_pbLightOff_clicked()
{
if (LIGHTSOURCEFIND->m_hComm == nullptr)
{
bool ret = LIGHTSOURCEFIND->OpenComm();
if (!ret)
{
showExceptionInfoDialog("光源串口打开错误!");
DEVICE_INFO->printDeviceSystemInfo("光源串口打开错误!");
return;
}
}
int ret = LIGHTSOURCEFIND->LightOff(ui->cmbCameraID->currentIndex()+1);
if (ret != 0)
{
showExceptionInfoDialog("光源关闭失败!");
DEVICE_INFO->printDeviceSystemInfo("光源关闭失败!");
return;
}
}
void SerialDeviceTest::on_spBrightness_editingFinished()
{
if(!ui->spBrightness->hasFocus()) return;
// ui->spBrightness->text();
// int value = ui->spBrightness->text().toInt();
if (LIGHTSOURCEFIND->m_hComm == nullptr)
{
bool ret = LIGHTSOURCEFIND->OpenComm();
if (!ret)
{
showExceptionInfoDialog("光源串口打开错误!");
DEVICE_INFO->printDeviceSystemInfo("光源串口打开错误!");
return;
}
}
int ret = LIGHTSOURCEFIND->LightOn(ui->cmbCameraID->currentIndex()+1);
if (ret != 0)
{
showExceptionInfoDialog("光源打开失败!");
DEVICE_INFO->printDeviceSystemInfo("光源打开失败!");
return;
}
}
void SerialDeviceTest::on_pbStopRead_clicked()
{
bReadApFlag = false;
}
void SerialDeviceTest::on_cmbPowerMeterID_currentTextChanged(const QString &arg1)
{
if (ui->cmbPowerMeterID->currentText() == "光路功率计")
{
bReadApFlag = false;
}
}

View File

@@ -0,0 +1,70 @@
#ifndef SERIALDEVICETEST_H
#define SERIALDEVICETEST_H
#include <QFrame>
#include <QTextCursor>
#include "ui_SerialDeveceTest.h"
#include "base.h"
#include "Barometer.h"
#include "PanasonicHeightFind.h"
#include "PowerAttenuator.h"
#include "PowerMeter.h"
#include "modbustcp.h"
#include "lightsource.h"
#include "IPG_laser.h"
#include <QMessageBox>
class SerialDeviceTest:public QFrame
{
Q_OBJECT
public:
explicit SerialDeviceTest(QWidget* parent=nullptr);
~SerialDeviceTest();
void HeartBeat();
void ReadApValue();
void HeartBeat_fl();
void PID_proc();
void readPowerValue();
private:
private slots:
void on_pbPowerRead_clicked();
void on_pbBarometer_clicked();
void on_pbCuHeightFind_clicked();
void on_pbXiaLiao_clicked();
void on_pbShangLiao_clicked();
void on_spBrightness_valueChanged(int arg1);
void on_cmbCameraID_currentIndexChanged(int index);
void on_pbBrightness_clicked();
void on_pbLightOff_clicked();
void on_spBrightness_editingFinished();
void on_pbStopRead_clicked();
void on_cmbPowerMeterID_currentTextChanged(const QString &arg1);
void updatePowerMeterValue(float value,float average_value);
private:
Ui::SerialDeviceTest * ui;
LIMIT_STATE limit_state[3];
int enable_state;
void showExceptionInfoDialog(const QString& text,QMessageBox::Icon value = QMessageBox::Critical);
};
#endif // SERIALDEVICETEST_H

View File

@@ -0,0 +1,48 @@
#include "setvaluewidget.h"
#include "ui_setvaluewidget.h"
#include "deviceproxy.h"
SetValueWidget::SetValueWidget(QWidget *parent) :
QDialog(parent),
ui(new Ui::SetValueWidget)
{
ui->setupUi(this);
ui->pbSetValue->setVisible(false);
ui->spValue->setVisible(false);
ui->pbPassWord->setVisible(true);
ui->LedPwd->setVisible(true);
ui->lbName->setText("请输入密码:");
ui->LedPwd->setEchoMode(QLineEdit::Password);
}
SetValueWidget::~SetValueWidget()
{
delete ui;
}
void SetValueWidget::on_pbSetValue_clicked()
{
emit DEV->MsgLogInSuccess(true);
}
void SetValueWidget::on_pbPassWord_clicked()
{
if (ui->LedPwd->text() == "westlake")
{
ui->pbSetValue->setVisible(true);
ui->spValue->setVisible(true);
ui->pbPassWord->setVisible(false);
ui->LedPwd->setVisible(false);
ui->lbName->setText("设置值:");
}
else
{
QMessageBox::information(this, "提示", "密码错误!");
}
}
void SetValueWidget::on_pbClose_clicked()
{
this->close();
}

View File

@@ -0,0 +1,29 @@
#ifndef SETVALUEWIDGET_H
#define SETVALUEWIDGET_H
#include <QDialog>
#include <QMessageBox>
namespace Ui {
class SetValueWidget;
}
class SetValueWidget : public QDialog
{
Q_OBJECT
public:
explicit SetValueWidget(QWidget *parent = nullptr);
~SetValueWidget();
private slots:
void on_pbSetValue_clicked();
void on_pbPassWord_clicked();
void on_pbClose_clicked();
private:
Ui::SetValueWidget *ui;
};
#endif // SETVALUEWIDGET_H

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SetValueWidget</class>
<widget class="QDialog" name="SetValueWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>370</width>
<height>208</height>
</rect>
</property>
<property name="windowTitle">
<string>设置参数</string>
</property>
<widget class="QPushButton" name="pbSetValue">
<property name="geometry">
<rect>
<x>90</x>
<y>120</y>
<width>93</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>确 定</string>
</property>
</widget>
<widget class="QLabel" name="lbName">
<property name="geometry">
<rect>
<x>41</x>
<y>70</y>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>请输入密码:</string>
</property>
</widget>
<widget class="QSpinBox" name="spValue">
<property name="geometry">
<rect>
<x>150</x>
<y>60</y>
<width>161</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pbPassWord">
<property name="geometry">
<rect>
<x>90</x>
<y>120</y>
<width>93</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>确 定</string>
</property>
</widget>
<widget class="QLineEdit" name="LedPwd">
<property name="geometry">
<rect>
<x>150</x>
<y>60</y>
<width>161</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pbClose">
<property name="geometry">
<rect>
<x>220</x>
<y>120</y>
<width>93</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</widget>
<tabstops>
<tabstop>pbPassWord</tabstop>
<tabstop>pbSetValue</tabstop>
<tabstop>LedPwd</tabstop>
<tabstop>spValue</tabstop>
<tabstop>pbClose</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,162 @@
#include "smallareasparamwidget.h"
#include "ui_smallareasparamwidget.h"
#include "deviceproxy.h"
#include "rs_settings.h"
#include "deviceinfo.h"
#include "IPG_laser.h"
SmallAreasParamWidget::SmallAreasParamWidget(QWidget *parent) :
QFrame(parent),
ui(new Ui::SmallAreasParamWidget)
{
ui->setupUi(this);
connect(DEV,SIGNAL(XAxisCtPosSGL(double)),this,SLOT(setXAxisCtPos(double)));
RS_SETTINGS->beginGroup("device/Rposition");
double XiaoVel = RS_SETTINGS->readNumDEntry("/XiaoVel");
double XiaoInternal = RS_SETTINGS->readNumDEntry("/XiaoInternal");
double GlobalPix = RS_SETTINGS->readNumDEntry("/GlobalPix");
double XiaoAccDec = RS_SETTINGS->readNumDEntry("/XiaoAccDec");
double XiaoOffset = RS_SETTINGS->readNumDEntry("/XiaoOffset");
double XLeftOffset = RS_SETTINGS->readNumDEntry("/XLeftOffset");
double XRightOffset = RS_SETTINGS->readNumDEntry("/XRightOffset");
int YOffset = RS_SETTINGS->readNumDEntry("/YOffset");
int YOffset_N = RS_SETTINGS->readNumDEntry("/YOffset_N");
int YTanslate = RS_SETTINGS->readNumDEntry("/YTanslate");
int StartPos = RS_SETTINGS->readNumDEntry("/StartPos");
int StartPosRight = RS_SETTINGS->readNumDEntry("/StartPosRight");
RS_SETTINGS->endGroup();
//ui->dsbFindCamera->setValue(FindCameraPos);
ui->dsbXiaoVel->setValue(XiaoVel);
ui->dsbXiaoInternal->setValue(XiaoInternal);
ui->dsbGloblaPix->setValue(GlobalPix);
ui->dsbXiaoAccDec->setValue(XiaoAccDec);
ui->dsbXiaoOffset->setValue(XiaoOffset);
ui->dsbXLeftOffset->setValue(XLeftOffset);
ui->dsbXRightOffset->setValue(XRightOffset);
ui->dsbYOffset->setValue(YOffset);
ui->dsbYOffset_N->setValue(YOffset_N);
ui->dsbYTanslate->setValue(YTanslate);
ui->dsbStartPos->setValue(StartPos);
ui->dsbStartPosRight->setValue(StartPosRight);
}
SmallAreasParamWidget::~SmallAreasParamWidget()
{
delete ui;
}
void SmallAreasParamWidget::on_dsbXiaoVel_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/XiaoVel", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("特定区域加工速度改变为:%1mm/s").arg(arg1));
}
void SmallAreasParamWidget::on_dsbXiaoInternal_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/XiaoInternal", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("特定区域加工间隔改变为:%1mm").arg(arg1));
}
void SmallAreasParamWidget::on_dsbGloblaPix_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/GlobalPix", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("全局相机像素改变为:%1").arg(arg1));
}
void SmallAreasParamWidget::on_dsbXiaoAccDec_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/XiaoAccDec", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("特定区域加工加减速距离改变为:%1mm").arg(arg1));
}
void SmallAreasParamWidget::on_dsbXiaoOffset_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/XiaoOffset", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("特定区域加工偏移改变为:%1mm").arg(arg1));
}
void SmallAreasParamWidget::on_pbRecord_clicked()
{
DEV->Record_xiao();
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/XiaoXAxis", XAxisCtPos);
RS_SETTINGS->endGroup();
ui->dsbRecord->setValue(XAxisCtPos);
}
void SmallAreasParamWidget::setXAxisCtPos(double value)
{
XAxisCtPos = value;
}
void SmallAreasParamWidget::on_dsbXLeftOffset_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/XLeftOffset", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("特定区域加工X轴负向偏移改为%1mm").arg(arg1));
}
void SmallAreasParamWidget::on_dsbXRightOffset_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/XRightOffset", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("特定区域加工X轴正向偏移改为%1mm").arg(arg1));
}
void SmallAreasParamWidget::on_dsbYOffset_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/YOffset", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("特定区域加工Y正向轴缩放条数改为%1").arg(arg1));
}
void SmallAreasParamWidget::on_dsbYOffset_N_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/YOffset_N", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("特定区域加工Y负向轴缩放条数改为%1").arg(arg1));
}
void SmallAreasParamWidget::on_dsbYTanslate_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/YTanslate", arg1);
RS_SETTINGS->endGroup();
//DEVICE_INFO->printDeviceSystemInfo(QString("特定区域加工Y偏移改变为%1").arg(arg1));
}
void SmallAreasParamWidget::on_dsbStartPos_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/StartPos", arg1);
RS_SETTINGS->endGroup();
}
void SmallAreasParamWidget::on_dsbStartPosRight_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/Rposition");
RS_SETTINGS->writeEntry("/StartPosRight", arg1);
RS_SETTINGS->endGroup();
}

View File

@@ -0,0 +1,50 @@
#ifndef SMALLAREASPARAMWIDGET_H
#define SMALLAREASPARAMWIDGET_H
#include <QFrame>
namespace Ui {
class SmallAreasParamWidget;
}
class SmallAreasParamWidget : public QFrame
{
Q_OBJECT
public:
explicit SmallAreasParamWidget(QWidget *parent = nullptr);
~SmallAreasParamWidget();
double XAxisCtPos;
private slots:
void on_dsbXiaoVel_valueChanged(double arg1);
void on_dsbGloblaPix_valueChanged(double arg1);
void on_dsbYOffset_N_valueChanged(double arg1);
void on_dsbXiaoInternal_valueChanged(double arg1);
void on_dsbYOffset_valueChanged(double arg1);
void on_dsbXiaoOffset_valueChanged(double arg1);
void on_dsbXiaoAccDec_valueChanged(double arg1);
void on_dsbYTanslate_valueChanged(double arg1);
void on_dsbXLeftOffset_valueChanged(double arg1);
void on_dsbXRightOffset_valueChanged(double arg1);
void on_dsbStartPos_valueChanged(double arg1);
void on_pbRecord_clicked();
void setXAxisCtPos(double value);
void on_dsbStartPosRight_valueChanged(double arg1);
private:
Ui::SmallAreasParamWidget *ui;
};
#endif // SMALLAREASPARAMWIDGET_H

View File

@@ -0,0 +1,778 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SmallAreasParamWidget</class>
<widget class="QFrame" name="SmallAreasParamWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>998</width>
<height>330</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<widget class="QGroupBox" name="groupBox_5">
<property name="geometry">
<rect>
<x>11</x>
<y>11</y>
<width>731</width>
<height>141</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="title">
<string>特定区域参数</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QPushButton" name="pbRecord">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>记录</string>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbRecord">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string>mm</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>-50.000000000000000</double>
</property>
<property name="maximum">
<double>400.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>速度:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbXiaoVel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>112</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string>mm/s</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>间隔:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbXiaoInternal">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string>mm</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>70.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>偏移:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbXiaoOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string>mm</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>70.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string>加减速距离:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbXiaoAccDec">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>112</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string>mm</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>200.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>全局像素:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbGloblaPix">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>11</x>
<y>157</y>
<width>971</width>
<height>141</height>
</rect>
</property>
<property name="title">
<string>特定区域校正</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_19">
<item>
<widget class="QLabel" name="label_18">
<property name="text">
<string>Y负缩放</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbYOffset_N">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>-10.000000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string>X正偏移</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbXRightOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string>mm</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="maximum">
<double>70.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>X负偏移</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbXLeftOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string>mm</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="maximum">
<double>70.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_28">
<item>
<widget class="QLabel" name="label_27">
<property name="text">
<string>拼图位置左:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbStartPos">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>5000.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_29">
<item>
<widget class="QLabel" name="label_28">
<property name="text">
<string>拼图位置右:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbStartPosRight">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>5000.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="3">
<layout class="QHBoxLayout" name="horizontalLayout_20">
<item>
<widget class="QLabel" name="label_19">
<property name="text">
<string>Y轴平移</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbYTanslate">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>70</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>-10.000000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>Y正缩放</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbYOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>-10.000000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>DMDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global">dmdoublespinbox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,333 @@
#include "specificareaswidget.h"
#include "ui_specificareaswidget.h"
#include "deviceproxy.h"
#include "deviceinfo.h"
#include <QFile>
#include <QFileDialog>
#include <QMessageBox>
#include <QMouseEvent>
#include <QPainter>
#include <QPixmap>
#include <QDataStream>
#include <QBuffer>
#include <QTcpServer>
#include <QTcpSocket>
#include <QVector3D>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <dirent.h>
#include <string>
#include <vector>
#include <algorithm>
#include <QtCore/QDebug>
#include <QtGui/QImage>
#include "opencv2/core/core.hpp"
#include "opencv2/opencv.hpp"
#include "rs_settings.h"
#define NUMBER 3
QImage* img=new QImage;
cv::Mat imgcv;//拼接完成的图片
QImage* qimgRecv;//从python返回的img转化为qimage
cv::Mat imgRecv;//从python返回的img
SpecificAreasWidget::SpecificAreasWidget(QWidget *parent) :
QDialog(parent),
ui(new Ui::SpecificAreasWidget)
{
ui->setupUi(this);
this->setMouseTracking(true);
ui->lbImage->setMouseTracking(true);
connect(DEV,SIGNAL(ShowMergeSGL()),this,SLOT(ShowMergeSlots()));
// Sleep(50);
// if (DEV->srcImgs.size() > 0)
// {
// imgcv = DEV->Func_merge(200,500);
// *img = QImage(imgcv.data, imgcv.cols, imgcv.rows, QImage::Format_RGB888);
// //调用完成之后把img显示在窗口上
// if((double)img->width()/(double)ui->lbImage->width() >= (double)img->height()/(double)ui->lbImage->height())
// Mul=(double)img->width()/(double)ui->lbImage->width();
// else
// Mul=(double)img->height()/(double)ui->lbImage->height();
// ui->edLog->append("缩放倍数:" + QString::number(Mul,'f',3));
// *scaledimg=img->scaled(ui->lbImage->width(),ui->lbImage->height(),Qt::KeepAspectRatio);
// *scaledimgInit = scaledimg->copy();
// ui->lbImage->setPixmap(QPixmap::fromImage(*scaledimg));
// }
}
SpecificAreasWidget::~SpecificAreasWidget()
{
delete ui;
}
//显示窗口上的坐标
void SpecificAreasWidget::mouseMoveEvent(QMouseEvent *e)
{
if( e->x() >= ui->lbImage->pos().x()
&& e->y() >= ui->lbImage->pos().y()
&& e->x() <= ui->lbImage->pos().x() + scaledimg->width()
&& e->y() <= ui->lbImage->pos().y() + scaledimg->height() )
{
int x = (e->x()-ui->lbImage->pos().x()) * Mul;
int y = (e->y()-ui->lbImage->pos().y()) * Mul;
QString strX;
QString strY;
strX = QString::number(x,10);
strY = QString::number(y,10);
QString strCoordinate = "坐标: ( " + strX + ", " + strY + " )";
//ui->labCoordinate->setText(strCoordinate);
}
}
////点击绘制坐标点
void SpecificAreasWidget::mousePressEvent(QMouseEvent *e)
{
int lx = ui->lbImage->pos().x();
int ly = ui->lbImage->pos().y();
if( e->x() >= ui->lbImage->pos().x()
&& e->y() >= ui->lbImage->pos().y()
&& e->x() <= ui->lbImage->pos().x() + scaledimg->width()
&& e->y() <= ui->lbImage->pos().y() + scaledimg->height() )
{
int x = (e->x()-ui->lbImage->pos().x()) * Mul;
int y = (e->y()-ui->lbImage->pos().y()) * Mul;
QString strX;
QString strY;
strX = QString::number(x,10);
strY = QString::number(y,10);
QString strCoordinate;
QVector<int> vec;
vec.append(x);
vec.append(y);
if(e->buttons() == Qt::LeftButton)
{
vec.append(1);
strCoordinate = "添加坐标: ( " + strX + ", " + strY + ", 1" + " )";
QPainter painter(scaledimg); // 创建一个QPainter对象用于绘制图形
painter.setRenderHint(QPainter::Antialiasing); // 设置抗锯齿
QPen pen(Qt::red, 2); // 创建画笔对象颜色为黑色线宽为2像素
painter.setPen(pen);
painter.drawLine(e->x()-lx-5, e->y()-ly-5,e->x()-lx+5, e->y()-ly+5);
painter.drawLine(e->x()-lx-5, e->y()-ly+5,e->x()-lx+5, e->y()-ly-5);
ui->lbImage->setPixmap(QPixmap::fromImage(*scaledimg));
}
else if(e->buttons() == Qt::RightButton)
{
vec.append(0);
strCoordinate = "添加坐标: ( " + strX + ", " + strY + ", 0" + " )";
QPainter painter(scaledimg); // 创建一个QPainter对象用于绘制图形
painter.setRenderHint(QPainter::Antialiasing); // 设置抗锯齿
QPen pen(Qt::blue, 2); // 创建画笔对象颜色为黑色线宽为2像素
painter.setPen(pen);
painter.drawLine(e->x()-lx-5, e->y()-ly-5,e->x()-lx+5, e->y()-ly+5);
painter.drawLine(e->x()-lx-5, e->y()-ly+5,e->x()-lx+5, e->y()-ly-5);
ui->lbImage->setPixmap(QPixmap::fromImage(*scaledimg));
}
All.append(vec);
ui->edLog->append(strCoordinate);
}
}
void SpecificAreasWidget::on_pbOk_clicked()
{
DEVICE_INFO->printDeviceSystemInfo("手动加工继续!");
DEV->DataCheckFlag = true;
this->close();
//调用完成之后把img显示在窗口上
// filename = QFileDialog::getOpenFileName();
// if(filename.isEmpty())
// return;
// if(! ( img->load(filename) ) ) //加载图像
// {
// QMessageBox::information(this,
// tr("打开图像失败"),
// tr("打开图像失败!"));
// delete img;
// return;
// }
// if((double)img->width()/(double)ui->lbImage->width() >= (double)img->height()/(double)ui->lbImage->height())
// Mul=(double)img->width()/(double)ui->lbImage->width();
// else
// Mul=(double)img->height()/(double)ui->lbImage->height();
// ui->edLog->append("缩放倍数:" + QString::number(Mul,'f',3));
// *scaledimg=img->scaled(ui->lbImage->width(),ui->lbImage->height(),Qt::KeepAspectRatio);
// *scaledimgInit = scaledimg->copy();
// ui->lbImage->setPixmap(QPixmap::fromImage(*scaledimg));
}
void SpecificAreasWidget::on_pbCancel_clicked()
{
DEVICE_INFO->printDeviceSystemInfo("手动加工取消!");
//emit DEV->MsgLogInSuccess(false);
DEV->DataCheckFlag = false;
this->close();
}
void SpecificAreasWidget::on_rbSrcImg_clicked()
{
if (ui->rbSrcImg->isChecked())
{
//if (DEV->srcImgs[0].data != nullptr)
{
RS_SETTINGS->beginGroup("device/Rposition");
double GlobalPix = RS_SETTINGS->readNumDEntry("/GlobalPix");
int StartPos = RS_SETTINGS->readNumDEntry("/StartPos");
RS_SETTINGS->endGroup();
//imgcv = DEV->Func_merge(StartPos,StartPos+(int)GlobalPix*10);
cv::cvtColor(imgcv, imgcv, cv::COLOR_BGR2RGB);
*img = QImage(imgcv.data, imgcv.cols, imgcv.rows, QImage::Format_RGB888);
//调用完成之后把img显示在窗口上
if((double)img->width()/(double)ui->lbImage->width() >= (double)img->height()/(double)ui->lbImage->height())
Mul=(double)img->width()/(double)ui->lbImage->width();
else
Mul=(double)img->height()/(double)ui->lbImage->height();
ui->edLog->append("缩放倍数:" + QString::number(Mul,'f',3));
*scaledimg=img->scaled(ui->lbImage->width(),ui->lbImage->height(),Qt::KeepAspectRatio);
*scaledimgInit = scaledimg->copy();
ui->lbImage->setPixmap(QPixmap::fromImage(*scaledimg));
}
}
}
void SpecificAreasWidget::on_rbDstImg_clicked()
{
if (ui->rbDstImg->isChecked())
{
if (!imgRecv.empty())
{
const uchar *pSrc = (const uchar*)imgRecv.data;
QImage qimgRecv(pSrc, imgRecv.cols, imgRecv.rows, imgRecv.step, QImage::Format_RGB888);
//调用完成之后把img显示在窗口上
if((double)qimgRecv.width()/(double)ui->lbImage->width() >= (double)qimgRecv.height()/(double)ui->lbImage->height())
Mul=(double)qimgRecv.width()/(double)ui->lbImage->width();
else
Mul=(double)qimgRecv.height()/(double)ui->lbImage->height();
ui->edLog->append("缩放倍数:" + QString::number(Mul,'f',3));
*scaledimg=qimgRecv.scaled(ui->lbImage->width(),ui->lbImage->height(),Qt::KeepAspectRatio);
*scaledimgInit = scaledimg->copy();
ui->lbImage->setPixmap(QPixmap::fromImage(*scaledimg));
}
}
}
void SpecificAreasWidget::ShowMergeSlots()
{
ui->rbDstImg->setChecked(true);
{
if (!imgRecv.empty())
{
const uchar *pSrc = (const uchar*)imgRecv.data;
/***************************************************************
* 修改码1008610010
* 日期:
* 2024.3.1
* 功能:
* 小面识别功能的图片显示bug修改
* 描述:
* Format_Grayscale8改为Format_RGB888
**************************************************************/
QImage qimgRecv(pSrc, imgRecv.cols, imgRecv.rows, imgRecv.step, QImage::Format_RGB888);
//调用完成之后把img显示在窗口上
if((double)qimgRecv.width()/(double)ui->lbImage->width() >= (double)qimgRecv.height()/(double)ui->lbImage->height())
Mul=(double)qimgRecv.width()/(double)ui->lbImage->width();
else
Mul=(double)qimgRecv.height()/(double)ui->lbImage->height();
ui->edLog->append("缩放倍数:" + QString::number(Mul,'f',3));
*scaledimg=qimgRecv.scaled(ui->lbImage->width(),ui->lbImage->height(),Qt::KeepAspectRatio);
*scaledimgInit = scaledimg->copy();
ui->lbImage->setPixmap(QPixmap::fromImage(*scaledimg));
}
}
}
void SpecificAreasWidget::on_pbGetRetImg_clicked()
{
//图片
std::vector<uchar> buf;
cv::imencode(".jpg", imgcv, buf);
QByteArray data(reinterpret_cast<char*>(buf.data()), buf.size());
QDataStream stream(DEV->socket);
stream.setByteOrder(QDataStream::BigEndian);
quint32 size = data.size();
stream << size;
ui->edLog->append("size = " + QString::number(size,10));
DEV->socket->write(data);
ui->edLog->append("finish");
// 定义要发送的坐标点
QVector<QVector3D> points;
for(int i = 0;i < All.size();i++)
{
QVector3D point111(All[i][0],All[i][1],All[i][2]);
points.append(point111);
}
QDataStream out(DEV->socket);
out.setByteOrder(QDataStream::BigEndian);
// 发送坐标点的数量
quint32 num_points = points.size();
out << num_points;
DEV->socket->waitForBytesWritten();
ui->edLog->append(QString::number(num_points,10));
for (const QVector3D& point : points)
{
quint32 x = point.x();
quint32 y = point.y();
quint32 z = point.z();
out << x << y << z;
DEV->socket->waitForBytesWritten();
}
}

View File

@@ -0,0 +1,52 @@
#ifndef SPECIFICAREASWIDGET_H
#define SPECIFICAREASWIDGET_H
#include <QDialog>
#include"qtcpserver.h"
#include"qtcpsocket.h"
#include <QMouseEvent>
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
namespace Ui {
class SpecificAreasWidget;
}
class SpecificAreasWidget : public QDialog
{
Q_OBJECT
public:
explicit SpecificAreasWidget(QWidget *parent = nullptr);
~SpecificAreasWidget();
double Mul; //记录图片与label大小的比例用于缩放图片
QVector<QVector<int>> All;
QImage* scaledimg=new QImage;//显示在窗口上的img
QImage* scaledimgInit=new QImage;//用于点击事件重绘显示的图片
QString filename;
protected:
void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
private slots:
void on_pbOk_clicked();
void on_pbCancel_clicked();
void on_rbSrcImg_clicked();
void on_rbDstImg_clicked();
void on_pbGetRetImg_clicked();
void ShowMergeSlots();
private:
Ui::SpecificAreasWidget *ui;
};
#endif // SPECIFICAREASWIDGET_H

View File

@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SpecificAreasWidget</class>
<widget class="QDialog" name="SpecificAreasWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1216</width>
<height>700</height>
</rect>
</property>
<property name="windowTitle">
<string>加工图片</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lbImage">
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 0);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="maximumSize">
<size>
<width>240</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
</font>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
</property>
<property name="title">
<string/>
</property>
<widget class="QRadioButton" name="rbSrcImg">
<property name="geometry">
<rect>
<x>20</x>
<y>120</y>
<width>115</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>当前图片</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<widget class="QRadioButton" name="rbDstImg">
<property name="geometry">
<rect>
<x>20</x>
<y>160</y>
<width>115</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>结果图片</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="pbGetRetImg">
<property name="geometry">
<rect>
<x>50</x>
<y>30</y>
<width>121</width>
<height>61</height>
</rect>
</property>
<property name="text">
<string>传出图片</string>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QTextEdit" name="edLog"/>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="title">
<string/>
</property>
<widget class="QPushButton" name="pbOk">
<property name="geometry">
<rect>
<x>7</x>
<y>10</y>
<width>93</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>确 定</string>
</property>
</widget>
<widget class="QPushButton" name="pbCancel">
<property name="geometry">
<rect>
<x>110</x>
<y>10</y>
<width>93</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>取 消</string>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,207 @@
#include "sscancompsetwidget.h"
#include "rs_settings.h"
#include <QFileDialog>
#include "deviceproxy.h"
#include "rs_settings.h"
SScanCompSetWidget::SScanCompSetWidget(QWidget* parent)
:QFrame(parent)
,ui(new Ui::SScanCompSetWidget)
{
ui->setupUi(this);
loadSet();
connect(ui->dsbXWorkRang,SIGNAL(valueChanged(double)),this,SLOT(dsbXWorkRangValueChangedHandl(double)));
connect(ui->dsbXInterval,SIGNAL(valueChanged(double)),this,SLOT(dsbXIntervalValueChangedHandl(double)));
connect(ui->dsbYWorkRang,SIGNAL(valueChanged(double)),this,SLOT(dsbYWorkRangValueChangedHandl(double)));
connect(ui->dsbYInterval,SIGNAL(valueChanged(double)),this,SLOT(dsbYIntervalValueChangedHandl(double)));
}
void SScanCompSetWidget::loadSet()
{
RS_SETTINGS->beginGroup("device/SSCS");
double temp = RS_SETTINGS->readNumDEntry("/XRange",1.0);
ui->dsbXWorkRang->setValue(temp);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS");
temp = RS_SETTINGS->readNumDEntry("/YRange",1.0);
ui->dsbYWorkRang->setValue(temp);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS");
temp = RS_SETTINGS->readNumDEntry("/XInterval",1.0);
ui->dsbXInterval->setValue(temp);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS");
temp = RS_SETTINGS->readNumDEntry("/YInterval",1.0);
ui->dsbYInterval->setValue(temp);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS");
temp = RS_SETTINGS->readNumDEntry("/lowerLimit");
ui->dsbLowerLimit->setValue(temp);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS");
temp = RS_SETTINGS->readNumDEntry("/upperLimit");
ui->dsbUpperLimit->setValue(temp);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS"); //?path读不到
QString savePath = RS_SETTINGS->readEntry("/dataSavePath");
ui->lePath->setText(savePath);//dataSavePath
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS");
temp = RS_SETTINGS->readNumDEntry("/AdjacentPoint");
ui->dsbAdjacentPoint->setValue(temp);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS");
temp = RS_SETTINGS->readNumDEntry("/AllRange");
ui->dsbAllRange->setValue(temp);
RS_SETTINGS->endGroup();
RS_SETTINGS->beginGroup("device/SSCS");
temp = RS_SETTINGS->readNumDEntry("/PowerThreshold");
ui->dsbPowerThreshold->setValue(temp);
RS_SETTINGS->endGroup();
}
void SScanCompSetWidget::dsbXWorkRangValueChangedHandl(double value)
{
double diffValue = ui->dsbXWorkRang->value()/ui->dsbXInterval->value();
if(abs(diffValue - int(diffValue) ) > 0.0000001)
{
int multiple = int(diffValue);
double xWorkRangNew = double(multiple*ui->dsbXInterval->value());
//注意最小值问题
if(xWorkRangNew<1)
{
xWorkRangNew+=ui->dsbXInterval->value();
}
disconnect(ui->dsbXWorkRang,SIGNAL(valueChanged(double)),this,SLOT(dsbXWorkRangValueChangedHandl(double)));
ui->dsbXWorkRang->setValue(xWorkRangNew);
connect(ui->dsbXWorkRang,SIGNAL(valueChanged(double)),this,SLOT(dsbXWorkRangValueChangedHandl(double)));
value = xWorkRangNew;
}
RS_SETTINGS->beginGroup("device/SSCS");
RS_SETTINGS->writeEntry("/XRange",value);
RS_SETTINGS->endGroup();
}
void SScanCompSetWidget::dsbYWorkRangValueChangedHandl(double value)
{
double diffValue = ui->dsbYWorkRang->value()/ui->dsbYInterval->value();
if(abs(diffValue - int(diffValue) ) > 0.0000001)
{
int multiple = int(diffValue);
double yWorkRangNew = double(multiple*ui->dsbYInterval->value());
if(yWorkRangNew<1)
{
yWorkRangNew+=ui->dsbYInterval->value();
}
disconnect(ui->dsbYWorkRang,SIGNAL(valueChanged(double)),this,SLOT(dsbYWorkRangValueChangedHandl(double)));
ui->dsbYWorkRang->setValue(yWorkRangNew);
connect(ui->dsbYWorkRang,SIGNAL(valueChanged(double)),this,SLOT(dsbYWorkRangValueChangedHandl(double)));
value = yWorkRangNew;
}
RS_SETTINGS->beginGroup("device/SSCS");
RS_SETTINGS->writeEntry("/YRange",value);
RS_SETTINGS->endGroup();
}
void SScanCompSetWidget::dsbXIntervalValueChangedHandl(double value)
{
double diffValue = ui->dsbXWorkRang->value()/ui->dsbXInterval->value();
if(abs(diffValue - int(diffValue) ) > 0.0000001)
{
int multiple = int(diffValue);
double XWorkRangNewValue = double(multiple*ui->dsbXInterval->value());
if(XWorkRangNewValue<1)
{
XWorkRangNewValue+=ui->dsbXInterval->value();
}
ui->dsbXWorkRang->setValue(XWorkRangNewValue);
}
RS_SETTINGS->beginGroup("device/SSCS");
RS_SETTINGS->writeEntry("/XInterval",value);
RS_SETTINGS->endGroup();
}
void SScanCompSetWidget::dsbYIntervalValueChangedHandl(double value)
{
double diffValue = ui->dsbYWorkRang->value()/ui->dsbYInterval->value();
if(abs(diffValue - int(diffValue) ) > 0.0000001)
{
int multiple = int(diffValue);
double YWorkRangNewValue = double(multiple*ui->dsbYInterval->value());
if(YWorkRangNewValue<1)
{
YWorkRangNewValue+=ui->dsbYInterval->value();
}
ui->dsbYWorkRang->setValue(YWorkRangNewValue);
}
RS_SETTINGS->beginGroup("device/SSCS");
RS_SETTINGS->writeEntry("/YInterval",value);
RS_SETTINGS->endGroup();
}
void SScanCompSetWidget::on_dsbUpperLimit_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/SSCS");
RS_SETTINGS->writeEntry("/upperLimit",value);
RS_SETTINGS->endGroup();
}
void SScanCompSetWidget::on_dsbLowerLimit_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/SSCS");
RS_SETTINGS->writeEntry("/lowerLimit",value);
RS_SETTINGS->endGroup();
}
void SScanCompSetWidget::on_pbBrowse_clicked()
{
QString savePath;
savePath = QFileDialog::getExistingDirectory(this,"路径选择");
ui->lePath->setText(savePath);
RS_SETTINGS->beginGroup("device/SSCS");
RS_SETTINGS->writeEntry("/dataSavePath",savePath);
RS_SETTINGS->endGroup();
}
void SScanCompSetWidget::on_pbSscanLoadFromFile_clicked()
{
QString SscanDataFilePath = QFileDialog::getOpenFileName(this,"选择加工代码");
DEV->LoadFromCsv(SscanDataFilePath);
QMessageBox msg(this);
msg.setWindowTitle("加载提示");
msg.setText("加载成功,需确保加载文件和扫描参数匹配!");
msg.setIcon(QMessageBox::Warning);
msg.exec();
}
void SScanCompSetWidget::on_dsbAdjacentPoint_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/SSCS");
RS_SETTINGS->writeEntry("/AdjacentPoint",arg1);
RS_SETTINGS->endGroup();
}
void SScanCompSetWidget::on_dsbAllRange_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/SSCS");
RS_SETTINGS->writeEntry("/AllRange",arg1);
RS_SETTINGS->endGroup();
}
void SScanCompSetWidget::on_dsbPowerThreshold_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/SSCS");
RS_SETTINGS->writeEntry("/PowerThreshold",arg1);
RS_SETTINGS->endGroup();
}

View File

@@ -0,0 +1,46 @@
#ifndef SSCANCOMPSETWIDGET_H
#define SSCANCOMPSETWIDGET_H
#include "ui_sscancompsetwidget.h"
#include <QFrame>
class SScanCompSetWidget:public QFrame
{
Q_OBJECT
public:
explicit SScanCompSetWidget(QWidget* parent=nullptr);
private slots:
void dsbXWorkRangValueChangedHandl(double value);
void dsbXIntervalValueChangedHandl(double value);
void dsbYWorkRangValueChangedHandl(double value);
void dsbYIntervalValueChangedHandl(double value);
void on_dsbUpperLimit_valueChanged(double value);
void on_dsbLowerLimit_valueChanged(double value);
void on_pbBrowse_clicked();
void on_pbSscanLoadFromFile_clicked();
void on_dsbAdjacentPoint_valueChanged(double arg1);
void on_dsbAllRange_valueChanged(double arg1);
void on_dsbPowerThreshold_valueChanged(double arg1);
private:
void loadSet();
private:
Ui::SScanCompSetWidget *ui;
int xLineSegmentCounts{1};
int yLineSegmentCounts{1};
int accDecSampCount{1500};
int xNumberOfUnitSamples{20};
int yNumberOfUnitSamples{12};
int xNumberOfLineSegmentSamples{200};
};
#endif // SURFACESCANCOMPENSATIONSETTINGSWIDGET_H

View File

@@ -0,0 +1,527 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SScanCompSetWidget</class>
<widget class="QWidget" name="SScanCompSetWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>608</width>
<height>418</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="windowTitle">
<string>扫描补偿设置</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="minimumSize">
<size>
<width>520</width>
<height>0</height>
</size>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>518</width>
<height>394</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>自定义采集(mm)</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>X范围:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="DMDoubleSpinBox" name="dsbXWorkRang">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>400.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Y范围:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="DMDoubleSpinBox" name="dsbYWorkRang">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>400.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>X间隔:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="DMDoubleSpinBox" name="dsbXInterval">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>400.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Y间隔:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="DMDoubleSpinBox" name="dsbYInterval">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>400.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>补偿范围(mm)</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>上限:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="DMDoubleSpinBox" name="dsbUpperLimit">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-2.000000000000000</double>
</property>
<property name="maximum">
<double>2.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>相邻点:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="DMDoubleSpinBox" name="dsbAdjacentPoint">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="prefix">
<string/>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>2.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>下限:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="DMDoubleSpinBox" name="dsbLowerLimit">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-2.000000000000000</double>
</property>
<property name="maximum">
<double>2.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_8">
<property name="text">
<string>总范围:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="DMDoubleSpinBox" name="dsbAllRange">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>2.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="title">
<string>功率标定</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>报警阈值:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="DMDoubleSpinBox" name="dsbPowerThreshold">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>保存路径</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="8,2,0">
<item>
<widget class="QLineEdit" name="lePath">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbBrowse">
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>浏览</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbSscanLoadFromFile">
<property name="text">
<string>加载</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>28</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>56</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DMDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global">dmdoublespinbox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,464 @@
#include "tohomesetwidget.h"
#include "deviceproxy.h"
#include "rs_settings.h"
#include "deviceinfo.h"
ToHomeSetWidget::ToHomeSetWidget(QWidget* parent)
:QFrame(parent)
,ui(new Ui::ToHomeSetWidget)
{
ui->setupUi(this);
loadSet();
}
void ToHomeSetWidget::loadSet()
{
RS_SETTINGS->beginGroup("device/toHome/Pos");
double XAxisToHomePos = RS_SETTINGS->readNumDEntry("/XAxis");
double YAxisToHomePos = RS_SETTINGS->readNumDEntry("/YAxis");
double ZAxisToHomePos = RS_SETTINGS->readNumDEntry("/ZAxis");
double ZAAxisToHomePos = RS_SETTINGS->readNumDEntry("/ZAAxis");
double Z0AxisToHomePos = RS_SETTINGS->readNumDEntry("/Z0Axis");
double Z2AxisToHomePos = RS_SETTINGS->readNumDEntry("/Z2Axis");
double DAxisToHomePos = RS_SETTINGS->readNumDEntry("/DAxis");
RS_SETTINGS->endGroup();
ui->dsbXAxisToHomePos->setValue(XAxisToHomePos);
ui->dsbYAxisToHomePos->setValue(YAxisToHomePos);
ui->dsbZAxisToHomePos->setValue(ZAxisToHomePos);
ui->dsbZAAxisToHomePos->setValue(ZAAxisToHomePos);
ui->dsbZ0AxisToHomePos->setValue(Z0AxisToHomePos);
ui->dsbZ2AxisToHomePos->setValue(Z2AxisToHomePos);
ui->dsbZDAxisToHomePos->setValue(DAxisToHomePos);
RS_SETTINGS->beginGroup("device/toHome/zeroPosOffset");
double XAxisZeroPosOffset = RS_SETTINGS->readNumDEntry("/XAxis");
double YAxisZeroPosOffset = RS_SETTINGS->readNumDEntry("/YAxis");
double ZAxisZeroPosOffset = RS_SETTINGS->readNumDEntry("/ZAxis");
double ZAAxisZeroPosOffset = RS_SETTINGS->readNumDEntry("/ZAAxis");
double Z0AxisZeroPosOffset = RS_SETTINGS->readNumDEntry("/Z0Axis");
double Z2AxisZeroPosOffset = RS_SETTINGS->readNumDEntry("/Z2Axis");
double DAxisZeroPosOffset = RS_SETTINGS->readNumDEntry("/DAxis");
RS_SETTINGS->endGroup();
ui->dsbXAxisZeroPosOffset->setValue(XAxisZeroPosOffset);
ui->dsbYAxisZeroPosOffset->setValue(YAxisZeroPosOffset);
ui->dsbZAxisZeroPosOffset->setValue(ZAxisZeroPosOffset);
ui->dsbZAAxisZeroPosOffset->setValue(ZAAxisZeroPosOffset);
ui->dsbZ0AxisZeroPosOffset->setValue(Z0AxisZeroPosOffset);
ui->dsbZ2AxisZeroPosOffset->setValue(Z2AxisZeroPosOffset);
ui->dsbDAxisZeroPosOffset->setValue(DAxisZeroPosOffset);
RS_SETTINGS->beginGroup("device/leftSLimit");
double XAxisLeftSLimit = RS_SETTINGS->readNumDEntry("/XAxis");
double YAxisLeftSLimit = RS_SETTINGS->readNumDEntry("/YAxis");
double ZAxisLeftSLimit = RS_SETTINGS->readNumDEntry("/ZAxis");
double ZAAxisLeftSLimit = RS_SETTINGS->readNumDEntry("/ZAAxis");
double Z0AxisLeftSLimit = RS_SETTINGS->readNumDEntry("/Z0Axis");
double Z2AxisLeftSLimit = RS_SETTINGS->readNumDEntry("/Z2Axis");
double DAxisLeftSLimit = RS_SETTINGS->readNumDEntry("/DAxis");
RS_SETTINGS->endGroup();
ui->dsbXAxisLeftSLimit->setValue(XAxisLeftSLimit);
ui->dsbYAxisLeftSLimit->setValue(YAxisLeftSLimit);
ui->dsbZAxisLeftSLimit->setValue(ZAxisLeftSLimit);
ui->dsbZAAxisLeftSLimit->setValue(ZAAxisLeftSLimit);
ui->dsbZ0AxisLeftSLimit->setValue(Z0AxisLeftSLimit);
ui->dsbZ2AxisLeftSLimit->setValue(Z2AxisLeftSLimit);
ui->dsbDAxisLeftSLimit->setValue(DAxisLeftSLimit);
RS_SETTINGS->beginGroup("device/rightSLimit");
double XAxisRightSLimit = RS_SETTINGS->readNumDEntry("/XAxis");
double YAxisRightSLimit = RS_SETTINGS->readNumDEntry("/YAxis");
double ZAxisRightSLimit = RS_SETTINGS->readNumDEntry("/ZAxis");
double ZAAxisRightSLimit = RS_SETTINGS->readNumDEntry("/ZAAxis");
double Z0AxisRightSLimit = RS_SETTINGS->readNumDEntry("/Z0Axis");
double Z2AxisRightSLimit = RS_SETTINGS->readNumDEntry("/Z2Axis");
double DAxisRightSLimit = RS_SETTINGS->readNumDEntry("/DAxis");
RS_SETTINGS->endGroup();
ui->dsbXAxisRightSLimit->setValue(XAxisRightSLimit);
ui->dsbYAxisRightSLimit->setValue(YAxisRightSLimit);
ui->dsbZAxisRightSLimit->setValue(ZAxisRightSLimit);
ui->dsbZAAxisRightSLimit->setValue(ZAAxisRightSLimit);
ui->dsbZ0AxisRightSLimit->setValue(Z0AxisRightSLimit);
ui->dsbZ2AxisRightSLimit->setValue(Z2AxisRightSLimit);
ui->dsbDAxisRightSLimit->setValue(DAxisRightSLimit);
RS_SETTINGS->beginGroup("device/toHome/Vel");
double XAxisVel = RS_SETTINGS->readNumDEntry("/XAxis");
double YAxisVel = RS_SETTINGS->readNumDEntry("/YAxis");
double ZAxisVel = RS_SETTINGS->readNumDEntry("/ZAxis");
double ZAAxisVel = RS_SETTINGS->readNumDEntry("/ZAAxis");
double Z0AxisVel = RS_SETTINGS->readNumDEntry("/Z0Axis");
double Z2AxisVel = RS_SETTINGS->readNumDEntry("/Z2Axis");
double DAxisVel = RS_SETTINGS->readNumDEntry("/DAxis");
RS_SETTINGS->endGroup();
ui->dsbXAxisVel->setValue(XAxisVel);
ui->dsbYAxisVel->setValue(YAxisVel);
ui->dsbZAxisVel->setValue(ZAxisVel);
ui->dsbZAAxisVel->setValue(ZAAxisVel);
ui->dsbZ0AxisVel->setValue(Z0AxisVel);
ui->dsbZ2AxisVel->setValue(Z2AxisVel);
ui->dsbDAxisVel->setValue(DAxisVel);
RS_SETTINGS->beginGroup("device/tohome/findINDXVel");
double XAxisFindINDXVel = RS_SETTINGS->readNumDEntry("/XAxis");
double YAxisFindINDXVel = RS_SETTINGS->readNumDEntry("/YAxis");
double ZAxisFindINDXVel = RS_SETTINGS->readNumDEntry("/ZAxis");
double ZAAxisFindINDXVel = RS_SETTINGS->readNumDEntry("/ZAAxis");
double Z0AxisFindINDXVel = RS_SETTINGS->readNumDEntry("/Z0Axis");
double Z2AxisFindINDXVel = RS_SETTINGS->readNumDEntry("/Z2Axis");
double DAxisFindINDXVel = RS_SETTINGS->readNumDEntry("/DAxis");
RS_SETTINGS->endGroup();
ui->dsbXAxisFindINDXVel->setValue(XAxisFindINDXVel);
ui->dsbYAxisFindINDXVel->setValue(YAxisFindINDXVel);
ui->dsbZAxisFindINDXVel->setValue(ZAxisFindINDXVel);
ui->dsbZAAxisFindINDXVel->setValue(ZAAxisFindINDXVel);
ui->dsbZ0AxisFindINDXVel->setValue(Z0AxisFindINDXVel);
ui->dsbZ2AxisFindINDXVel->setValue(Z2AxisFindINDXVel);
ui->dsbDAxisFindINDXVel->setValue(DAxisFindINDXVel);
}
void ToHomeSetWidget::on_dsbXAxisToHomePos_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/Pos");
RS_SETTINGS->writeEntry("/XAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("X轴回零位置改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbYAxisToHomePos_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/Pos");
RS_SETTINGS->writeEntry("/YAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Y轴回零位置改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAxisToHomePos_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/Pos");
RS_SETTINGS->writeEntry("/ZAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z1轴回零位置改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAAxisToHomePos_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/Pos");
RS_SETTINGS->writeEntry("/ZAAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z轴回零位置改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbXAxisZeroPosOffset_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/zeroPosOffset");
RS_SETTINGS->writeEntry("/XAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("X轴零点偏移改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbYAxisZeroPosOffset_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/zeroPosOffset");
RS_SETTINGS->writeEntry("/YAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Y轴零点偏移改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAxisZeroPosOffset_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/zeroPosOffset");
RS_SETTINGS->writeEntry("/ZAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z1轴零点偏移改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAAxisZeroPosOffset_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/zeroPosOffset");
RS_SETTINGS->writeEntry("/ZAAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z轴零点偏移改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbXAxisLeftSLimit_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/leftSLimit");
RS_SETTINGS->writeEntry("/XAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("X轴左软限位改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbYAxisLeftSLimit_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/leftSLimit");
RS_SETTINGS->writeEntry("/YAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Y轴左软限位改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAxisLeftSLimit_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/leftSLimit");
RS_SETTINGS->writeEntry("/ZAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z1轴左软限位改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAAxisLeftSLimit_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/leftSLimit");
RS_SETTINGS->writeEntry("/ZAAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z轴左软限位改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbXAxisRightSLimit_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/rightSLimit");
RS_SETTINGS->writeEntry("/XAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("X轴右软限位改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbYAxisRightSLimit_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/rightSLimit");
RS_SETTINGS->writeEntry("/YAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Y轴右软限位改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAxisRightSLimit_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/rightSLimit");
RS_SETTINGS->writeEntry("/ZAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z1轴右软限位改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAAxisRightSLimit_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/rightSLimit");
RS_SETTINGS->writeEntry("/ZAAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z轴右软限位改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbXAxisVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/Vel");
RS_SETTINGS->writeEntry("/XAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("X轴回零速度改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbYAxisVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/Vel");
RS_SETTINGS->writeEntry("/YAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Y轴回零速度改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAxisVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/Vel");
RS_SETTINGS->writeEntry("/ZAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z1轴回零速度改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAAxisVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/Vel");
RS_SETTINGS->writeEntry("/ZAAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z轴回零速度改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbXAxisFindINDXVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/findINDXVel");
RS_SETTINGS->writeEntry("/XAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("X轴回零找INDX速度改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbYAxisFindINDXVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/findINDXVel");
RS_SETTINGS->writeEntry("/YAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Y轴回零找INDX速度改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAxisFindINDXVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/findINDXVel");
RS_SETTINGS->writeEntry("/ZAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z1轴回零找INDX速度改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZAAxisFindINDXVel_valueChanged(double value)
{
RS_SETTINGS->beginGroup("device/toHome/findINDXVel");
RS_SETTINGS->writeEntry("/ZAAxis", value);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z轴回零找INDX速度改变为%1mm/s").arg(value));
}
void ToHomeSetWidget::on_dsbZ0AxisToHomePos_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/Pos");
RS_SETTINGS->writeEntry("/Z0Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z0轴回零位置改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZ2AxisToHomePos_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/Pos");
RS_SETTINGS->writeEntry("/Z2Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴回零位置改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZDAxisToHomePos_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/Pos");
RS_SETTINGS->writeEntry("/DAxis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("D轴回零位置改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZ0AxisLeftSLimit_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/leftSLimit");
RS_SETTINGS->writeEntry("/Z0Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z0轴左软限位改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZ2AxisLeftSLimit_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/leftSLimit");
RS_SETTINGS->writeEntry("/Z2Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴左软限位改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbDAxisLeftSLimit_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/leftSLimit");
RS_SETTINGS->writeEntry("/Z2Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴左软限位改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZ0AxisVel_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/Vel");
RS_SETTINGS->writeEntry("/Z0Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z0轴回零速度改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZ2AxisVel_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/Vel");
RS_SETTINGS->writeEntry("/Z2Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴回零速度改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbDAxisVel_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/Vel");
RS_SETTINGS->writeEntry("/DAxis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("D轴回零速度改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZ2AxisZeroPosOffset_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/zeroPosOffset");
RS_SETTINGS->writeEntry("/Z2Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴零点偏移改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZ0AxisZeroPosOffset_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/zeroPosOffset");
RS_SETTINGS->writeEntry("/Z0Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z0轴零点偏移改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbDAxisZeroPosOffset_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/zeroPosOffset");
RS_SETTINGS->writeEntry("/DAxis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("D轴零点偏移改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZ0AxisRightSLimit_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/rightSLimit");
RS_SETTINGS->writeEntry("/Z0Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z0轴右软限位改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZ2AxisRightSLimit_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/rightSLimit");
RS_SETTINGS->writeEntry("/Z2Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴右软限位改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbDAxisRightSLimit_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/rightSLimit");
RS_SETTINGS->writeEntry("/DAxis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("D轴右软限位改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZ0AxisFindINDXVel_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/findINDXVel");
RS_SETTINGS->writeEntry("/Z0Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z0轴回零找INDX速度改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbZ2AxisFindINDXVel_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/findINDXVel");
RS_SETTINGS->writeEntry("/Z2Axis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴回零找INDX速度改变为%1mm/s").arg(arg1));
}
void ToHomeSetWidget::on_dsbDAxisFindINDXVel_valueChanged(double arg1)
{
RS_SETTINGS->beginGroup("device/toHome/findINDXVel");
RS_SETTINGS->writeEntry("/DAxis", arg1);
RS_SETTINGS->endGroup();
DEVICE_INFO->printDeviceSystemInfo(QString("D轴回零找INDX速度改变为%1mm/s").arg(arg1));
}

View File

@@ -0,0 +1,88 @@
#ifndef TOHOMESETWIDGET_H
#define TOHOMESETWIDGET_H
#include <QFrame>
#include "ui_tohomesetwidget.h"
class ToHomeSetWidget:public QFrame
{
Q_OBJECT
public:
explicit ToHomeSetWidget(QWidget* parent=nullptr);
private slots:
void on_dsbXAxisToHomePos_valueChanged(double value);
void on_dsbYAxisToHomePos_valueChanged(double value);
void on_dsbZAxisToHomePos_valueChanged(double value);
void on_dsbZAAxisToHomePos_valueChanged(double value);
void on_dsbXAxisZeroPosOffset_valueChanged(double value);
void on_dsbYAxisZeroPosOffset_valueChanged(double value);
void on_dsbZAxisZeroPosOffset_valueChanged(double value);
void on_dsbZAAxisZeroPosOffset_valueChanged(double value);
void on_dsbXAxisLeftSLimit_valueChanged(double value);
void on_dsbYAxisLeftSLimit_valueChanged(double value);
void on_dsbZAxisLeftSLimit_valueChanged(double value);
void on_dsbZAAxisLeftSLimit_valueChanged(double value);
void on_dsbXAxisRightSLimit_valueChanged(double value);
void on_dsbYAxisRightSLimit_valueChanged(double value);
void on_dsbZAxisRightSLimit_valueChanged(double value);
void on_dsbZAAxisRightSLimit_valueChanged(double value);
void on_dsbXAxisVel_valueChanged(double value);
void on_dsbYAxisVel_valueChanged(double value);
void on_dsbZAxisVel_valueChanged(double value);
void on_dsbZAAxisVel_valueChanged(double value);
void on_dsbXAxisFindINDXVel_valueChanged(double value);
void on_dsbYAxisFindINDXVel_valueChanged(double value);
void on_dsbZAxisFindINDXVel_valueChanged(double value);
void on_dsbZAAxisFindINDXVel_valueChanged(double value);
void on_dsbZ0AxisToHomePos_valueChanged(double arg1);
void on_dsbZ2AxisToHomePos_valueChanged(double arg1);
void on_dsbZDAxisToHomePos_valueChanged(double arg1);
void on_dsbZ0AxisLeftSLimit_valueChanged(double arg1);
void on_dsbZ2AxisLeftSLimit_valueChanged(double arg1);
void on_dsbDAxisLeftSLimit_valueChanged(double arg1);
void on_dsbZ0AxisVel_valueChanged(double arg1);
void on_dsbZ2AxisVel_valueChanged(double arg1);
void on_dsbDAxisVel_valueChanged(double arg1);
void on_dsbZ2AxisZeroPosOffset_valueChanged(double arg1);
void on_dsbZ0AxisZeroPosOffset_valueChanged(double arg1);
void on_dsbDAxisZeroPosOffset_valueChanged(double arg1);
void on_dsbZ0AxisRightSLimit_valueChanged(double arg1);
void on_dsbZ2AxisRightSLimit_valueChanged(double arg1);
void on_dsbDAxisRightSLimit_valueChanged(double arg1);
void on_dsbZ0AxisFindINDXVel_valueChanged(double arg1);
void on_dsbZ2AxisFindINDXVel_valueChanged(double arg1);
void on_dsbDAxisFindINDXVel_valueChanged(double arg1);
private:
void loadSet();
private:
Ui::ToHomeSetWidget* ui;
};
#endif // TOHOMESETWIDGET_H

2580
device/ui/tohomesetwidget.ui Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,273 @@
#include "workfileeditwidget.h"
#include "ui_workfileeditwidget.h"
#include "workfileedit/workfileedit.h "
#include <QFileDialog>
#include "rs_settings.h"
#include "deviceproxy.h"
WORKFILEEDITWIDGET::WORKFILEEDITWIDGET(QWidget *parent) :
QWidget(parent),
ui(new Ui::WORKFILEEDITWIDGET)
{
ui->setupUi(this);
WORKFILEEDIT->SetTableView(ui->tvWorkFile);
ComboBoxDelegate *pComboBox = new ComboBoxDelegate(this);
WORKFILEEDIT->SetComboBoxDelegate(pComboBox);
SpinBoxDelegate *pSpinBox = new SpinBoxDelegate(this);
WORKFILEEDIT->SetSpinBoxDelegate(pSpinBox);
// CheckBoxDelegate *pCheckBox = new CheckBoxDelegate(this);
// WORKFILEEDIT->SetCheckBoxDelegate(pCheckBox);
RS_SETTINGS->beginGroup("device/WorkFile"); //?path读不到
QString aFileName = RS_SETTINGS->readEntry("/配方1");
ui->leEditFile->setText(aFileName);
RS_SETTINGS->endGroup();
if (!aFileName.isEmpty())
{
WORKFILEEDIT->open_file(aFileName);
}
//DEV->UpdateWorkData(1);
peifang_model = new QStandardItemModel();
ui->tvPeiFang->setModel (peifang_model) ; //设置数据模型
QStringList headerList;
headerList<<"配方"<<"文件";
peifang_model->setHorizontalHeaderLabels(headerList);
peifang_model->setItem(0,0,new QStandardItem("配方1"));
peifang_model->setItem(1,0,new QStandardItem("配方2"));
peifang_model->setItem(2,0,new QStandardItem("配方3"));
peifang_model->setItem(3,0,new QStandardItem("配方4"));
peifang_model->setItem(4,0,new QStandardItem("配方5"));
peifang_model->setItem(5,0,new QStandardItem("配方6"));
peifang_model->setItem(6,0,new QStandardItem("配方7"));
peifang_model->setItem(7,0,new QStandardItem("配方8"));
peifang_model->setItem(8,0,new QStandardItem("配方9"));
peifang_model->setItem(9,0,new QStandardItem("配方10"));
RS_SETTINGS->beginGroup("device/WorkFile"); //?path读不到
QString aFileName1 = RS_SETTINGS->readEntry("/配方1");
QString aFileName2 = RS_SETTINGS->readEntry("/配方2");
QString aFileName3 = RS_SETTINGS->readEntry("/配方3");
QString aFileName4 = RS_SETTINGS->readEntry("/配方4");
QString aFileName5 = RS_SETTINGS->readEntry("/配方5");
QString aFileName6 = RS_SETTINGS->readEntry("/配方6");
QString aFileName7 = RS_SETTINGS->readEntry("/配方7");
QString aFileName8 = RS_SETTINGS->readEntry("/配方8");
QString aFileName9 = RS_SETTINGS->readEntry("/配方9");
QString aFileName10 = RS_SETTINGS->readEntry("/配方10");
RS_SETTINGS->endGroup();
// if (aFileName1 == "")
// aFileName1 = "配方1";
{
peifang_model->setItem(0,1,new QStandardItem(aFileName1));
peifang_model->setItem(1,1,new QStandardItem(aFileName2));
peifang_model->setItem(2,1,new QStandardItem(aFileName3));
peifang_model->setItem(3,1,new QStandardItem(aFileName4));
peifang_model->setItem(4,1,new QStandardItem(aFileName5));
peifang_model->setItem(5,1,new QStandardItem(aFileName6));
peifang_model->setItem(6,1,new QStandardItem(aFileName7));
peifang_model->setItem(7,1,new QStandardItem(aFileName8));
peifang_model->setItem(8,1,new QStandardItem(aFileName9));
peifang_model->setItem(9,1,new QStandardItem(aFileName10));
}
//设置表格的各列的宽度值
ui->tvPeiFang->setColumnWidth(0,80);
ui->tvPeiFang->setColumnWidth(1,350);
ui->tvPeiFang->setEditTriggers(QAbstractItemView::NoEditTriggers);
}
WORKFILEEDITWIDGET::~WORKFILEEDITWIDGET()
{
delete ui;
}
void WORKFILEEDITWIDGET::on_pbAddRow_clicked()
{
WORKFILEEDIT->add_row();
}
void WORKFILEEDITWIDGET::on_pbInsertRow_clicked()
{
WORKFILEEDIT->insert_row();
}
void WORKFILEEDITWIDGET::on_pbDeleteRow_clicked()
{
WORKFILEEDIT->delete_row();
}
void WORKFILEEDITWIDGET::on_pbMoveP_clicked()
{
WORKFILEEDIT->move_P();
}
void WORKFILEEDITWIDGET::on_pbMoveN_clicked()
{
WORKFILEEDIT->move_N();
}
void WORKFILEEDITWIDGET::on_pbNewFile_clicked()
{
WORKFILEEDIT->new_file();
ui->leEditFile->setText("");
}
void WORKFILEEDITWIDGET::on_pbLoadFile_clicked()
{
QString curPath=QCoreApplication::applicationDirPath(); //获取应用程序的路径
QString aFileName=QFileDialog::getOpenFileName(this,"打开一个文件",curPath, "数据文件(*.WI);;所有文件(*.*)");
WORKFILEEDIT->open_file(aFileName);
ui->leEditFile->setText(aFileName);
}
void WORKFILEEDITWIDGET::on_pbSaveFile_clicked()
{
QString aFileName;
if (WORKFILEEDIT->getWorkFileName() == "")
{
QString curPath=QCoreApplication::applicationDirPath(); //获取应用程序的路径
aFileName = QFileDialog::getSaveFileName(this,"保存文件",curPath,"数据文件(*.WI);;所有文件(*.*)");
WORKFILEEDIT->save_file(aFileName);
ui->leEditFile->setText(aFileName);
}
else
{
WORKFILEEDIT->save_file(WORKFILEEDIT->getWorkFileName());
ui->leEditFile->setText(WORKFILEEDIT->getWorkFileName());
}
QMessageBox::information(this, "提示", "文件保存成功!");
}
void WORKFILEEDITWIDGET::on_pbDeleteFile_clicked()
{
WORKFILEEDIT->delete_file();
ui->leEditFile->setText("");
}
//void WORKFILEEDITWIDGET::on_pbSelectWorkFile_clicked()
//{
// QString curPath=QCoreApplication::applicationDirPath(); //获取应用程序的路径
// QString aFileName=QFileDialog::getOpenFileName(this,"选择文件",curPath, "数据文件(*.WI);;所有文件(*.*)");
// if (aFileName == "")
// return;
// QString str;
// ui->leWorkFile->setText(aFileName);
// str = "/" + ui->mbMode->currentText();
// RS_SETTINGS->beginGroup("device/WorkFile");
// RS_SETTINGS->writeEntry(str,aFileName);
// RS_SETTINGS->endGroup();
// //DEV->UpdateWorkData(1);
//// QFile aFile(aFileName); //以文件方式读出
//// if (aFile.open(QIODevice::ReadOnly)) //以只读文本方式打开文件
//// {
//// QTextStream aStream(&aFile); //用文本流读取文件
//// while (!aStream.atEnd())
//// {
//// QString str=aStream.readLine();//读取文件的一行
//// DEV->fFileContent.append(str); //添加到 StringList
//// }
//// aFile.close();//关闭文件
//// }
//}
void WORKFILEEDITWIDGET::on_tvWorkFile_doubleClicked(const QModelIndex &index)
{
int curRow=ui->tvWorkFile->currentIndex().row();//选中行
int curCol=ui->tvWorkFile->currentIndex().column();//选中行
QAbstractItemModel *modessl = ui->tvWorkFile->model();
QModelIndex indextemp = modessl->index(curRow,0);//遍历第一行的所有列
QString value = indextemp.model()->data(indextemp, Qt::DisplayRole).toString();
//ui->tvWorkFile->model(); model->setData(index, spinbox->value());
if (curCol == 1)
{
if ((value == "加工") || (value == "功率测量") || (value == "DD马达"))
ui->tvWorkFile->setEditTriggers(QAbstractItemView::DoubleClicked);
else
ui->tvWorkFile->setEditTriggers(QAbstractItemView::NoEditTriggers);
}
else if (curCol == 2)
{
if (value != "加工")
ui->tvWorkFile->setEditTriggers(QAbstractItemView::NoEditTriggers);
else
ui->tvWorkFile->setEditTriggers(QAbstractItemView::DoubleClicked);
}
else
{
ui->tvWorkFile->setEditTriggers(QAbstractItemView::DoubleClicked);
}
//model->setData(index, combox->currentText());
}
void WORKFILEEDITWIDGET::on_pbSaveAs_clicked()
{
QString aFileName;
QString curPath=QCoreApplication::applicationDirPath(); //获取应用程序的路径
aFileName = QFileDialog::getSaveFileName(this,"保存文件",curPath,"数据文件(*.WI);;所有文件(*.*)");
WORKFILEEDIT->save_file(aFileName);
ui->leEditFile->setText(aFileName);
QMessageBox::information(this, "提示", "文件保存成功!");
}
//void WORKFILEEDITWIDGET::on_mbMode_currentTextChanged(const QString &arg1)
//{
// QString str;
// str = "/" + arg1;
// RS_SETTINGS->beginGroup("device/WorkFile"); //?path读不到
// QString aFileName = RS_SETTINGS->readEntry(str);
// ui->leWorkFile->setText(aFileName);
// RS_SETTINGS->endGroup();
//}
void WORKFILEEDITWIDGET::on_tvPeiFang_doubleClicked(const QModelIndex &index)
{
int curRow=ui->tvPeiFang->currentIndex().row();//选中行
int curCol=ui->tvPeiFang->currentIndex().column();//选中行
QAbstractItemModel *modessl = ui->tvPeiFang->model();
QModelIndex indextemp = modessl->index(curRow,0);//遍历第一行的所有列
QString value = indextemp.model()->data(indextemp, Qt::DisplayRole).toString();
if (curCol == 1)
{
QString curPath=QCoreApplication::applicationDirPath(); //获取应用程序的路径
QString aFileName=QFileDialog::getOpenFileName(this,"选择文件",curPath, "数据文件(*.WI);;所有文件(*.*)");
// if (aFileName == "")
// return;
QString str;
//ui->leWorkFile->setText(aFileName);
str = "/" + value;
RS_SETTINGS->beginGroup("device/WorkFile");
RS_SETTINGS->writeEntry(str,aFileName);
RS_SETTINGS->endGroup();
ui->tvPeiFang->model()->setData(index, aFileName);
}
}

View File

@@ -0,0 +1,52 @@
#ifndef WORKFILEEDITWIDGET_H
#define WORKFILEEDITWIDGET_H
#include <QWidget>
#include <QStandardItemModel>
#include <QItemSelectionModel>
#include <QtWidgets/QTableView>
namespace Ui {
class WORKFILEEDITWIDGET;
}
class WORKFILEEDITWIDGET : public QWidget
{
Q_OBJECT
public:
explicit WORKFILEEDITWIDGET(QWidget *parent = nullptr);
~WORKFILEEDITWIDGET();
private slots:
void on_pbAddRow_clicked();
void on_pbInsertRow_clicked();
void on_pbDeleteRow_clicked();
void on_pbMoveP_clicked();
void on_pbMoveN_clicked();
void on_pbNewFile_clicked();
void on_pbLoadFile_clicked();
void on_pbSaveFile_clicked();
void on_pbDeleteFile_clicked();
void on_tvWorkFile_doubleClicked(const QModelIndex &index);
void on_pbSaveAs_clicked();
void on_tvPeiFang_doubleClicked(const QModelIndex &index);
private:
Ui::WORKFILEEDITWIDGET *ui;
QStandardItemModel *peifang_model;
};
#endif // WORKFILEEDITWIDGET_H

View File

@@ -0,0 +1,465 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WORKFILEEDITWIDGET</class>
<widget class="QWidget" name="WORKFILEEDITWIDGET">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>838</width>
<height>404</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>70</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="title">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pbSaveFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>保 存(&amp;S)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbSaveAs">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>另存为(K)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbNewFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>新建文件(&amp;N)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbLoadFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>加载文件(&amp;L)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbDeleteFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>删除文件(&amp;M)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>当前编辑文件:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leEditFile">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTableView" name="tvWorkFile">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QTableView::item {
text-align: center;
}</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="pbAddRow">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>新 增(&amp;A)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbInsertRow">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>插 入(&amp;I)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbDeleteRow">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>删 除(&amp;D)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbMoveP">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>上 移(&amp;P)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbMoveN">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>下 移(&amp;X)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTableView" name="tvPeiFang"/>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,50 @@
#include "zaaxiscpossetwidget.h"
#include "deviceproxy.h"
#include "rs_settings.h"
#include "bridgesgl.h"
ZAAxisCPosSetWidget::ZAAxisCPosSetWidget(QWidget* parent)
:QFrame(parent)
,ui(new Ui::ZAAxisCPosSetWidget)
{
ui->setupUi(this);
loadSet();
connect(DEV,SIGNAL(ZAAxisCtPosSGL(double)),this,SLOT(setZAAxisCtPos(const double&)));
}
void ZAAxisCPosSetWidget::setZAAxisCtPos(const double& value)
{
ZAAxisCtPos = value;
ui->lbZAAxisCtPos->setText(QString("%1mm").arg(QString::number(value,'f',4)));
}
void ZAAxisCPosSetWidget::loadSet()
{
RS_SETTINGS->beginGroup("device");
QMap<QString,double> ZAAxisCPosMapTemp;
ZAAxisCPosMapTemp = RS_SETTINGS->readQMapQStringDoubleEntry("/ZAAxisCPosMap", ZAAxisCPosMapTemp);
RS_SETTINGS->endGroup();
ui->lwPosList->addItems(ZAAxisCPosMapTemp.keys());
}
void ZAAxisCPosSetWidget::on_pbAdd_clicked()
{
QString temp = ui->leSuffix->text();
temp = temp.trimmed();
if(temp!="")
{
temp+=":";
}
temp+=ui->lbZAAxisCtPos->text();
ui->lwPosList->addItem(temp);
emit BDGSGL->addZAAxisCPosSGL(temp,ZAAxisCtPos);
}
void ZAAxisCPosSetWidget::on_pbDelete_clicked()
{
emit BDGSGL->deleteZAAxisCPosSGL(ui->lwPosList->currentItem()->text());
int row = ui->lwPosList->currentRow();
QListWidgetItem* item = ui->lwPosList->takeItem(row);
delete item;
}

View File

@@ -0,0 +1,24 @@
#ifndef ZAAXISCPOSSETWIDGET_H
#define ZAAXISCPOSSETWIDGET_H
#include <QFrame>
#include "ui_zaaxiscpossetwidget.h"
class ZAAxisCPosSetWidget:public QFrame
{
Q_OBJECT
public:
explicit ZAAxisCPosSetWidget(QWidget* parent=nullptr);
private slots:
void setZAAxisCtPos(const double& value);
void loadSet();
void on_pbAdd_clicked();
void on_pbDelete_clicked();
private:
Ui::ZAAxisCPosSetWidget* ui;
double ZAAxisCtPos{0.0};
};
#endif // ZAAXISCPOSSETWIDGET_H

View File

@@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ZAAxisCPosSetWidget</class>
<widget class="QWidget" name="ZAAxisCPosSetWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>370</width>
<height>192</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>356</width>
<height>178</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1" columnstretch="0,1">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QListWidget" name="lwPosList">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Z轴位置:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbZAAxisCtPos">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>前缀:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leSuffix">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbAdd">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>添加</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbDelete">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>删除</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>38</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>