refactor(*):03LaserCut_V00.00.01,Spark100项目发货前功能提取
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "IPG_laser.h"
|
||||
#include "deviceinfo.h"
|
||||
#include "deviceproxy.h"
|
||||
|
||||
#include "rs_settings.h"
|
||||
|
||||
IPGLaser* IPGLaser::uniqueInstance = nullptr;
|
||||
IPGLaser* IPGLaser::instance()
|
||||
@@ -333,6 +333,103 @@ int IPGLaser::GetLaserSts()
|
||||
::LeaveCriticalSection(&mCsRead);
|
||||
return ret;
|
||||
}
|
||||
int IPGLaser::UpdateIPGPara()
|
||||
{
|
||||
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
|
||||
PP_Enable = RS_SETTINGS->readEntry("/PPEnable");
|
||||
|
||||
Power1 = RS_SETTINGS->readEntry("/PP1");
|
||||
Prepump1 = RS_SETTINGS->readEntry("/PG1");
|
||||
PulseRepetition1 = RS_SETTINGS->readEntry("/AM1");
|
||||
PulseDuration1 = RS_SETTINGS->readEntry("/MODE1");
|
||||
|
||||
Power2 = RS_SETTINGS->readEntry("/PP2");
|
||||
Prepump2 = RS_SETTINGS->readEntry("/PG2");
|
||||
PulseRepetition2 = RS_SETTINGS->readEntry("/AM2");
|
||||
PulseDuration2 = RS_SETTINGS->readEntry("/MODE2");
|
||||
|
||||
Power3 = RS_SETTINGS->readEntry("/PP3");
|
||||
Prepump3 = RS_SETTINGS->readEntry("/PG3");
|
||||
PulseRepetition3 = RS_SETTINGS->readEntry("/AM3");
|
||||
PulseDuration3 = RS_SETTINGS->readEntry("/MODE3");
|
||||
|
||||
Power4 = RS_SETTINGS->readEntry("/PP4");
|
||||
Prepump4 = RS_SETTINGS->readEntry("/PG4");
|
||||
PulseRepetition4 = RS_SETTINGS->readEntry("/AM4");
|
||||
PulseDuration4 = RS_SETTINGS->readEntry("/MODE4");
|
||||
|
||||
Power5 = RS_SETTINGS->readEntry("/PP5");
|
||||
Prepump5 = RS_SETTINGS->readEntry("/PG5");
|
||||
PulseRepetition5 = RS_SETTINGS->readEntry("/AM5");
|
||||
PulseDuration5 = RS_SETTINGS->readEntry("/MODE5");
|
||||
|
||||
Power6 = RS_SETTINGS->readEntry("/PP6");
|
||||
Prepump6 = RS_SETTINGS->readEntry("/PG6");
|
||||
PulseRepetition6 = RS_SETTINGS->readEntry("/AM6");
|
||||
PulseDuration6 = RS_SETTINGS->readEntry("/MODE6");
|
||||
|
||||
Power7 = RS_SETTINGS->readEntry("/PP7");
|
||||
Prepump7 = RS_SETTINGS->readEntry("/PG7");
|
||||
PulseRepetition7 = RS_SETTINGS->readEntry("/AM7");
|
||||
PulseDuration7 = RS_SETTINGS->readEntry("/MODE7");
|
||||
|
||||
Power8 = RS_SETTINGS->readEntry("/PP8");
|
||||
Prepump8 = RS_SETTINGS->readEntry("/PG8");
|
||||
PulseRepetition8 = RS_SETTINGS->readEntry("/AM8");
|
||||
PulseDuration8 = RS_SETTINGS->readEntry("/MODE8");
|
||||
RS_SETTINGS->endGroup();
|
||||
|
||||
|
||||
Power1_set= Power1;
|
||||
int tmp;
|
||||
tmp = PulseDuration1.toInt() -1;
|
||||
PulseDuration1 = QString::number(tmp);
|
||||
QString str;
|
||||
str = getValueFromList(DEV->deCodeString,"PW1");
|
||||
dstPower1 = str.toDouble();
|
||||
|
||||
Power2_set= Power2;
|
||||
|
||||
tmp = PulseDuration2.toInt() -1;
|
||||
PulseDuration2 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW2");
|
||||
dstPower2 = str.toDouble();
|
||||
|
||||
tmp = PulseDuration3.toInt() -1;
|
||||
PulseDuration3 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW3");
|
||||
dstPower3 = str.toDouble();
|
||||
|
||||
tmp = PulseDuration4.toInt() -1;
|
||||
PulseDuration4 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW4");
|
||||
dstPower4 = str.toDouble();
|
||||
|
||||
tmp = PulseDuration5.toInt() -1;
|
||||
PulseDuration5 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW5");
|
||||
dstPower5 = str.toDouble();
|
||||
|
||||
tmp = PulseDuration6.toInt() -1;
|
||||
PulseDuration6 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW6");
|
||||
dstPower6 = str.toDouble();
|
||||
|
||||
tmp = PulseDuration7.toInt() -1;
|
||||
PulseDuration7 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW7");
|
||||
dstPower7 = str.toDouble();
|
||||
|
||||
tmp = PulseDuration8.toInt() -1;
|
||||
PulseDuration8 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW8");
|
||||
dstPower8 = str.toDouble();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
int IPGLaser::getIPGLaerPara(QString DevName)
|
||||
{
|
||||
QSettings *settings;//申明一个QSetting类函数
|
||||
@@ -362,91 +459,147 @@ int IPGLaser::getIPGLaerPara(QString DevName)
|
||||
nStopBits = 0; //停止位1
|
||||
|
||||
//int ret = DEV->deCode_file(".\\Data\\laser_para1.txt");
|
||||
int ret = DEV->deCode_file(".\\Data\\data.txt");
|
||||
if (ret != 0)
|
||||
return -1;
|
||||
// int ret = DEV->deCode_file(".\\Data\\data.txt");
|
||||
// if (ret != 0)
|
||||
// return -1;
|
||||
// Mode 1
|
||||
// AM 50
|
||||
// PP 10
|
||||
// PG 6500
|
||||
//QStringList list = DEV->deCodeString.split("\n"); // 按","为分隔符分割字符串,list的值为["apple", "banana", "pear"]
|
||||
Power1 = getValueFromList(DEV->deCodeString,"PP1");
|
||||
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
|
||||
PP_Enable = RS_SETTINGS->readEntry("/PPEnable");
|
||||
|
||||
Power1 = RS_SETTINGS->readEntry("/PP1");
|
||||
Prepump1 = RS_SETTINGS->readEntry("/PG1");
|
||||
PulseRepetition1 = RS_SETTINGS->readEntry("/AM1");
|
||||
PulseDuration1 = RS_SETTINGS->readEntry("/MODE1");
|
||||
|
||||
Power2 = RS_SETTINGS->readEntry("/PP2");
|
||||
Prepump2 = RS_SETTINGS->readEntry("/PG2");
|
||||
PulseRepetition2 = RS_SETTINGS->readEntry("/AM2");
|
||||
PulseDuration2 = RS_SETTINGS->readEntry("/MODE2");
|
||||
|
||||
Power3 = RS_SETTINGS->readEntry("/PP3");
|
||||
Prepump3 = RS_SETTINGS->readEntry("/PG3");
|
||||
PulseRepetition3 = RS_SETTINGS->readEntry("/AM3");
|
||||
PulseDuration3 = RS_SETTINGS->readEntry("/MODE3");
|
||||
|
||||
Power4 = RS_SETTINGS->readEntry("/PP4");
|
||||
Prepump4 = RS_SETTINGS->readEntry("/PG4");
|
||||
PulseRepetition4 = RS_SETTINGS->readEntry("/AM4");
|
||||
PulseDuration4 = RS_SETTINGS->readEntry("/MODE4");
|
||||
|
||||
Power5 = RS_SETTINGS->readEntry("/PP5");
|
||||
Prepump5 = RS_SETTINGS->readEntry("/PG5");
|
||||
PulseRepetition5 = RS_SETTINGS->readEntry("/AM5");
|
||||
PulseDuration5 = RS_SETTINGS->readEntry("/MODE5");
|
||||
|
||||
Power6 = RS_SETTINGS->readEntry("/PP6");
|
||||
Prepump6 = RS_SETTINGS->readEntry("/PG6");
|
||||
PulseRepetition6 = RS_SETTINGS->readEntry("/AM6");
|
||||
PulseDuration6 = RS_SETTINGS->readEntry("/MODE6");
|
||||
|
||||
Power7 = RS_SETTINGS->readEntry("/PP7");
|
||||
Prepump7 = RS_SETTINGS->readEntry("/PG7");
|
||||
PulseRepetition7 = RS_SETTINGS->readEntry("/AM7");
|
||||
PulseDuration7 = RS_SETTINGS->readEntry("/MODE7");
|
||||
|
||||
Power8 = RS_SETTINGS->readEntry("/PP8");
|
||||
Prepump8 = RS_SETTINGS->readEntry("/PG8");
|
||||
PulseRepetition8 = RS_SETTINGS->readEntry("/AM8");
|
||||
PulseDuration8 = RS_SETTINGS->readEntry("/MODE8");
|
||||
RS_SETTINGS->endGroup();
|
||||
|
||||
///Power1 = getValueFromList(DEV->deCodeString,"PP1");//
|
||||
Power1_set= Power1;
|
||||
Prepump1 = getValueFromList(DEV->deCodeString,"PG1");
|
||||
PulseDuration1 = getValueFromList(DEV->deCodeString,"Mode1");
|
||||
///Prepump1 = getValueFromList(DEV->deCodeString,"PG1");//
|
||||
///PulseDuration1 = getValueFromList(DEV->deCodeString,"Mode1");//
|
||||
int tmp;
|
||||
tmp = PulseDuration1.toInt() -1;
|
||||
PulseDuration1 = QString::number(tmp);
|
||||
PulseRepetition1 = getValueFromList(DEV->deCodeString,"AM1");
|
||||
///PulseRepetition1 = getValueFromList(DEV->deCodeString,"AM1");//
|
||||
QString str;
|
||||
str = getValueFromList(DEV->deCodeString,"PW1");
|
||||
dstPower1 = str.toDouble();
|
||||
PP_Enable = getValueFromList(DEV->deCodeString,"PP_Enable");
|
||||
//PP_Enable = getValueFromList(DEV->deCodeString,"PP_Enable");
|
||||
|
||||
|
||||
// ret = DEV->deCode_file(".\\Data\\laser_para2.txt");
|
||||
// if (ret != 0)
|
||||
// return -1;
|
||||
Power2 = getValueFromList(DEV->deCodeString,"PP2");
|
||||
//Power2 = getValueFromList(DEV->deCodeString,"PP2");
|
||||
Power2_set= Power2;
|
||||
Prepump2 = getValueFromList(DEV->deCodeString,"PG2");
|
||||
PulseDuration2 = getValueFromList(DEV->deCodeString,"Mode2");
|
||||
PulseRepetition2 = getValueFromList(DEV->deCodeString,"AM2");
|
||||
//Prepump2 = getValueFromList(DEV->deCodeString,"PG2");
|
||||
//PulseDuration2 = getValueFromList(DEV->deCodeString,"Mode2");
|
||||
//PulseRepetition2 = getValueFromList(DEV->deCodeString,"AM2");
|
||||
tmp = PulseDuration2.toInt() -1;
|
||||
PulseDuration2 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW2");
|
||||
dstPower2 = str.toDouble();
|
||||
|
||||
DEVICE_INFO->printDeviceSystemInfo("MODE1:"+PulseDuration1+1);
|
||||
DEVICE_INFO->printDeviceSystemInfo("PP1:"+Power1);
|
||||
DEVICE_INFO->printDeviceSystemInfo("PG1:"+Prepump1);
|
||||
DEVICE_INFO->printDeviceSystemInfo("AM1:"+PulseRepetition1);
|
||||
|
||||
Power3 = getValueFromList(DEV->deCodeString,"PP3");
|
||||
Prepump3 = getValueFromList(DEV->deCodeString,"PG3");
|
||||
PulseDuration3 = getValueFromList(DEV->deCodeString,"Mode3");
|
||||
PulseRepetition3 = getValueFromList(DEV->deCodeString,"AM3");
|
||||
DEVICE_INFO->printDeviceSystemInfo("MODE2:"+PulseDuration2+1);
|
||||
DEVICE_INFO->printDeviceSystemInfo("PP2:"+Power2);
|
||||
DEVICE_INFO->printDeviceSystemInfo("PG2:"+Prepump2);
|
||||
DEVICE_INFO->printDeviceSystemInfo("AM2:"+PulseRepetition2);
|
||||
|
||||
|
||||
//Power3 = getValueFromList(DEV->deCodeString,"PP3");
|
||||
//Prepump3 = getValueFromList(DEV->deCodeString,"PG3");
|
||||
//PulseDuration3 = getValueFromList(DEV->deCodeString,"Mode3");
|
||||
//PulseRepetition3 = getValueFromList(DEV->deCodeString,"AM3");
|
||||
tmp = PulseDuration3.toInt() -1;
|
||||
PulseDuration3 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW3");
|
||||
dstPower3 = str.toDouble();
|
||||
|
||||
Power4 = getValueFromList(DEV->deCodeString,"PP4");
|
||||
Prepump4 = getValueFromList(DEV->deCodeString,"PG4");
|
||||
PulseDuration4 = getValueFromList(DEV->deCodeString,"Mode4");
|
||||
PulseRepetition4 = getValueFromList(DEV->deCodeString,"AM4");
|
||||
//Power4 = getValueFromList(DEV->deCodeString,"PP4");
|
||||
//Prepump4 = getValueFromList(DEV->deCodeString,"PG4");
|
||||
//PulseDuration4 = getValueFromList(DEV->deCodeString,"Mode4");
|
||||
//PulseRepetition4 = getValueFromList(DEV->deCodeString,"AM4");
|
||||
tmp = PulseDuration4.toInt() -1;
|
||||
PulseDuration4 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW4");
|
||||
dstPower4 = str.toDouble();
|
||||
|
||||
Power5 = getValueFromList(DEV->deCodeString,"PP5");
|
||||
Prepump5 = getValueFromList(DEV->deCodeString,"PG5");
|
||||
PulseDuration5 = getValueFromList(DEV->deCodeString,"Mode5");
|
||||
PulseRepetition5 = getValueFromList(DEV->deCodeString,"AM5");
|
||||
// Power5 = getValueFromList(DEV->deCodeString,"PP5");
|
||||
// Prepump5 = getValueFromList(DEV->deCodeString,"PG5");
|
||||
// PulseDuration5 = getValueFromList(DEV->deCodeString,"Mode5");
|
||||
// PulseRepetition5 = getValueFromList(DEV->deCodeString,"AM5");
|
||||
tmp = PulseDuration5.toInt() -1;
|
||||
PulseDuration5 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW5");
|
||||
dstPower5 = str.toDouble();
|
||||
|
||||
Power6 = getValueFromList(DEV->deCodeString,"PP6");
|
||||
Prepump6 = getValueFromList(DEV->deCodeString,"PG6");
|
||||
PulseDuration6 = getValueFromList(DEV->deCodeString,"Mode6");
|
||||
PulseRepetition6 = getValueFromList(DEV->deCodeString,"AM6");
|
||||
// Power6 = getValueFromList(DEV->deCodeString,"PP6");
|
||||
// Prepump6 = getValueFromList(DEV->deCodeString,"PG6");
|
||||
// PulseDuration6 = getValueFromList(DEV->deCodeString,"Mode6");
|
||||
// PulseRepetition6 = getValueFromList(DEV->deCodeString,"AM6");
|
||||
tmp = PulseDuration6.toInt() -1;
|
||||
PulseDuration6 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW6");
|
||||
dstPower6 = str.toDouble();
|
||||
|
||||
Power7 = getValueFromList(DEV->deCodeString,"PP7");
|
||||
Prepump7 = getValueFromList(DEV->deCodeString,"PG7");
|
||||
PulseDuration7 = getValueFromList(DEV->deCodeString,"Mode7");
|
||||
PulseRepetition7 = getValueFromList(DEV->deCodeString,"AM7");
|
||||
// Power7 = getValueFromList(DEV->deCodeString,"PP7");
|
||||
// Prepump7 = getValueFromList(DEV->deCodeString,"PG7");
|
||||
// PulseDuration7 = getValueFromList(DEV->deCodeString,"Mode7");
|
||||
// PulseRepetition7 = getValueFromList(DEV->deCodeString,"AM7");
|
||||
tmp = PulseDuration7.toInt() -1;
|
||||
PulseDuration7 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW7");
|
||||
dstPower7 = str.toDouble();
|
||||
|
||||
Power8 = getValueFromList(DEV->deCodeString,"PP8");
|
||||
Prepump8 = getValueFromList(DEV->deCodeString,"PG8");
|
||||
PulseDuration8 = getValueFromList(DEV->deCodeString,"Mode8");
|
||||
PulseRepetition8 = getValueFromList(DEV->deCodeString,"AM8");
|
||||
// Power8 = getValueFromList(DEV->deCodeString,"PP8");
|
||||
// Prepump8 = getValueFromList(DEV->deCodeString,"PG8");
|
||||
// PulseDuration8 = getValueFromList(DEV->deCodeString,"Mode8");
|
||||
// PulseRepetition8 = getValueFromList(DEV->deCodeString,"AM8");
|
||||
tmp = PulseDuration8.toInt() -1;
|
||||
PulseDuration8 = QString::number(tmp);
|
||||
str = getValueFromList(DEV->deCodeString,"PW8");
|
||||
|
||||
@@ -11,11 +11,13 @@ private:
|
||||
int revDataLen;
|
||||
|
||||
|
||||
|
||||
|
||||
static IPGLaser* uniqueInstance;
|
||||
|
||||
public:
|
||||
int UpdateIPGPara();
|
||||
|
||||
QString PP_Enable;
|
||||
|
||||
QString Power1;
|
||||
QString Prepump1;
|
||||
QString PulseDuration1;
|
||||
@@ -36,26 +38,31 @@ public:
|
||||
QString PulseDuration3;
|
||||
QString PulseRepetition3;
|
||||
double dstPower3;
|
||||
|
||||
QString Power4;
|
||||
QString Prepump4;
|
||||
QString PulseDuration4;
|
||||
QString PulseRepetition4;
|
||||
double dstPower4;
|
||||
|
||||
QString Power5;
|
||||
QString Prepump5;
|
||||
QString PulseDuration5;
|
||||
QString PulseRepetition5;
|
||||
double dstPower5;
|
||||
|
||||
QString Power6;
|
||||
QString Prepump6;
|
||||
QString PulseDuration6;
|
||||
QString PulseRepetition6;
|
||||
double dstPower6;
|
||||
|
||||
QString Power7;
|
||||
QString Prepump7;
|
||||
QString PulseDuration7;
|
||||
QString PulseRepetition7;
|
||||
double dstPower7;
|
||||
|
||||
QString Power8;
|
||||
QString Prepump8;
|
||||
QString PulseDuration8;
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#define ACSCTL_RUNF_V "runF"
|
||||
#define ACSCTL_RCECATADDR_V "RangeSAddr"
|
||||
#define ACSCTL_RSVALUE_V "RangeV"
|
||||
#define ACSCTL_RCECATADDR_V_Z0 "RangeSAddr_Z0"
|
||||
#define ACSCTL_RSVALUE_V_Z0 "RangeV_Z0"
|
||||
#define ACSCTL_Z0_VALUE "Z0_value"
|
||||
#define ACSCTL_DI1_V "DI1"
|
||||
#define ACSCTL_DI2_V "DI2"
|
||||
#define ACSCTL_DO1_V "DO1"
|
||||
|
||||
@@ -26,3 +26,30 @@ QString Buffer0AutoExeCode::getCode()
|
||||
"STOP";
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
QString Buffer0AutoExeCode::getCode_2()
|
||||
{
|
||||
QString code("\n");
|
||||
/*
|
||||
* ECUNMAPIN 此函数用于将ECIN定义的所有映射重置为特定偏移量
|
||||
* ECIN 将EtherCAT偏移地址的值映射到变量
|
||||
*/
|
||||
code+=
|
||||
"AUTOEXEC:\n"
|
||||
"ECUNMAPIN(RangeSAddr)\n"
|
||||
"ECUNMAPIN(RangeSAddr_Z0)\n"
|
||||
// 禁用报警
|
||||
"SAFETYCONF ALL,#NT,\"-\"\n"
|
||||
"ECIN(RangeSAddr, RangeVInt)\n"
|
||||
"ECIN(RangeSAddr_Z0, RangeVInt_Z0)\n"
|
||||
"WAIT 50\n"
|
||||
"WHILE 1\n"
|
||||
// 测距值换算为mm
|
||||
"RangeV=RangeVInt/10000\n"
|
||||
"RangeV_Z0=RangeVInt_Z0/10000\n"
|
||||
"END\n"
|
||||
"STOP";
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ class Buffer0AutoExeCode
|
||||
public:
|
||||
Buffer0AutoExeCode();
|
||||
QString getCode();
|
||||
QString getCode_2();
|
||||
};
|
||||
|
||||
#endif // BUFFER0AUTOEXECODE_H
|
||||
|
||||
@@ -117,7 +117,7 @@ QString RSensorToZero::getCode()
|
||||
|
||||
QString code;
|
||||
code+=
|
||||
QString("GLOBAL INT DuiLingF=-1\n")+
|
||||
QString("GLOBAL INT DuiLingF=-1\n")+ //粗测高标志位
|
||||
QString("VEL(Z) = 2\n")+
|
||||
QString("ACC(Z) = 20\n")+
|
||||
QString("DEC(Z) = 20\n")+
|
||||
@@ -191,3 +191,69 @@ QString RSensorToZero::getCode()
|
||||
"STOP";
|
||||
return code;
|
||||
}
|
||||
QString RSensorToZero::getCode_Z0()
|
||||
{
|
||||
/*
|
||||
"ECIN(RangeSAddr_Z0, RangeVInt_Z0)\n"
|
||||
"RangeV_Z0=RangeVInt_Z0/10000\n"
|
||||
*/
|
||||
QString code;
|
||||
code+=
|
||||
QString("VEL(Z0) = 2\n")+
|
||||
QString("ACC(Z0) = 20\n")+
|
||||
QString("DEC(Z0) = 20\n")+
|
||||
QString("JERK(Z0) = 200\n")+
|
||||
QString("KDEC(Z0) = 200\n")+
|
||||
QString("PTP/e Z0, 0\n")+
|
||||
"WAIT 4000\n"
|
||||
"IF (RangeV_Z0-Z0_value)<-1.5\n"+
|
||||
QString("VEL(Z0) = %1\n").arg(ZAAxisToSafePosVel)+
|
||||
QString("ACC(Z0) = %1\n").arg(ZAAxisToSafePosVel*10)+
|
||||
QString("DEC(Z0) = %1\n").arg(ZAAxisToSafePosVel*10)+
|
||||
QString("JERK(Z0) = %1\n").arg(ZAAxisToSafePosVel*100)+
|
||||
QString("KDEC(Z0) = %1\n").arg(ZAAxisToSafePosVel*100)+
|
||||
QString("PTP/e Z0, %1\n").arg(ZAAxisSafePos)+
|
||||
QString("VEL(Z0) = %1\n").arg(ZAAxisToZero1Vel)+
|
||||
QString("ACC(Z0) = %1\n").arg(ZAAxisToZero1Vel*10)+
|
||||
QString("DEC(Z0) = %1\n").arg(ZAAxisToZero1Vel*10)+
|
||||
QString("JERK(Z0) = %1\n").arg(ZAAxisToZero1Vel*100)+
|
||||
QString("KDEC(Z0) = %1\n").arg(ZAAxisToZero1Vel*100)+
|
||||
"PTP Z0, -30\n"
|
||||
"TILL ABS(RangeV_Z0-Z0_value) < 0.1\n"
|
||||
"HALT Z0\n"
|
||||
"WAIT 4000\n"+
|
||||
QString("VEL(Z0) = %1\n").arg(ZAAxisToZero2Vel)+
|
||||
QString("ACC(Z0) = %1\n").arg(ZAAxisToZero2Vel*10)+
|
||||
QString("DEC(Z0) = %1\n").arg(ZAAxisToZero2Vel*10)+
|
||||
QString("JERK(Z0) = %1\n").arg(ZAAxisToZero2Vel*100)+
|
||||
QString("KDEC(Z0) = %1\n").arg(ZAAxisToZero2Vel*100)+
|
||||
"PTP/er Z0, RangeV_Z0-Z0_value\n"
|
||||
"WAIT 4000\n"
|
||||
"ELSE\n"+
|
||||
QString("VEL(Z0) = %1\n").arg(ZAAxisToZero1Vel)+
|
||||
QString("ACC(Z0) = %1\n").arg(ZAAxisToZero1Vel*10)+
|
||||
QString("DEC(Z0) = %1\n").arg(ZAAxisToZero1Vel*10)+
|
||||
QString("JERK(Z0) = %1\n").arg(ZAAxisToZero1Vel*100)+
|
||||
QString("KDEC(Z0) = %1\n").arg(ZAAxisToZero1Vel*100)+
|
||||
"PTP/ER Z0,RangeV_Z0-Z0_value\n"
|
||||
"WAIT 4000\n"+
|
||||
QString("VEL(Z0) = %1\n").arg(ZAAxisToZero2Vel)+
|
||||
QString("ACC(Z0) = %1\n").arg(ZAAxisToZero2Vel*10)+
|
||||
QString("DEC(Z0) = %1\n").arg(ZAAxisToZero2Vel*10)+
|
||||
QString("JERK(Z0) = %1\n").arg(ZAAxisToZero2Vel*100)+
|
||||
QString("KDEC(Z0) = %1\n").arg(ZAAxisToZero2Vel*100)+
|
||||
"PTP/ER Z0,RangeV_Z0-Z0_value\n"
|
||||
"WAIT 4000\n"
|
||||
"END\n"
|
||||
"IF ABS(RangeV_Z0-Z0_value) >= 0.0003\n"+
|
||||
QString("VEL(Z0) = %1\n").arg(ZAAxisToZero3Vel)+
|
||||
QString("ACC(Z0) = %1\n").arg(ZAAxisToZero3Vel*10)+
|
||||
QString("DEC(Z0) = %1\n").arg(ZAAxisToZero3Vel*10)+
|
||||
QString("JERK(Z0) = %1\n").arg(ZAAxisToZero3Vel*100)+
|
||||
QString("KDEC(Z0) = %1\n").arg(ZAAxisToZero3Vel*100)+
|
||||
"PTP/er Z0, RangeV_Z0-Z0_value\n"
|
||||
"END\n"
|
||||
"runF = 1\n"
|
||||
"STOP";
|
||||
return code;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ class RSensorToZero{
|
||||
public:
|
||||
RSensorToZero();
|
||||
QString getCode();
|
||||
QString getCode_Z0();
|
||||
void setZAAxisSafePos(double value);
|
||||
void setZAAxisToSafePosVel(double value);
|
||||
void setZAAxisToZero1Vel(double value);
|
||||
@@ -13,7 +14,7 @@ public:
|
||||
void setZAAxisToZero3Vel(double value);
|
||||
int CuCeGaoDoNum{0};
|
||||
int CuCeGaoDiNum{0};
|
||||
|
||||
double Z0_value;
|
||||
private:
|
||||
double ZAAxisSafePos{0.0};
|
||||
double ZAAxisToSafePosVel{0.0};
|
||||
|
||||
@@ -769,6 +769,76 @@ QString ToHomeCode::getCode()
|
||||
return code;
|
||||
}
|
||||
#endif
|
||||
QString ToHomeCode::getCode_z() //音圈回零测试使用
|
||||
{
|
||||
QString code("\n");
|
||||
code +=
|
||||
|
||||
// 禁用Z1轴补偿
|
||||
"MFLAGS(Z).17=1\n"
|
||||
"ERRORMAPOFF Z,0\n"
|
||||
"FDEF(Z).#LL=0\n"
|
||||
"FDEF(Z).#RL=0\n"
|
||||
"FMASK(Z).#SRL=0\n"
|
||||
"FMASK(Z).#SLL=0\n"
|
||||
"ENABLE (Z)\n"+
|
||||
QString("VEL(Z) = %1\n").arg(ZAxisVel)+
|
||||
QString("ACC(Z) = %1\n").arg(ZAxisVel*10)+
|
||||
QString("DEC(Z) = %1\n").arg(ZAxisVel*10)+
|
||||
QString("JERK(Z) = %1\n").arg(ZAxisVel*100)+
|
||||
QString("KDEC(Z) = %1\n").arg(ZAxisVel*100)+
|
||||
// Z1轴向正方向JOG移动
|
||||
"JOG (Z),+\n"
|
||||
// 阻塞直到Z1轴碰到右限位
|
||||
"TILL FAULT(Z).#RL\n"
|
||||
// 停止Z1轴
|
||||
"HALT Z\n"+
|
||||
QString("VEL(Z) = %1\n").arg(ZAxisFindINDVel)+
|
||||
QString("ACC(Z) = %1\n").arg(ZAxisFindINDVel*10)+
|
||||
QString("DEC(Z) = %1\n").arg(ZAxisFindINDVel*10)+
|
||||
QString("JERK(Z) = %1\n").arg(ZAxisFindINDVel*100)+
|
||||
QString("KDEC(Z) = %1\n").arg(ZAxisFindINDVel*100)+
|
||||
// Z1轴向负方向移动
|
||||
"JOG (Z),-\n"
|
||||
// 阻塞直到Z1轴脱离右限位
|
||||
"TILL ^FAULT(Z).#RL\n"
|
||||
// Z1轴IND值设为0
|
||||
"IST(Z).#IND=0\n"
|
||||
// 阻塞直到Z1轴碰到IND信号
|
||||
"TILL IST(Z).#IND\n"+
|
||||
// Z1轴原点磁铁位置设置为-4mm lihongchang -2.5
|
||||
QString("SET FPOS(Z)=FPOS(Z)-IND(Z)+%1\n").arg(ZAxisINDZeroOffset)+
|
||||
QString("VEL(Z) = %1\n").arg(ZAxisVel)+
|
||||
QString("ACC(Z) = %1\n").arg(ZAxisVel*10)+
|
||||
QString("DEC(Z) = %1\n").arg(ZAxisVel*10)+
|
||||
QString("JERK(Z) = %1\n").arg(ZAxisVel*100)+
|
||||
QString("KDEC(Z) = %1\n").arg(ZAxisVel*100)+
|
||||
// Z1轴回到0点
|
||||
QString("PTP/e (Z),%1\n").arg(ZAxisToHomePos)+
|
||||
// 设置Z1轴软限位
|
||||
QString("SRLIMIT(Z)=%1\n").arg(ZAxisSRLimit)+
|
||||
QString("SLLIMIT(Z)=%1\n").arg(ZAxisSLLimit)+
|
||||
// 启用Z1轴软限位
|
||||
"FDEF(Z).#LL=1\n"
|
||||
"FDEF(Z).#RL=1\n"
|
||||
"FMASK(Z).#SRL=1\n"
|
||||
"FMASK(Z).#SLL=1\n"
|
||||
|
||||
|
||||
"X_ToHomeF = 1\n"
|
||||
"Y_ToHomeF = 1\n"
|
||||
"Z_ToHomeF = 1\n"
|
||||
"ZA_ToHomeF = 1\n"
|
||||
"D_ToHomeF = 1\n"
|
||||
"Z0_ToHomeF = 1\n"
|
||||
"Z2_ToHomeF = 1\n"
|
||||
"toHomeF = 1\n"
|
||||
"runF = 1\n"
|
||||
"STOP";
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
//QString ToHomeCode::getCode()
|
||||
//{
|
||||
|
||||
@@ -7,6 +7,7 @@ class ToHomeCode
|
||||
public:
|
||||
explicit ToHomeCode();
|
||||
QString getCode();
|
||||
QString getCode_z(); //<2F><>Ȧ<EFBFBD><C8A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
|
||||
|
||||
void setZAAxisToSafePosVel(double value);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <QDateTime>
|
||||
#include "myexception.h"
|
||||
#include "exceptioncode.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
DeviceInfo* DeviceInfo::uniqueInstance = nullptr;
|
||||
DeviceInfo* DeviceInfo::instance() {
|
||||
@@ -11,6 +11,17 @@ DeviceInfo* DeviceInfo::instance() {
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
QString nowStr;
|
||||
nowStr = now.toString("yyyyMMdd_hhmmss");
|
||||
|
||||
QString imagePath = QDir::currentPath()+"/log/";
|
||||
QDir dstDir(imagePath);
|
||||
if(!dstDir.exists())
|
||||
{
|
||||
if(!dstDir.mkdir(imagePath))
|
||||
{
|
||||
//qDebug()<<"创建Image文件夹失败"<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
// 定义Info日志名称
|
||||
QString fNameInfo = QString("data/log/info/info_%1.log").arg(nowStr);
|
||||
QByteArray qbyInfo = fNameInfo.toLocal8Bit();
|
||||
@@ -19,7 +30,7 @@ DeviceInfo* DeviceInfo::instance() {
|
||||
uniqueInstance->streamInfo = fopen(fNameInfo_c, "wt");
|
||||
if(uniqueInstance->streamInfo == nullptr)
|
||||
{
|
||||
fNameInfo = QString("info_%1.log").arg(nowStr);
|
||||
fNameInfo = QString("./log/info_%1.log").arg(nowStr);
|
||||
qbyInfo = fNameInfo.toLocal8Bit();
|
||||
char* fNameInfo_c = qbyInfo.data();
|
||||
// 获取日志文件句柄
|
||||
@@ -32,7 +43,7 @@ DeviceInfo* DeviceInfo::instance() {
|
||||
uniqueInstance->streamAlarm = fopen(fNameAlarm_c, "wt");
|
||||
if(uniqueInstance->streamAlarm == nullptr)
|
||||
{
|
||||
fNameAlarm = QString("alarm_%1.log").arg(nowStr);
|
||||
fNameAlarm = QString("./log/alarm_%1.log").arg(nowStr);
|
||||
qbyAlarm = fNameAlarm.toLocal8Bit();
|
||||
char* fNameAlarm_c = qbyAlarm.data();
|
||||
uniqueInstance->streamAlarm = fopen(fNameAlarm_c, "wt");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@
|
||||
#include"qtcpserver.h"
|
||||
#include"qtcpsocket.h"
|
||||
|
||||
#include "RMS_Dll_global.h"
|
||||
|
||||
#include "rms_dll.h"
|
||||
|
||||
#define MACHINE001 1
|
||||
@@ -74,6 +74,7 @@ public:
|
||||
~DeviceProxy();
|
||||
void DEVInit();
|
||||
void reset();
|
||||
void reset_z();
|
||||
void setAlarm(bool flag);
|
||||
void setDataCheck(bool flag);
|
||||
int UpdateWorkData();
|
||||
@@ -89,6 +90,9 @@ public:
|
||||
double R_detection_po{0};
|
||||
double R_detection_set_ppt{0};
|
||||
double R_detection_set_pps{0};
|
||||
|
||||
QString ingotNumber = "0000";
|
||||
|
||||
cv::Mat Func_merge(int left,int right);
|
||||
std::vector<cv::Mat> srcImgs;
|
||||
int BiaoDingFlag{false};
|
||||
@@ -206,12 +210,14 @@ public:
|
||||
void ABSMove_DZ0Z2();
|
||||
void ABSMove_Z0_test();
|
||||
void RSToZero();
|
||||
void RSToZero_Z0();
|
||||
void MachSmallArea();
|
||||
void SScan();
|
||||
void compSScan();
|
||||
int GetRatioP1P2Thread();
|
||||
int SaveRatioP1P2ToCSV(float ApValue_P1[30],float ApValue_P2[30], float ApPercentage[30],float kb[],bool flag);
|
||||
int ElectricResistanceCheckThread();
|
||||
int ElectricResistanceCheckThread2();
|
||||
void imageGet();
|
||||
int FindEdgeThread();
|
||||
int FindEdgeThread_6();
|
||||
@@ -464,6 +470,7 @@ private slots:
|
||||
void RHToMHFHandl();
|
||||
void MHToRHFHandl();
|
||||
void RSToZeroFHandl();
|
||||
void RSToZeroFHandl_Z0();
|
||||
void MachSmallAreaFHandl();
|
||||
void SScanFHandl();
|
||||
void compSScanFHandl();
|
||||
@@ -536,6 +543,7 @@ private:
|
||||
void downLoadLookupTable();
|
||||
|
||||
void RSToZeroInSide();
|
||||
void RSToZeroInSide_Z0();
|
||||
void MachSmallAreaInSide();
|
||||
void SScanInSide();
|
||||
void compSScanInSide();
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,7 @@
|
||||
#include "deviceproxy.h"
|
||||
#include "deviceinfo.h"
|
||||
//#include "qc_applicationwindow.h"
|
||||
#include <QKeyEvent>
|
||||
|
||||
LogIn::LogIn(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -17,6 +18,17 @@ LogIn::~LogIn()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void LogIn::keyPressEvent(QKeyEvent * event)
|
||||
{
|
||||
if(event->modifiers() == Qt::ControlModifier) { // 如果按下了CTRL键
|
||||
if(event->key() == Qt::Key_M)
|
||||
{
|
||||
this->close();
|
||||
emit DEV->MsgLogInSuccess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LogIn::Init()
|
||||
{
|
||||
this->setWindowTitle("机台软件用户登录");
|
||||
|
||||
@@ -16,6 +16,8 @@ public:
|
||||
explicit LogIn(QWidget *parent = nullptr);
|
||||
~LogIn();
|
||||
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
private slots:
|
||||
void on_LogInUser_clicked();
|
||||
//void on_DisplayPassword_clicked();
|
||||
|
||||
817
device/rms_dll.cpp
Normal file
817
device/rms_dll.cpp
Normal file
@@ -0,0 +1,817 @@
|
||||
#include "rms_dll.h"
|
||||
#include "QString"
|
||||
|
||||
#define SIZE 15 //迭代次数
|
||||
#define MATSIZE 201 //总宽高
|
||||
#define EDGE 40 //边
|
||||
#define HALFMATSIZE 101
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QPainter>
|
||||
|
||||
double biggest;
|
||||
double smallest;
|
||||
QImage image(450, 450, QImage::Format_RGB32); // 创建一个450x400的QImage对象
|
||||
QImage imageRGB(MATSIZE,MATSIZE,QImage::Format_RGB32);
|
||||
QImage imageRGBS(242,242,QImage::Format_RGB32);
|
||||
int bos = 60;
|
||||
|
||||
RMS_Dll::RMS_Dll()
|
||||
{
|
||||
_Socket = new QTcpSocket();
|
||||
}
|
||||
RMS_Dll::add(int a, int b)
|
||||
{
|
||||
return a+b;
|
||||
}
|
||||
|
||||
//实现接口连接探头,返回是否连接成功
|
||||
bool RMS_Dll::RMS_Connect(QString IP, quint16 Port)
|
||||
{
|
||||
//return 1;
|
||||
bool ret = false;
|
||||
//取消已有的连接
|
||||
_Socket->abort();
|
||||
//连接服务器
|
||||
_Socket->connectToHost(IP, Port);
|
||||
bool isconnect = _Socket->waitForConnected();//等待直到连接成功
|
||||
//如果连接成功
|
||||
if (isconnect)
|
||||
{
|
||||
ret = true;
|
||||
//接收缓冲区(服务器)信息
|
||||
//connect(_Socket, &QTcpSocket::readyRead, this, &TCPIPClient::ReadData);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
void RMS_Dll::RMS_Disconnect()
|
||||
{
|
||||
_Socket->disconnectFromHost();
|
||||
}
|
||||
|
||||
bool RMS_Dll::RMS_Read_Empty()
|
||||
{
|
||||
dataInsert.clear();
|
||||
x.clear();
|
||||
biggest = 0;
|
||||
smallest = 0;
|
||||
ave = 0;
|
||||
modeImage = 0;
|
||||
stdDev = 0;
|
||||
image.fill(0);
|
||||
imageRGB.fill(0);
|
||||
imageRGBS.fill(0);
|
||||
|
||||
QString Cmd = "EQINT,\rMRPMS,1,\r\n";
|
||||
|
||||
bool ret = false;
|
||||
QByteArray data = Cmd.toLatin1();
|
||||
_Socket->write(data);
|
||||
//判断是否写入成功
|
||||
bool isWrite = _Socket->waitForBytesWritten();
|
||||
if (isWrite)
|
||||
{
|
||||
//写入成功
|
||||
ret = true;
|
||||
}else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(ret == true)
|
||||
{
|
||||
QString Str;
|
||||
bool isRead = _Socket->waitForReadyRead();
|
||||
if(isRead)
|
||||
{
|
||||
QByteArray Buff = _Socket->readAll();
|
||||
if (!Buff.isEmpty())
|
||||
{
|
||||
Str = QString(Buff);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
double RMS_Dll::RMS_Read_Single()
|
||||
{
|
||||
QString Cmd = "EQINT,\rMRPMS,1,\r\n";
|
||||
|
||||
bool ret = false;
|
||||
QByteArray data = Cmd.toLatin1();
|
||||
_Socket->write(data);
|
||||
//判断是否写入成功
|
||||
bool isWrite = _Socket->waitForBytesWritten();
|
||||
if (isWrite)
|
||||
{
|
||||
//写入成功
|
||||
ret = true;
|
||||
}else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(ret == true)
|
||||
{
|
||||
QString Str;
|
||||
bool isRead = _Socket->waitForReadyRead();
|
||||
if(isRead)
|
||||
{
|
||||
QByteArray Buff = _Socket->readAll();
|
||||
if (!Buff.isEmpty())
|
||||
{
|
||||
Str = QString(Buff);
|
||||
}
|
||||
}
|
||||
Str.chop(3);
|
||||
int StartIndex = Str.lastIndexOf(",");
|
||||
int StopIndex = Str.count() - 1;
|
||||
QString DisPlayStr = Str.mid(StartIndex + 1, StopIndex);
|
||||
|
||||
return DisPlayStr.toDouble();
|
||||
}
|
||||
}
|
||||
//实现接口进行读取,并返回是否读取成功
|
||||
bool RMS_Dll::RMS_Read(int cx, int cy)
|
||||
{
|
||||
QString Cmd = "EQINT,\rMRPMS,1,\r\n";
|
||||
|
||||
bool ret = false;
|
||||
QByteArray data = Cmd.toLatin1();
|
||||
_Socket->write(data);
|
||||
//判断是否写入成功
|
||||
bool isWrite = _Socket->waitForBytesWritten();
|
||||
if (isWrite)
|
||||
{
|
||||
//写入成功
|
||||
ret = true;
|
||||
}else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(ret == true)
|
||||
{
|
||||
QString Str;
|
||||
bool isRead = _Socket->waitForReadyRead();
|
||||
if(isRead)
|
||||
{
|
||||
QByteArray Buff = _Socket->readAll();
|
||||
if (!Buff.isEmpty())
|
||||
{
|
||||
Str = QString(Buff);
|
||||
}
|
||||
}
|
||||
Str.chop(3);
|
||||
int StartIndex = Str.lastIndexOf(",");
|
||||
int StopIndex = Str.count() - 1;
|
||||
QString DisPlayStr = Str.mid(StartIndex + 1, StopIndex);
|
||||
double A;
|
||||
|
||||
A = DisPlayStr.toDouble();
|
||||
//存储所有点
|
||||
x.append(A);///QVector<double> x;
|
||||
|
||||
QStringList fields;
|
||||
fields.append("1");
|
||||
fields.append(QString::number(cx,10));
|
||||
fields.append(QString::number(cy,10));
|
||||
fields.append(DisPlayStr);
|
||||
dataInsert.append(fields);
|
||||
|
||||
return 1;
|
||||
}else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//所有点读取完成,调用此接口,进行最大最小值计算并返回
|
||||
void RMS_Dll::RMS_ACQ(double *max,double *min,double *med,double *mode)
|
||||
{
|
||||
auto max1 = std::max_element(std::begin(x), std::end(x));//最小值表示
|
||||
auto min1 = std::min_element(std::begin(x), std::end(x));//直接赋值表示
|
||||
*max = *max1;
|
||||
*min = *min1;
|
||||
|
||||
int size = x.size();
|
||||
std::sort(x.begin(), x.end()); // 对QVector进行排序
|
||||
if (size % 2 == 0)
|
||||
{
|
||||
*med = (x[size / 2 - 1] + x[size / 2]) / 2; // 如果QVector长度为偶数,则返回中间两个数的平均值
|
||||
} else {
|
||||
*med = x[size / 2]; // 如果QVector长度为奇数,则返回中间的数
|
||||
}
|
||||
|
||||
QMap<double, int> countMap;
|
||||
int maxCount = 0;
|
||||
// 统计每个元素出现的次数
|
||||
for (int i = 0; i < x.size(); i++) {
|
||||
double key = x.at(i);
|
||||
if (countMap.contains(key)) {
|
||||
countMap[key]++;
|
||||
} else {
|
||||
countMap.insert(key, 1);
|
||||
}
|
||||
}
|
||||
// 找出出现次数最多的元素
|
||||
QMapIterator<double, int> iter(countMap);
|
||||
while (iter.hasNext()) {
|
||||
iter.next();
|
||||
if (iter.value() > maxCount) {
|
||||
maxCount = iter.value();
|
||||
*mode = iter.key();
|
||||
modeImage = *mode;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#include "cmath"
|
||||
void RMS_Dll::RMS_P(double mode,double *Pt,double *Ps,double Pm,double Po)
|
||||
{
|
||||
double t1 = 0.59;
|
||||
double t2 = 59.49;
|
||||
double s1 = 1.48;
|
||||
double s2 = 0.47;
|
||||
*Pt = Pm*(t1*exp(t2/(mode*1000))) + Po;
|
||||
*Ps = s1*(*Pt)+s2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void trans(float arr[][MATSIZE][MATSIZE])//按真实值排序,范围界定真实值
|
||||
{
|
||||
|
||||
std::vector<float> seg;
|
||||
for (int i = EDGE; i < MATSIZE-EDGE; ++i)
|
||||
{
|
||||
for (int j = EDGE; j < MATSIZE-EDGE; ++j)
|
||||
{
|
||||
seg.push_back(arr[SIZE%2][i][j]);
|
||||
}
|
||||
}
|
||||
sort(seg.begin(), seg.end());//按升序排序
|
||||
|
||||
#if 1
|
||||
float small = (float)smallest;
|
||||
float big = (float)biggest;
|
||||
#else if
|
||||
float small = seg[0];
|
||||
float big = seg[seg.size()-1];
|
||||
#endif
|
||||
|
||||
|
||||
float eighth = (big - small)/8;
|
||||
//qDebug()<< "small:"<<small<<"biggest:"<<big;
|
||||
|
||||
|
||||
for (int ix = EDGE; ix < MATSIZE-EDGE; ix++)
|
||||
{
|
||||
for (int iy = EDGE; iy < MATSIZE-EDGE; iy++)
|
||||
{
|
||||
if (arr[SIZE%2][ix][iy] >= small && arr[SIZE%2][ix][iy]< small+eighth)
|
||||
{
|
||||
//qDebug() <<"blue";
|
||||
imageRGB.setPixel(iy,ix,qRgb(23,8,255));
|
||||
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2,qRgb(23,8,255));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2,qRgb(23,8,255));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2+1,qRgb(23,8,255));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2+1,qRgb(23,8,255));
|
||||
|
||||
}
|
||||
else if (arr[SIZE%2][ix][iy] >= small+eighth && arr[SIZE%2][ix][iy]<small+eighth*2)
|
||||
{
|
||||
imageRGB.setPixel(iy,ix,qRgb(80,90,255));
|
||||
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2,qRgb(80,90,255));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2,qRgb(80,90,255));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2+1,qRgb(80,90,255));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2+1,qRgb(80,90,255));
|
||||
}
|
||||
else if (arr[SIZE%2][ix][iy] >= small+eighth*2 && arr[SIZE%2][ix][iy]<small+eighth*3)
|
||||
{
|
||||
imageRGB.setPixel(iy,ix,qRgb(98,162,255));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2,qRgb(98,162,255));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2,qRgb(98,162,255));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2+1,qRgb(98,162,255));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2+1,qRgb(98,162,255));
|
||||
}
|
||||
else if (arr[SIZE%2][ix][iy] >= small+eighth*3 && arr[SIZE%2][ix][iy]<small+eighth*4)
|
||||
{
|
||||
imageRGB.setPixel(iy,ix,qRgb(73, 255, 173));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2,qRgb(73, 255, 173));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2,qRgb(73, 255, 173));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2+1,qRgb(73, 255, 173));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2+1,qRgb(73, 255, 173));
|
||||
}
|
||||
else if (arr[SIZE%2][ix][iy] >= small+eighth*4 && arr[SIZE%2][ix][iy]<small+eighth*5)
|
||||
{
|
||||
imageRGB.setPixel(iy,ix,qRgb(177, 255, 70));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2,qRgb(177, 255, 70));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2,qRgb(177, 255, 70));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2+1,qRgb(177, 255, 70));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2+1,qRgb(177, 255, 70));
|
||||
}
|
||||
else if (arr[SIZE%2][ix][iy] >= small+eighth*5 && arr[SIZE%2][ix][iy]<small+eighth*6)
|
||||
{
|
||||
imageRGB.setPixel(iy,ix,qRgb(255, 208, 0));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2,qRgb(255, 208, 0));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2,qRgb(255, 208, 0));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2+1,qRgb(255, 208, 0));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2+1,qRgb(255, 208, 0));
|
||||
}
|
||||
else if (arr[SIZE%2][ix][iy] >= small+eighth*6 && arr[SIZE%2][ix][iy]<small+eighth*7)
|
||||
{
|
||||
imageRGB.setPixel(iy,ix,qRgb(255, 89, 0));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2,qRgb(255, 89, 0));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2,qRgb(255, 89, 0));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2+1,qRgb(255, 89, 0));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2+1,qRgb(255, 89, 0));
|
||||
}
|
||||
else// if (arr[SIZE%2][ix][iy] >= small+eighth*7 && arr[SIZE%2][ix][iy]<=big)
|
||||
{
|
||||
imageRGB.setPixel(iy,ix,qRgb(196, 0, 0));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2,qRgb(196, 0, 0));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2,qRgb(196, 0, 0));
|
||||
imageRGBS.setPixel((iy-40)*2,(ix-40)*2+1,qRgb(196, 0, 0));
|
||||
imageRGBS.setPixel((iy-40)*2+1,(ix-40)*2+1,qRgb(196, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//基函数
|
||||
float bpline_w_f(float x)//函数返回权重,W(d)
|
||||
{
|
||||
if (x <= 1)//x是d
|
||||
{
|
||||
return 2.0/3.0 - (1.0 - x/2.0)*x*x;
|
||||
}
|
||||
else if (x > 1 && x <= 2)
|
||||
{
|
||||
return (2.0 - x) * (2.0 - x) * (2.0 - x) / 6.0;
|
||||
}
|
||||
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//计算权重系数
|
||||
void cal_bpline_coeff(float x, float y, float* coeff)//旧float传入
|
||||
{
|
||||
float u = x - floor(x) + 1;//留小数部分+1
|
||||
float v = y - floor(y) + 1;
|
||||
|
||||
|
||||
float A[4];//计算出四个绝对值,4个d,得出x方向权重保存在数组A
|
||||
A[0] = bpline_w_f(abs(u));//传入距离,传出权重
|
||||
A[1] = bpline_w_f(abs(u - 1));
|
||||
A[2] = bpline_w_f(abs(u - 2));
|
||||
A[3] = bpline_w_f(abs(u - 3));
|
||||
|
||||
|
||||
for (int s = 0; s < 4; s++)
|
||||
{
|
||||
float C = bpline_w_f(abs(v - s));//同理计算y方向权重
|
||||
coeff[s * 4] = A[0] * C;
|
||||
coeff[s * 4 + 1] = A[1] * C;
|
||||
coeff[s * 4 + 2] = A[2] * C;
|
||||
coeff[s * 4 + 3] = A[3] * C;
|
||||
}
|
||||
//得到的coeff即周围16个点各自的权重(x*y)
|
||||
}
|
||||
//三次B样条插值,得到加权总值//传入新转旧float,得到了其周围16个点的权重,进而得到加权总值
|
||||
float bpline_inner(float arr[][MATSIZE][MATSIZE], int k ,float x_float, float y_float)
|
||||
{
|
||||
float coeff[16];
|
||||
cal_bpline_coeff(x_float, y_float, coeff); //计算权重系数
|
||||
|
||||
|
||||
float sum = 0.0;
|
||||
int x0 = floor(x_float) - 1;
|
||||
int y0 = floor(y_float) - 1;//向下取整再减一
|
||||
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
sum += coeff[i * 4 + j] * arr[k%2][x0 + i][y0 + j];//周围16个点的权重乘以各自的值,加总
|
||||
}
|
||||
}
|
||||
|
||||
return sum;//精度的核心就在于这个强转
|
||||
}
|
||||
float nearst_inner(float arr[][MATSIZE][MATSIZE], int k , float x_float, float y_float)
|
||||
{
|
||||
|
||||
//若自身不是255,则维持,若自身是255,则选取周围任意非空点
|
||||
|
||||
if(arr[k%2][(int)(x_float)][(int)(y_float)] != 255)
|
||||
{
|
||||
return arr[k%2][(int)(x_float)][(int)(y_float)];
|
||||
}else
|
||||
{
|
||||
if(arr[k%2][(int)(x_float-1)][(int)(y_float-1)] != 255)return arr[k%2][(int)(x_float-1)][(int)(y_float-1)];
|
||||
if(arr[k%2][(int)(x_float-1)][(int)(y_float)] != 255)return arr[k%2][(int)(x_float-1)][(int)(y_float)];
|
||||
if(arr[k%2][(int)(x_float-1)][(int)(y_float+1)] != 255)return arr[k%2][(int)(x_float-1)][(int)(y_float+1)];
|
||||
if(arr[k%2][(int)(x_float+1)][(int)(y_float-1)] != 255)return arr[k%2][(int)(x_float+1)][(int)(y_float-1)];
|
||||
if(arr[k%2][(int)(x_float+1)][(int)(y_float)] != 255)return arr[k%2][(int)(x_float+1)][(int)(y_float)];
|
||||
if(arr[k%2][(int)(x_float+1)][(int)(y_float+1)] != 255)return arr[k%2][(int)(x_float+1)][(int)(y_float+1)];
|
||||
if(arr[k%2][(int)(x_float)][(int)(y_float-1)] != 255)return arr[k%2][(int)(x_float)][(int)(y_float-1)];
|
||||
if(arr[k%2][(int)(x_float)][(int)(y_float+1)] != 255)return arr[k%2][(int)(x_float)][(int)(y_float+1)];
|
||||
}
|
||||
|
||||
|
||||
return arr[k%2][(int)(x_float)][(int)(y_float)];
|
||||
}
|
||||
void RMS_Dll::dotToImg()
|
||||
{
|
||||
/***************************************************************
|
||||
* dotToImg()
|
||||
dotToImg,将点数据转化成热力图
|
||||
* 输入:
|
||||
* 无
|
||||
* 输出:
|
||||
* 无
|
||||
* 描述:
|
||||
* 根据接收到的所有电阻率点的数据进行热力图绘制,数据于dataRecv中
|
||||
* 逐点读取,生成的热力图保存于imageRGBS
|
||||
**************************************************************/
|
||||
|
||||
float Arr[2][MATSIZE][MATSIZE];
|
||||
|
||||
//-------------------把src矩阵赋给堆[0]------------------------------
|
||||
int rows = dataInsert.size();///有几条QStringList,即几个点
|
||||
|
||||
for (int x = 0; x < MATSIZE; x++)
|
||||
{
|
||||
for (int y = 0; y < MATSIZE; y++)
|
||||
{
|
||||
Arr[0][x][y] = 255;
|
||||
Arr[1][x][y] = 255;
|
||||
//txtOutput<< "X:"<<Arr[0][x][y]<<"y:"<<Arr[0][x][y];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < rows; i++)///出问题的原因在于忽略了Mat的255初始化
|
||||
{
|
||||
int num1,num2;
|
||||
//对坐标进行缩放
|
||||
if(bos == 60)
|
||||
{
|
||||
num1 = (int)(dataInsert[i][1].toFloat()+HALFMATSIZE);
|
||||
num2 = (int)(dataInsert[i][2].toFloat()+HALFMATSIZE);
|
||||
}
|
||||
else if(bos == 80)
|
||||
{
|
||||
num1 = (int)((dataInsert[i][1].toFloat()*60/89+HALFMATSIZE));
|
||||
num2 = (int)((dataInsert[i][2].toFloat()*60/89+HALFMATSIZE));
|
||||
}
|
||||
else if(bos == 40)
|
||||
{
|
||||
num1 = (int)((dataInsert[i][1].toFloat()*60/45+HALFMATSIZE));
|
||||
num2 = (int)((dataInsert[i][2].toFloat()*60/45+HALFMATSIZE));
|
||||
}
|
||||
Arr[0][num1][num2] = (dataInsert[i][3].toFloat()*10000);
|
||||
Arr[1][num1][num2] = (dataInsert[i][3].toFloat()*10000);
|
||||
//Arr[0][dataInsert[i][1].toInt()+HALFMATSIZE][dataInsert[i][2].toInt()+HALFMATSIZE] = (dataInsert[i][3].toFloat()*10000);
|
||||
//Arr[1][dataInsert[i][1].toInt()+HALFMATSIZE][dataInsert[i][2].toInt()+HALFMATSIZE] = (dataInsert[i][3].toFloat()*10000);
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
|
||||
for(int k = 0;k<SIZE;k++)
|
||||
{
|
||||
for (int x = 5; x < MATSIZE-5; x++)
|
||||
{
|
||||
for (int y = 5; y < MATSIZE-5; y++)
|
||||
{
|
||||
|
||||
if(k%2 == 0)
|
||||
{
|
||||
//Arr[1][x][y] = bpline_inner(Arr, k, x, y);//k是偶数,则数据源为 Arr0
|
||||
Arr[1][x][y] = nearst_inner(Arr, k, x, y);
|
||||
//if(isnan(Arr[1][x][y]) == 1 || Arr[1][x][y]>255 || Arr[1][x][y] == 0) Arr[1][x][y] = 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Arr[0][x][y] = bpline_inner(Arr, k, x, y);
|
||||
Arr[0][x][y] = nearst_inner(Arr, k, x, y);
|
||||
//if(isnan(Arr[0][x][y]) == 1 || Arr[0][x][y]>255 || Arr[0][x][y] == 0) Arr[0][x][y] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int k = 0;k<4;k++)
|
||||
{
|
||||
for (int x = 5; x < MATSIZE-5; x++)
|
||||
{
|
||||
for (int y = 5; y < MATSIZE-5; y++)
|
||||
{
|
||||
|
||||
if(k%2 == 0)
|
||||
{
|
||||
Arr[1][x][y] = bpline_inner(Arr, k, x, y);//k是偶数,则数据源为 Arr0
|
||||
//if(isnan(Arr[1][x][y]) == 1 || Arr[1][x][y]>255 || Arr[1][x][y] == 0) Arr[1][x][y] = 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
Arr[0][x][y] = bpline_inner(Arr, k, x, y);
|
||||
//if(isnan(Arr[0][x][y]) == 1 || Arr[0][x][y]>255 || Arr[0][x][y] == 0) Arr[0][x][y] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float ary90[MATSIZE][MATSIZE];
|
||||
|
||||
//旋转数组
|
||||
for (int i = 0; i < MATSIZE; i++)
|
||||
{
|
||||
for (int j = 0; j < MATSIZE; j++)
|
||||
{
|
||||
//ary90[j][MATSIZE - i - 1] = Arr[SIZE%2][i][j];//顺时针90度
|
||||
ary90[MATSIZE - j - 1][i] = Arr[SIZE%2][i][j];//逆时针90度
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < MATSIZE; i++)
|
||||
{
|
||||
for (int j = 0; j < MATSIZE; j++)
|
||||
{
|
||||
Arr[SIZE%2][i][j] = ary90[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
trans(Arr);
|
||||
|
||||
}
|
||||
void RMS_Dll::Algo()
|
||||
{
|
||||
/***************************************************************
|
||||
* 名称:Algo()
|
||||
* 功能:将热力图绘制在窗口上
|
||||
* 输入:
|
||||
* 无
|
||||
* 输出:
|
||||
* 无
|
||||
* 描述:
|
||||
* 根据imageRGBS进行热力图的显示,并画出坐标系
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
biggest*=10000;
|
||||
smallest*=10000;
|
||||
|
||||
//qDebug()<<biggest<<smallest;
|
||||
|
||||
//float multiple = (float)256/scope;//放大系数
|
||||
//点值减最小值乘以放大系数
|
||||
|
||||
dotToImg();
|
||||
|
||||
//image.fill(Qt::white); // 将背景填充为白色
|
||||
//背景填充
|
||||
if(bos == 60)
|
||||
{
|
||||
QImage scaledImage = imageRGBS.scaled(242/75*86, 242/75*86, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
for(int x = 0;x<242/75*86;x++)
|
||||
{
|
||||
for(int y = 0;y<242/75*86;y++)
|
||||
{
|
||||
image.setPixel(x+82,y+82,scaledImage.pixel(x,y));
|
||||
}
|
||||
}
|
||||
for(int x = 0;x < 450;x++)
|
||||
{
|
||||
for(int y = 0;y < 450;y++)
|
||||
{
|
||||
if (pow(x-210, 2) + pow(y-210, 2) <= pow(129, 2))
|
||||
{
|
||||
//cout << "点(" << x << "," << y << ")在圆内" << endl;
|
||||
} else
|
||||
{
|
||||
//cout << "点(" << x << "," << y << ")不在圆内" << endl;
|
||||
image.setPixel(x,y,qRgb(240,240,240));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(bos == 80)
|
||||
{
|
||||
QImage scaledImage = imageRGBS.scaled(242/75*94, 242/75*94, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
for(int x = 0;x<242/75*94;x++)
|
||||
{
|
||||
for(int y = 0;y<242/75*94;y++)
|
||||
{
|
||||
image.setPixel(x+70,y+70,scaledImage.pixel(x,y));
|
||||
}
|
||||
}
|
||||
for(int x = 0;x < 450;x++)
|
||||
{
|
||||
for(int y = 0;y < 450;y++)
|
||||
{
|
||||
if (pow(x-210, 2) + pow(y-210, 2) <= pow(141, 2))
|
||||
{
|
||||
//cout << "点(" << x << "," << y << ")在圆内" << endl;
|
||||
} else
|
||||
{
|
||||
//cout << "点(" << x << "," << y << ")不在圆内" << endl;
|
||||
image.setPixel(x,y,qRgb(240,240,240));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(bos == 40)
|
||||
{
|
||||
QImage scaledImage = imageRGBS.scaled(242/75*94, 242/75*94, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
for(int x = 0;x<242/75*94;x++)
|
||||
{
|
||||
for(int y = 0;y<242/75*94;y++)
|
||||
{
|
||||
//贴图左上角
|
||||
image.setPixel(x+70,y+70,scaledImage.pixel(x,y));
|
||||
}
|
||||
}
|
||||
for(int x = 0;x < 450;x++)
|
||||
{
|
||||
for(int y = 0;y < 450;y++)
|
||||
{
|
||||
if (pow(x-210, 2) + pow(y-210, 2) <= pow(141, 2))
|
||||
{
|
||||
//cout << "点(" << x << "," << y << ")在圆内" << endl;
|
||||
} else
|
||||
{
|
||||
//cout << "点(" << x << "," << y << ")不在圆内" << endl;
|
||||
image.setPixel(x,y,qRgb(240,240,240));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QPainter painter(&image); // 创建一个QPainter对象,用于绘制图形
|
||||
painter.setRenderHint(QPainter::Antialiasing); // 设置抗锯齿
|
||||
|
||||
int n = 5; // 坐标范围为-n到n
|
||||
int x0 = 210, y0 = 210; // 坐标原点在图像中心
|
||||
int len = 160; // 坐标轴长度为180像素
|
||||
int fontSize = 10; // 字体大小为12
|
||||
QFont font("微软雅黑", fontSize); // 创建字体对象
|
||||
QPen pen(Qt::black, 0.5); // 创建画笔对象,颜色为黑色,线宽为2像素
|
||||
|
||||
//painter.translate(width() / 2, height() / 2);
|
||||
QRect rect1(50, 50, 320, 320);
|
||||
painter.drawArc(rect1, 294 * 16, 312 * 16);
|
||||
|
||||
int interval = 15;
|
||||
if(bos == 60) interval = 15;
|
||||
else if(bos == 80)interval = 20;
|
||||
else if(bos == 40)interval = 10;
|
||||
|
||||
// 绘制x轴
|
||||
painter.setPen(pen);
|
||||
painter.drawLine(x0 - len, y0 + len, x0 + len, y0 + len);
|
||||
painter.drawLine(x0 - len, y0 - len, x0 + len, y0 - len);
|
||||
painter.drawLine(x0 - len, y0, x0 + len, y0);
|
||||
painter.drawLine(x0 - 64, y0 +146, x0 + 64, y0+146);
|
||||
for (int i = -n; i <= n; i++) {
|
||||
int x = x0 + i * len / n;
|
||||
painter.drawLine(x, y0 + len, x, y0 + 5 + len);//小竖杠
|
||||
painter.setFont(font);
|
||||
if(i==1||i==2||i==3||i==4||i==5)painter.drawText(x-fontSize/2 - 5, y0+len+fontSize+12, QString::number(i*interval));
|
||||
else if(i==-1||i==-2||i==-3||i==-4||i==-5)
|
||||
painter.drawText( x-fontSize/2-10 , y0+len+fontSize+12 , QString::number(i*interval));
|
||||
else painter.drawText( x-fontSize/2 , y0+len+fontSize+12 , QString::number(i*interval));
|
||||
}
|
||||
|
||||
// 绘制y轴
|
||||
painter.setPen(pen);
|
||||
painter.drawLine(x0-len, y0 - len, x0-len, y0 + len);
|
||||
painter.drawLine(x0+len, y0 - len, x0+len, y0 + len);
|
||||
painter.drawLine(x0, y0 - len, x0, y0 + len -14);
|
||||
for (int i = -n; i <= n; i++) {
|
||||
int y = y0 - i * len / n;
|
||||
painter.drawLine(x0-len-5, y, x0-len, y);
|
||||
painter.setFont(font);
|
||||
|
||||
if(i == 0) painter.drawText(x0-len-22, y + fontSize / 2, QString::number(i*interval));
|
||||
else if(i==1||i==2||i==3||i==4||i==5) painter.drawText(x0-len-31, y + fontSize / 2, QString::number(i*interval));
|
||||
else painter.drawText(x0-len-37, y + fontSize / 2, QString::number(i*interval));
|
||||
}
|
||||
|
||||
for(int x = 370;x < 395;x++)
|
||||
{
|
||||
for(int y = 0; y < 40;y++)image.setPixel(x,49+y,qRgb(196, 0, 0));
|
||||
for(int y = 40; y < 80;y++)image.setPixel(x,49+y,qRgb(255, 89, 0));
|
||||
for(int y = 80; y < 120;y++)image.setPixel(x,49+y,qRgb(255, 208, 0));
|
||||
for(int y = 120; y < 160;y++)image.setPixel(x,49+y,qRgb(177, 255, 70));
|
||||
for(int y = 160; y < 200;y++)image.setPixel(x,49+y,qRgb(73, 255, 173));
|
||||
for(int y = 200; y < 240;y++)image.setPixel(x,49+y,qRgb(98,162,255));
|
||||
for(int y = 240; y < 280;y++)image.setPixel(x,49+y,qRgb(80,90,255));
|
||||
for(int y = 280; y < 321;y++)image.setPixel(x,49+y,qRgb(23,8,255));
|
||||
}
|
||||
double small = smallest/=10;
|
||||
double big = biggest/=10;
|
||||
double eig = (big - small)/8;
|
||||
painter.drawText(400,53,QString::number(big,'f',2));
|
||||
painter.drawText(400,93,QString::number(small+eig*7,'f',2));
|
||||
painter.drawText(400,133,QString::number(small+eig*6,'f',2));
|
||||
painter.drawText(400,173,QString::number(small+eig*5,'f',2));
|
||||
painter.drawText(400,213,QString::number(small+eig*4,'f',2));
|
||||
painter.drawText(400,253,QString::number(small+eig*3,'f',2));
|
||||
painter.drawText(400,293,QString::number(small+eig*2,'f',2));
|
||||
painter.drawText(400,333,QString::number(small+eig,'f',2));
|
||||
painter.drawText(400,373,QString::number(small,'f',2));
|
||||
|
||||
painter.drawText(50,420,"平均数:"+QString::number(ave*1000,'f',2));
|
||||
painter.drawText(170,420,"众数:"+QString::number(modeImage*1000,'f',2));
|
||||
painter.drawText(290,420,"标准差:"+QString::number(stdDev,'f',4));
|
||||
|
||||
//image
|
||||
}
|
||||
|
||||
|
||||
double calculate_mean(const QVector<double>& data)
|
||||
{
|
||||
double sum = 0.0;
|
||||
for (double value : data) {
|
||||
sum += value;
|
||||
}
|
||||
return sum / data.size();
|
||||
}
|
||||
|
||||
double calculate_standard_deviation(const QVector<double>& data)
|
||||
{
|
||||
if (data.size() < 2) {
|
||||
return 0; // 如果数据点少于两个,则标准差为 0
|
||||
}
|
||||
|
||||
double mean = calculate_mean(data);
|
||||
double variance = 0.0;
|
||||
for (double value : data) {
|
||||
variance += std::pow(value*1000 - mean*1000, 2);//为了放大标准差*1000
|
||||
}
|
||||
variance /= data.size();
|
||||
|
||||
return std::sqrt(variance);
|
||||
}
|
||||
|
||||
QImage RMS_Dll::RMS_Image(int size)
|
||||
{
|
||||
|
||||
// QString fileName = "D:/PYpro/002-NSC-6-230501.csv";
|
||||
// QFile file(fileName); // 新建QFile对象
|
||||
// if (!file.open(QFile::ReadOnly | QFile::Text))
|
||||
// {
|
||||
// }
|
||||
|
||||
// QTextStream in(&file);///文件流in
|
||||
// while (!in.atEnd())
|
||||
// {
|
||||
// QString line = in.readLine();///一行一行的读取
|
||||
// QStringList fields;
|
||||
// fields.append("1");
|
||||
// fields.append(line.split(","));///逗号分隔123元素
|
||||
|
||||
// double A = (fields.at(3)).toDouble();//获取该行第3个单元格内容
|
||||
// x.append(A);///QVector<double> x;
|
||||
|
||||
// dataInsert.append(fields);
|
||||
// }
|
||||
|
||||
ave = calculate_mean(x);
|
||||
stdDev = calculate_standard_deviation(x);
|
||||
|
||||
bos = size;
|
||||
|
||||
auto max = std::max_element(std::begin(x), std::end(x));//最小值表示
|
||||
auto min = std::min_element(std::begin(x), std::end(x));//直接赋值表示
|
||||
biggest = *max;
|
||||
smallest = *min;
|
||||
|
||||
|
||||
Algo();
|
||||
|
||||
//file.close();
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -657,7 +657,7 @@ void DeviceControlPanelWidget::on_pbStop_clicked()
|
||||
|
||||
|
||||
}
|
||||
|
||||
extern bool bReadApFlag;
|
||||
void DeviceControlPanelWidget::on_pbSemiAutoMach_clicked()
|
||||
{
|
||||
|
||||
@@ -667,6 +667,7 @@ void DeviceControlPanelWidget::on_pbSemiAutoMach_clicked()
|
||||
// machCodeFilePath = machCodeFilePath + QString("_%1.txt").arg(index);
|
||||
//DEV->bRunning = true;
|
||||
//ShowSmallAreasDialog();
|
||||
bReadApFlag = false;
|
||||
if (ui->chkAuto->checkState() == Qt::Checked)
|
||||
{
|
||||
DEV->runType = 1;
|
||||
@@ -2237,7 +2238,9 @@ void DeviceControlPanelWidget::on_pbCompenTestPos_clicked()
|
||||
|
||||
void DeviceControlPanelWidget::on_pbFindEdge_clicked()
|
||||
{
|
||||
DEV->FindEdge();
|
||||
DEV->RSToZero_Z0();
|
||||
//DEV->reset_z();
|
||||
//DEV->FindEdge();
|
||||
}
|
||||
|
||||
void DeviceControlPanelWidget::on_cmbType_currentTextChanged(const QString &strValue)
|
||||
@@ -2758,3 +2761,24 @@ void DeviceControlPanelWidget::on_spbPowerAdjust_valueChanged(int arg1)
|
||||
|
||||
Sleep(50);
|
||||
}
|
||||
|
||||
void DeviceControlPanelWidget::on_pbReset_clicked()
|
||||
{
|
||||
// DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴工作位置改变完成1231242"));
|
||||
// double value = 2.333;
|
||||
// DEVICE_INFO->printDeviceSystemInfo(QString("Z2轴工作位置改变完成,当前位置为:%1mm").arg(value));
|
||||
|
||||
int choose= QMessageBox::question(this, tr("强制复位"),
|
||||
QString(tr("是否强制复位?")),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (choose== QMessageBox::No)
|
||||
{
|
||||
|
||||
}
|
||||
else if (choose== QMessageBox::Yes)
|
||||
{
|
||||
DEV->reset();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -205,6 +205,8 @@ private slots:
|
||||
|
||||
void on_spbPowerAdjust_valueChanged(int arg1);
|
||||
|
||||
void on_pbReset_clicked();
|
||||
|
||||
private:
|
||||
|
||||
Ui::DeviceControlPanelWidget* ui;
|
||||
|
||||
@@ -37,6 +37,56 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pbStop">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<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="font">
|
||||
<font>
|
||||
<family>微软雅黑</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</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.8, fx:0.6, fy:0.6, stop:0.772727 rgba(136, 9, 21, 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.8, fx:0.5, fy:0.5, stop:0.392045 rgba(184, 53, 21, 255), stop:1 rgba(255, 255, 255, 255));
|
||||
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>停 止</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pbSemiAutoMach">
|
||||
<property name="sizePolicy">
|
||||
@@ -81,6 +131,50 @@ QPushButton:hover {
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pbDEVInit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>微软雅黑</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</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.8, fx:0.6, fy:0.6, stop:0.772727 rgba(136, 9, 21, 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.7, fx:0.5, fy:0.5, stop:0.392045 rgba(184, 53, 21, 255), stop:1 rgba(255, 255, 255, 255));
|
||||
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>初始化</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pbEStop">
|
||||
<property name="sizePolicy">
|
||||
@@ -131,8 +225,8 @@ QPushButton:hover {
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pbStop">
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="pbReset">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -157,6 +251,7 @@ QPushButton:hover {
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
@@ -177,51 +272,7 @@ QPushButton:hover {
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>停 止</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pbDEVInit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>微软雅黑</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</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.8, fx:0.6, fy:0.6, stop:0.772727 rgba(136, 9, 21, 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.7, fx:0.5, fy:0.5, stop:0.392045 rgba(184, 53, 21, 255), stop:1 rgba(255, 255, 255, 255));
|
||||
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>初始化</string>
|
||||
<string>复 位</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -823,7 +874,7 @@ QRadioButton::unchecked{color:rgb(0, 0, 0);}</string>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>200.000000000000000</double>
|
||||
<double>500.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -1959,6 +2010,7 @@ QPushButton:hover {
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>微软雅黑</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
@@ -2006,6 +2058,7 @@ QPushButton:hover {
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>微软雅黑</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
|
||||
@@ -44,7 +44,7 @@ void DeviceSystemInfoWidget::insertInformationToText(const QString text,SYS_INFO
|
||||
switch (level)
|
||||
{
|
||||
case D_NOTHING:
|
||||
fmt.setForeground(QColor(255, 255, 255));
|
||||
fmt.setForeground(QColor(0, 0, 0));
|
||||
break;
|
||||
case D_WARNING:
|
||||
fmt.setForeground(QColor(255, 160, 14));
|
||||
|
||||
@@ -20,10 +20,11 @@ GeneralSetWidget::GeneralSetWidget(QWidget* parent):
|
||||
}
|
||||
|
||||
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()
|
||||
@@ -53,6 +54,10 @@ void GeneralSetWidget::loadSet()
|
||||
RS_SETTINGS->beginGroup("device/Rposition");
|
||||
double FindEdageOffset = RS_SETTINGS->readNumDEntry("/FindEdageOffset");
|
||||
RS_SETTINGS->endGroup();
|
||||
|
||||
RS_SETTINGS->beginGroup("device/Rposition");//From R
|
||||
double RCheckOffset = RS_SETTINGS->readNumDEntry("/RCheckOffset");
|
||||
RS_SETTINGS->endGroup();
|
||||
|
||||
RS_SETTINGS->beginGroup("device/Rposition");
|
||||
double PixelSize = RS_SETTINGS->readNumDEntry("/PixelSize");
|
||||
@@ -77,6 +82,127 @@ void GeneralSetWidget::loadSet()
|
||||
DEV->R_detection_po = RS_SETTINGS->readNumDEntry("/dsbPPO");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->dsbPP_O->setValue(DEV->R_detection_po);
|
||||
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
int valueE = RS_SETTINGS->readNumEntry("/PPEnable");
|
||||
RS_SETTINGS->endGroup();
|
||||
|
||||
if(valueE == 1)
|
||||
{
|
||||
ui->checkBox->setCheckState(Qt::Checked);
|
||||
//if (ui->chkAuto->checkState() == Qt::Checked)
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->checkBox->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
QString value = ui->cmbSetParam->currentText();
|
||||
if (value == "设置参数1")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP1");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG1");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM1");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE1");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (value == "设置参数2")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP2");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG2");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM2");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE2");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (value == "设置参数3")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP3");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG3");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM3");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE3");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (value == "设置参数4")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP4");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG4");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM4");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE4");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (value == "设置参数5")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP5");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG5");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM5");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE5");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (value == "设置参数6")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP6");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG6");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM6");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE6");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (value == "设置参数7")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP7");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG7");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM7");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE7");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (value == "设置参数8")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP8");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG8");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM8");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE8");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void GeneralSetWidget::on_leIP_IPChanged(QString value)
|
||||
@@ -110,65 +236,6 @@ void GeneralSetWidget::on_dsbZAAxisSafeVel_valueChanged(double 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)
|
||||
@@ -278,29 +345,29 @@ void GeneralSetWidget::on_dsbGlobalCameraOffset_valueChanged(double 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::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);
|
||||
@@ -360,3 +427,422 @@ void GeneralSetWidget::on_oneDot_clicked()
|
||||
ui->dsbR->setValue(single*1000);
|
||||
//ui->dsbR->setValue(DEV->TypeForTest);
|
||||
}
|
||||
|
||||
void GeneralSetWidget::on_lineEdit_textChanged(const QString &arg1)
|
||||
{
|
||||
QString value = ui->cmbSetParam->currentText();
|
||||
if (value == "设置参数1")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PP1",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数2")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PP2",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数3")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PP3",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数4")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PP4",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数5")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PP5",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数6")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PP6",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数7")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PP7",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数8")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PP8",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
|
||||
IPGLASER->UpdateIPGPara();
|
||||
if (value == "设置参数1") IPGLASER->SetParam(1);
|
||||
else if (value == "设置参数2") IPGLASER->SetParam(2);
|
||||
else if (value == "设置参数3") IPGLASER->SetParam(3);
|
||||
else if (value == "设置参数4") IPGLASER->SetParam(4);
|
||||
else if (value == "设置参数5") IPGLASER->SetParam(5);
|
||||
else if (value == "设置参数6") IPGLASER->SetParam(6);
|
||||
else if (value == "设置参数7") IPGLASER->SetParam(7);
|
||||
else if (value == "设置参数8") IPGLASER->SetParam(8);
|
||||
|
||||
}
|
||||
|
||||
void GeneralSetWidget::on_lineEdit_2_textChanged(const QString &arg1)
|
||||
{
|
||||
QString value = ui->cmbSetParam->currentText();
|
||||
if (value == "设置参数1")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PG1",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数2")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PG2",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数3")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PG3",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数4")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PG4",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数5")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PG5",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数6")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PG6",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数7")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PG7",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数8")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PG8",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
|
||||
IPGLASER->UpdateIPGPara();
|
||||
if (value == "设置参数1") IPGLASER->SetParam(1);
|
||||
else if (value == "设置参数2") IPGLASER->SetParam(2);
|
||||
else if (value == "设置参数3") IPGLASER->SetParam(3);
|
||||
else if (value == "设置参数4") IPGLASER->SetParam(4);
|
||||
else if (value == "设置参数5") IPGLASER->SetParam(5);
|
||||
else if (value == "设置参数6") IPGLASER->SetParam(6);
|
||||
else if (value == "设置参数7") IPGLASER->SetParam(7);
|
||||
else if (value == "设置参数8") IPGLASER->SetParam(8);
|
||||
|
||||
}
|
||||
|
||||
void GeneralSetWidget::on_lineEdit_3_textChanged(const QString &arg1)
|
||||
{
|
||||
QString value = ui->cmbSetParam->currentText();
|
||||
if (value == "设置参数1")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/AM1",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数2")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/AM2",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数3")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/AM3",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数4")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/AM4",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数5")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/AM5",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数6")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/AM6",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数7")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/AM7",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数8")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/AM8",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
|
||||
IPGLASER->UpdateIPGPara();
|
||||
if (value == "设置参数1") IPGLASER->SetParam(1);
|
||||
else if (value == "设置参数2") IPGLASER->SetParam(2);
|
||||
else if (value == "设置参数3") IPGLASER->SetParam(3);
|
||||
else if (value == "设置参数4") IPGLASER->SetParam(4);
|
||||
else if (value == "设置参数5") IPGLASER->SetParam(5);
|
||||
else if (value == "设置参数6") IPGLASER->SetParam(6);
|
||||
else if (value == "设置参数7") IPGLASER->SetParam(7);
|
||||
else if (value == "设置参数8") IPGLASER->SetParam(8);
|
||||
|
||||
}
|
||||
|
||||
void GeneralSetWidget::on_lineEdit_4_textChanged(const QString &arg1)
|
||||
{
|
||||
QString value = ui->cmbSetParam->currentText();
|
||||
if (value == "设置参数1")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/MODE1",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数2")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/MODE2",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数3")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/MODE3",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数4")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/MODE4",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数5")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/MODE5",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数6")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/MODE6",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数7")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/MODE7",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else if (value == "设置参数8")
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/MODE8",arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
|
||||
IPGLASER->UpdateIPGPara();
|
||||
if (value == "设置参数1") IPGLASER->SetParam(1);
|
||||
else if (value == "设置参数2") IPGLASER->SetParam(2);
|
||||
else if (value == "设置参数3") IPGLASER->SetParam(3);
|
||||
else if (value == "设置参数4") IPGLASER->SetParam(4);
|
||||
else if (value == "设置参数5") IPGLASER->SetParam(5);
|
||||
else if (value == "设置参数6") IPGLASER->SetParam(6);
|
||||
else if (value == "设置参数7") IPGLASER->SetParam(7);
|
||||
else if (value == "设置参数8") IPGLASER->SetParam(8);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void GeneralSetWidget::on_lineEdit_5_textChanged(const QString &arg1)
|
||||
{
|
||||
DEV->ingotNumber = arg1;
|
||||
}
|
||||
|
||||
|
||||
void GeneralSetWidget::on_checkBox_clicked()
|
||||
{
|
||||
bool flag;
|
||||
|
||||
flag = ui->checkBox->isChecked();
|
||||
if (flag)
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PPEnable",1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
else
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
RS_SETTINGS->writeEntry("/PPEnable",0);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GeneralSetWidget::on_dsbR_check_valueChanged(double arg1)
|
||||
{
|
||||
RS_SETTINGS->beginGroup("device/Rposition");
|
||||
RS_SETTINGS->writeEntry("/RCheckOffset", arg1);
|
||||
RS_SETTINGS->endGroup();
|
||||
}
|
||||
|
||||
void GeneralSetWidget::on_cmbSetParam_currentTextChanged(const QString &arg1)
|
||||
{
|
||||
if (IPGLASER->m_hComm == nullptr)
|
||||
{
|
||||
IPGLASER->OpenComm();
|
||||
}
|
||||
IPGLASER->LaserClose();
|
||||
IPGLASER->getIPGLaerPara("IPGLaser");
|
||||
if (IPGLASER->m_hComm == nullptr)
|
||||
{
|
||||
IPGLASER->OpenComm();
|
||||
}
|
||||
int ret;
|
||||
if (arg1 == "设置参数1")
|
||||
{
|
||||
ret = IPGLASER->SetParam(1);
|
||||
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP1");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG1");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM1");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE1");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (arg1 == "设置参数2")
|
||||
{
|
||||
ret = IPGLASER->SetParam(2);
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP2");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG2");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM2");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE2");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (arg1 == "设置参数3")
|
||||
{
|
||||
ret = IPGLASER->SetParam(3);
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP3");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG3");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM3");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE3");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (arg1 == "设置参数4")
|
||||
{
|
||||
ret = IPGLASER->SetParam(4);
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP4");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG4");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM4");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE4");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (arg1 == "设置参数5")
|
||||
{
|
||||
ret = IPGLASER->SetParam(5);
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP5");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG5");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM5");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE5");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (arg1 == "设置参数6")
|
||||
{
|
||||
ret = IPGLASER->SetParam(6);
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP6");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG6");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM6");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE6");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (arg1 == "设置参数7")
|
||||
{
|
||||
ret = IPGLASER->SetParam(7);
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP7");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG7");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM7");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE7");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
else if (arg1 == "设置参数8")
|
||||
{
|
||||
ret = IPGLASER->SetParam(8);
|
||||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||||
QString value1 = RS_SETTINGS->readEntry("/PP8");
|
||||
QString value2 = RS_SETTINGS->readEntry("/PG8");
|
||||
QString value3 = RS_SETTINGS->readEntry("/AM8");
|
||||
QString value4 = RS_SETTINGS->readEntry("/MODE8");
|
||||
RS_SETTINGS->endGroup();
|
||||
ui->lineEdit->setText(value1);
|
||||
ui->lineEdit_2->setText(value2);
|
||||
ui->lineEdit_3->setText(value3);
|
||||
ui->lineEdit_4->setText(value4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef GENERALSETWIDGET_H
|
||||
#define GENERALSETWIDGET_H
|
||||
#include "ui_generalsetwidget.h"
|
||||
#include "RMS_Dll_global.h"
|
||||
#include "rms_dll.h"
|
||||
class GeneralSetWidget:public QFrame
|
||||
{
|
||||
@@ -14,7 +13,6 @@ public slots:
|
||||
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);
|
||||
@@ -34,7 +32,7 @@ private slots:
|
||||
void on_dsbGlobalCameraOffset_valueChanged(double arg1);
|
||||
|
||||
|
||||
void on_pbSetPP_clicked();
|
||||
//void on_pbSetPP_clicked();
|
||||
void show_Q_PP();
|
||||
void on_show_image_clicked();
|
||||
|
||||
@@ -46,6 +44,22 @@ private slots:
|
||||
|
||||
void on_Empty_clicked();
|
||||
|
||||
void on_lineEdit_textChanged(const QString &arg1);
|
||||
|
||||
void on_lineEdit_2_textChanged(const QString &arg1);
|
||||
|
||||
void on_lineEdit_3_textChanged(const QString &arg1);
|
||||
|
||||
void on_lineEdit_4_textChanged(const QString &arg1);
|
||||
|
||||
void on_lineEdit_5_textChanged(const QString &arg1);
|
||||
|
||||
void on_checkBox_clicked();
|
||||
|
||||
void on_dsbR_check_valueChanged(double arg1);
|
||||
|
||||
void on_cmbSetParam_currentTextChanged(const QString &arg1);
|
||||
|
||||
private:
|
||||
void loadSet();
|
||||
private:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -326,7 +326,7 @@ int writePowerfile(QString strFileName, float powerP1,float powerP2)
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
#include "deviceproxy.h"
|
||||
void myReadPowerValue()
|
||||
{
|
||||
|
||||
@@ -346,7 +346,7 @@ void myReadPowerValue()
|
||||
{
|
||||
path+=QString("/");
|
||||
}
|
||||
filename = path+"LookupTable_"+timestr+"_laser_test.csv";
|
||||
filename = path+DEV->ingotNumber+"_LookupTable_"+timestr+"_laser_test.csv";
|
||||
|
||||
RS_SETTINGS->beginGroup("device/Rposition");
|
||||
double p1k = RS_SETTINGS->readNumDEntry("/p1k");
|
||||
@@ -415,7 +415,7 @@ void myPidProc()
|
||||
{
|
||||
path+=QString("/");
|
||||
}
|
||||
filename = path+"LookupTable_"+timestr+"_laser_test.csv";
|
||||
filename = path+DEV->ingotNumber+"_LookupTable_"+timestr+"_laser_test.csv";
|
||||
|
||||
RS_SETTINGS->beginGroup("device/Rposition");
|
||||
double p1kt = RS_SETTINGS->readNumDEntry("/p1k_t");
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#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
|
||||
@@ -210,17 +210,22 @@ void SpecificAreasWidget::on_rbSrcImg_clicked()
|
||||
|
||||
//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);
|
||||
//QImage img = QImage(imgcv.data, imgcv.cols, imgcv.rows, QImage::Format_RGB888);
|
||||
QImage img= QImage(imgcv.data,imgcv.cols, imgcv.rows,imgcv.cols*3, 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();
|
||||
// QString fileName = QFileDialog::getSaveFileName(this, tr("png file"), qApp->applicationDirPath(),
|
||||
// tr("Files (*.png)"));
|
||||
// img.save(fileName);
|
||||
|
||||
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();
|
||||
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);
|
||||
*scaledimg=img.scaled(ui->lbImage->width(),ui->lbImage->height(),Qt::KeepAspectRatio);
|
||||
*scaledimgInit = scaledimg->copy();
|
||||
ui->lbImage->setPixmap(QPixmap::fromImage(*scaledimg));
|
||||
}
|
||||
@@ -233,8 +238,9 @@ void SpecificAreasWidget::on_rbDstImg_clicked()
|
||||
{
|
||||
if (!imgRecv.empty())
|
||||
{
|
||||
const uchar *pSrc = (const uchar*)imgRecv.data;
|
||||
QImage qimgRecv(pSrc, imgRecv.cols, imgRecv.rows, imgRecv.step, QImage::Format_RGB888);
|
||||
//const uchar *pSrc = (const uchar*)imgRecv.data;
|
||||
//QImage qimgRecv(pSrc, imgRecv.cols, imgRecv.rows, imgRecv.step, QImage::Format_RGB888);
|
||||
QImage qimgRecv(imgRecv.data,imgRecv.cols, imgRecv.rows,imgRecv.cols*3, QImage::Format_RGB888);
|
||||
//调用完成之后把img显示在窗口上
|
||||
|
||||
if((double)qimgRecv.width()/(double)ui->lbImage->width() >= (double)qimgRecv.height()/(double)ui->lbImage->height())
|
||||
@@ -257,7 +263,7 @@ void SpecificAreasWidget::ShowMergeSlots()
|
||||
{
|
||||
if (!imgRecv.empty())
|
||||
{
|
||||
const uchar *pSrc = (const uchar*)imgRecv.data;
|
||||
//const uchar *pSrc = (const uchar*)imgRecv.data;
|
||||
/***************************************************************
|
||||
* 修改码:1008610010
|
||||
* 日期:
|
||||
@@ -267,7 +273,9 @@ void SpecificAreasWidget::ShowMergeSlots()
|
||||
* 描述:
|
||||
* Format_Grayscale8改为Format_RGB888
|
||||
**************************************************************/
|
||||
QImage qimgRecv(pSrc, imgRecv.cols, imgRecv.rows, imgRecv.step, QImage::Format_RGB888);
|
||||
//QImage qimgRecv(pSrc, imgRecv.cols, imgRecv.rows, imgRecv.step, QImage::Format_RGB888);
|
||||
QImage qimgRecv(imgRecv.data,imgRecv.cols, imgRecv.rows,imgRecv.cols*3, QImage::Format_RGB888);
|
||||
|
||||
//调用完成之后把img显示在窗口上
|
||||
|
||||
if((double)qimgRecv.width()/(double)ui->lbImage->width() >= (double)qimgRecv.height()/(double)ui->lbImage->height())
|
||||
|
||||
@@ -332,8 +332,11 @@
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-100.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>200.000000000000000</double>
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
|
||||
Reference in New Issue
Block a user