diff --git a/Alldll/pack/GCBase_MD_VC120_v3_0_MVS_v3_1_0.dll b/Alldll/pack/GCBase_MD_VC120_v3_0_MVS_v3_1_0.dll new file mode 100644 index 0000000..9be786b Binary files /dev/null and b/Alldll/pack/GCBase_MD_VC120_v3_0_MVS_v3_1_0.dll differ diff --git a/Alldll/pack/GenApi_MD_VC120_v3_0_MVS_v3_1_0.dll b/Alldll/pack/GenApi_MD_VC120_v3_0_MVS_v3_1_0.dll new file mode 100644 index 0000000..a5b99fa Binary files /dev/null and b/Alldll/pack/GenApi_MD_VC120_v3_0_MVS_v3_1_0.dll differ diff --git a/Alldll/pack/Log_MD_VC120_v3_0_MVS_v3_1_0.dll b/Alldll/pack/Log_MD_VC120_v3_0_MVS_v3_1_0.dll new file mode 100644 index 0000000..aff53b3 Binary files /dev/null and b/Alldll/pack/Log_MD_VC120_v3_0_MVS_v3_1_0.dll differ diff --git a/Alldll/pack/MathParser_MD_VC120_v3_0_MVS_v3_1_0.dll b/Alldll/pack/MathParser_MD_VC120_v3_0_MVS_v3_1_0.dll new file mode 100644 index 0000000..0718f4c Binary files /dev/null and b/Alldll/pack/MathParser_MD_VC120_v3_0_MVS_v3_1_0.dll differ diff --git a/Alldll/pack/MvRender.dll b/Alldll/pack/MvRender.dll new file mode 100644 index 0000000..54bf59d Binary files /dev/null and b/Alldll/pack/MvRender.dll differ diff --git a/Alldll/pack/NodeMapData_MD_VC120_v3_0_MVS_v3_1_0.dll b/Alldll/pack/NodeMapData_MD_VC120_v3_0_MVS_v3_1_0.dll new file mode 100644 index 0000000..768db96 Binary files /dev/null and b/Alldll/pack/NodeMapData_MD_VC120_v3_0_MVS_v3_1_0.dll differ diff --git a/Alldll/pack/Qt5Cored.dll b/Alldll/pack/Qt5Cored.dll new file mode 100644 index 0000000..17cc515 Binary files /dev/null and b/Alldll/pack/Qt5Cored.dll differ diff --git a/Alldll/pack/Qt5Guid.dll b/Alldll/pack/Qt5Guid.dll new file mode 100644 index 0000000..3197a28 Binary files /dev/null and b/Alldll/pack/Qt5Guid.dll differ diff --git a/Alldll/pack/Qt5Networkd.dll b/Alldll/pack/Qt5Networkd.dll new file mode 100644 index 0000000..057740a Binary files /dev/null and b/Alldll/pack/Qt5Networkd.dll differ diff --git a/Alldll/pack/Qt5Sql.dll b/Alldll/pack/Qt5Sql.dll new file mode 100644 index 0000000..dbbd0be Binary files /dev/null and b/Alldll/pack/Qt5Sql.dll differ diff --git a/Alldll/pack/WibuCm64.dll b/Alldll/pack/WibuCm64.dll new file mode 100644 index 0000000..4ea1d7a Binary files /dev/null and b/Alldll/pack/WibuCm64.dll differ diff --git a/Alldll/pack/XmlParser_MD_VC120_v3_0_MVS_v3_1_0.dll b/Alldll/pack/XmlParser_MD_VC120_v3_0_MVS_v3_1_0.dll new file mode 100644 index 0000000..2343648 Binary files /dev/null and b/Alldll/pack/XmlParser_MD_VC120_v3_0_MVS_v3_1_0.dll differ diff --git a/Alldll/pack/libopencv_core460.dll b/Alldll/pack/libopencv_core460.dll new file mode 100644 index 0000000..786e79c Binary files /dev/null and b/Alldll/pack/libopencv_core460.dll differ diff --git a/Alldll/pack/libopencv_imgcodecs460.dll b/Alldll/pack/libopencv_imgcodecs460.dll new file mode 100644 index 0000000..2b009b5 Binary files /dev/null and b/Alldll/pack/libopencv_imgcodecs460.dll differ diff --git a/Alldll/pack/libopencv_imgproc460.dll b/Alldll/pack/libopencv_imgproc460.dll new file mode 100644 index 0000000..c5fc343 Binary files /dev/null and b/Alldll/pack/libopencv_imgproc460.dll differ diff --git a/device/SerialPort/IPG_laser.cpp b/device/SerialPort/IPG_laser.cpp index 3de4579..e6a2cd2 100644 --- a/device/SerialPort/IPG_laser.cpp +++ b/device/SerialPort/IPG_laser.cpp @@ -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"); diff --git a/device/SerialPort/IPG_laser.h b/device/SerialPort/IPG_laser.h index 623789d..2239fd2 100644 --- a/device/SerialPort/IPG_laser.h +++ b/device/SerialPort/IPG_laser.h @@ -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; diff --git a/device/control/acs/ACSVariable.h b/device/control/acs/ACSVariable.h index 8a73081..043a207 100644 --- a/device/control/acs/ACSVariable.h +++ b/device/control/acs/ACSVariable.h @@ -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" diff --git a/device/control/acs/buffercode/buffer0autoexecode.cpp b/device/control/acs/buffercode/buffer0autoexecode.cpp index 8f5cd55..977a1bb 100644 --- a/device/control/acs/buffercode/buffer0autoexecode.cpp +++ b/device/control/acs/buffercode/buffer0autoexecode.cpp @@ -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; +} + diff --git a/device/control/acs/buffercode/buffer0autoexecode.h b/device/control/acs/buffercode/buffer0autoexecode.h index 7274ee2..9d8b150 100644 --- a/device/control/acs/buffercode/buffer0autoexecode.h +++ b/device/control/acs/buffercode/buffer0autoexecode.h @@ -7,6 +7,7 @@ class Buffer0AutoExeCode public: Buffer0AutoExeCode(); QString getCode(); + QString getCode_2(); }; #endif // BUFFER0AUTOEXECODE_H diff --git a/device/control/acs/buffercode/rsensortozero.cpp b/device/control/acs/buffercode/rsensortozero.cpp index b6c86b1..a25445d 100644 --- a/device/control/acs/buffercode/rsensortozero.cpp +++ b/device/control/acs/buffercode/rsensortozero.cpp @@ -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; +} diff --git a/device/control/acs/buffercode/rsensortozero.h b/device/control/acs/buffercode/rsensortozero.h index dd448dc..4dcb74c 100644 --- a/device/control/acs/buffercode/rsensortozero.h +++ b/device/control/acs/buffercode/rsensortozero.h @@ -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}; diff --git a/device/control/acs/buffercode/tohomecode.cpp b/device/control/acs/buffercode/tohomecode.cpp index 85dac63..9d04e2b 100644 --- a/device/control/acs/buffercode/tohomecode.cpp +++ b/device/control/acs/buffercode/tohomecode.cpp @@ -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() //{ diff --git a/device/control/acs/buffercode/tohomecode.h b/device/control/acs/buffercode/tohomecode.h index 1e4aed3..fdc63d0 100644 --- a/device/control/acs/buffercode/tohomecode.h +++ b/device/control/acs/buffercode/tohomecode.h @@ -7,6 +7,7 @@ class ToHomeCode public: explicit ToHomeCode(); QString getCode(); + QString getCode_z(); //Ȧʹ void setZAAxisToSafePosVel(double value); diff --git a/device/deviceinfo.cpp b/device/deviceinfo.cpp index 9842fc0..a69eef2 100644 --- a/device/deviceinfo.cpp +++ b/device/deviceinfo.cpp @@ -2,7 +2,7 @@ #include #include "myexception.h" #include "exceptioncode.h" - +#include 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文件夹失败"<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"); diff --git a/device/deviceproxy.cpp b/device/deviceproxy.cpp index 8c9bf99..bd97ab5 100644 --- a/device/deviceproxy.cpp +++ b/device/deviceproxy.cpp @@ -222,6 +222,58 @@ void DeviceProxy::Record_xiao() } double DeviceProxy::getPP(double ap,bool flag) { + //从注册表中读取最新值 + RS_SETTINGS->beginGroup("device/Rposition"); + + p2tBuf[0] = RS_SETTINGS->readNumDEntry("/p2_t0"); + p2tBuf[1] = RS_SETTINGS->readNumDEntry("/p2_t5"); + p2tBuf[2] = RS_SETTINGS->readNumDEntry("/p2_t10"); + p2tBuf[3] = RS_SETTINGS->readNumDEntry("/p2_t15"); + p2tBuf[4] = RS_SETTINGS->readNumDEntry("/p2_t20"); + p2tBuf[5] = RS_SETTINGS->readNumDEntry("/p2_t25"); + p2tBuf[6] = RS_SETTINGS->readNumDEntry("/p2_t30"); + p2tBuf[7] = RS_SETTINGS->readNumDEntry("/p2_t35"); + p2tBuf[8] = RS_SETTINGS->readNumDEntry("/p2_t40"); + p2tBuf[9] = RS_SETTINGS->readNumDEntry("/p2_t45"); + p2tBuf[10] = RS_SETTINGS->readNumDEntry("/p2_t50"); + p2tBuf[11] = RS_SETTINGS->readNumDEntry("/p2_t55"); + p2tBuf[12] = RS_SETTINGS->readNumDEntry("/p2_t60"); + p2tBuf[13] = RS_SETTINGS->readNumDEntry("/p2_t65"); + p2tBuf[14] = RS_SETTINGS->readNumDEntry("/p2_t70"); + p2tBuf[15] = RS_SETTINGS->readNumDEntry("/p2_t75"); + p2tBuf[16] = RS_SETTINGS->readNumDEntry("/p2_t80"); + p2tBuf[17] = RS_SETTINGS->readNumDEntry("/p2_t85"); + p2tBuf[18] = RS_SETTINGS->readNumDEntry("/p2_t90"); + p2tBuf[19] = RS_SETTINGS->readNumDEntry("/p2_t95"); + p2tBuf[20] = RS_SETTINGS->readNumDEntry("/p2_t100"); + + p2sBuf[0] = RS_SETTINGS->readNumDEntry("/p2_s0"); + p2sBuf[1] = RS_SETTINGS->readNumDEntry("/p2_s5"); + p2sBuf[2] = RS_SETTINGS->readNumDEntry("/p2_s10"); + p2sBuf[3] = RS_SETTINGS->readNumDEntry("/p2_s15"); + p2sBuf[4] = RS_SETTINGS->readNumDEntry("/p2_s20"); + p2sBuf[5] = RS_SETTINGS->readNumDEntry("/p2_s25"); + p2sBuf[6] = RS_SETTINGS->readNumDEntry("/p2_s30"); + p2sBuf[7] = RS_SETTINGS->readNumDEntry("/p2_s35"); + p2sBuf[8] = RS_SETTINGS->readNumDEntry("/p2_s40"); + p2sBuf[9] = RS_SETTINGS->readNumDEntry("/p2_s45"); + p2sBuf[10] = RS_SETTINGS->readNumDEntry("/p2_s50"); + p2sBuf[11] = RS_SETTINGS->readNumDEntry("/p2_s55"); + p2sBuf[12] = RS_SETTINGS->readNumDEntry("/p2_s60"); + // p2sBuf[13] = RS_SETTINGS->readNumDEntry("/p2_s65"); + // p2sBuf[14] = RS_SETTINGS->readNumDEntry("/p2_s70"); + // p2sBuf[15] = RS_SETTINGS->readNumDEntry("/p2_s75"); + // p2sBuf[16] = RS_SETTINGS->readNumDEntry("/p2_s80"); + // p2sBuf[17] = RS_SETTINGS->readNumDEntry("/p2_s85"); + // p2sBuf[18] = RS_SETTINGS->readNumDEntry("/p2_s90"); + // p2sBuf[19] = RS_SETTINGS->readNumDEntry("/p2_s95"); + // p2sBuf[20] = RS_SETTINGS->readNumDEntry("/p2_s100"); + RS_SETTINGS->endGroup(); + for (int i=0;i<21;i++) + { + PPValues[i] = i*5; + } + if (flag) { int i; @@ -385,6 +437,7 @@ void DeviceProxy::DEVInit() acsCtl->stopBuffer(0); Buffer0AutoExeCode buffer0AutoExeCode; QByteArray qbyCode = buffer0AutoExeCode.getCode().toLatin1(); + //QByteArray qbyCode = buffer0AutoExeCode.getCode_2().toLatin1(); //From R char* code = qbyCode.data(); acsCtl->loadBuffer(0,code); acsCtl->compileBuffer(0); @@ -392,7 +445,10 @@ void DeviceProxy::DEVInit() int RSECATAddr = RS_SETTINGS->readNumEntry("/ECATAddr"); RS_SETTINGS->endGroup(); char RCECATAddrName[] = ACSCTL_RCECATADDR_V; - acsCtl->setGlobalInt(RCECATAddrName,RSECATAddr); + acsCtl->setGlobalInt(RCECATAddrName,RSECATAddr); + //char RCECATAddrName_Z0[] = ACSCTL_RCECATADDR_V_Z0; //From R + //acsCtl->setGlobalInt(RCECATAddrName_Z0,RSECATAddr+4); //From R + //这里写入acs(gaoding),dbuffer里加变量,界面加测距头距离,界面加测试,界面加显示距离 acsCtl->runBuffer(0); startStateDetection(); @@ -600,6 +656,189 @@ void DeviceProxy::reset() } +void DeviceProxy::reset_z() //音圈单独回零测试使用 +{ + if(!devIsInit) + { + emit exceptSGL(MyException(QString("设备未初始化,无法执行复位操作。请先初始化。"),MY_WARN)); + return; + } + + if(!lastTaskIsFinish) + { + emit exceptSGL(MyException(QString("%1任务执行中,无法执行复位操作。请先停止运动或等待任务结束。").arg(lastTaskName),MY_WARN)); + return; + } + if(bRunning) + { + emit exceptSGL(MyException(QString("自动运行执行中,请等待运行结束。"),MY_WARN)); + return; + } + + try + { + DEVICE_INFO->printDeviceSystemInfo("复位中..."); + lastTaskIsFinish=false; + lastTaskName="复位"; + devIsReset = false; + //emit DEVResetStateChangedSGL(devIsReset); + emit DEVInitStateChangedSGL(devIsInit && devIsReset); + + acsCtl->stopBuffer(1); + + 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 DAxisToHomePos = RS_SETTINGS->readNumDEntry("/DAxis"); + double Z0AxisToHomePos = RS_SETTINGS->readNumDEntry("/Z0Axis"); + double Z2AxisToHomePos = RS_SETTINGS->readNumDEntry("/Z2Axis"); + RS_SETTINGS->endGroup(); + + 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 DAxisZeroPosOffset = RS_SETTINGS->readNumDEntry("/DAxis"); + double Z0AxisZeroPosOffset = RS_SETTINGS->readNumDEntry("/Z0Axis"); + double Z2AxisZeroPosOffset = RS_SETTINGS->readNumDEntry("/Z2Axis"); + RS_SETTINGS->endGroup(); + + 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 DAxisLeftSLimit = RS_SETTINGS->readNumDEntry("/DAxis"); + double Z0AxisLeftSLimit = RS_SETTINGS->readNumDEntry("/Z0Axis"); + double Z2AxisLeftSLimit = RS_SETTINGS->readNumDEntry("/Z2Axis"); + RS_SETTINGS->endGroup(); + + 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 DAxisRightSLimit = RS_SETTINGS->readNumDEntry("/DAxis"); + double Z0AxisRightSLimit = RS_SETTINGS->readNumDEntry("/Z0Axis"); + double Z2AxisRightSLimit = RS_SETTINGS->readNumDEntry("/Z2Axis"); + RS_SETTINGS->endGroup(); + + 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 DAxisVel = RS_SETTINGS->readNumDEntry("/DAxis"); + double Z0AxisVel = RS_SETTINGS->readNumDEntry("/Z0Axis"); + double Z2AxisVel = RS_SETTINGS->readNumDEntry("/Z2Axis"); + RS_SETTINGS->endGroup(); + + 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 DAxisFindINDXVel = RS_SETTINGS->readNumDEntry("/DAxis"); + double Z0AxisFindINDXVel = RS_SETTINGS->readNumDEntry("/Z0Axis"); + double Z2AxisFindINDXVel = RS_SETTINGS->readNumDEntry("/Z2Axis"); + RS_SETTINGS->endGroup(); + + RS_SETTINGS->beginGroup("device/ZAAxisSafe"); + double ZAAxisToSafePosVel = RS_SETTINGS->readNumEntry("/vel"); + RS_SETTINGS->endGroup(); + + + ToHomeCode tohomeCode; + tohomeCode.setZAAxisToSafePosVel(ZAAxisToSafePosVel); + tohomeCode.setXAxisToHomePos(XAxisToHomePos); + tohomeCode.setYAxisToHomePos(YAxisToHomePos); + tohomeCode.setZAxisToHomePos(ZAxisToHomePos); + tohomeCode.setZAAxisToHomePos(ZAAxisToHomePos); + tohomeCode.setDAxisToHomePos(DAxisToHomePos); + tohomeCode.setZ0AxisToHomePos(Z0AxisToHomePos); + tohomeCode.setZ2AxisToHomePos(Z2AxisToHomePos); + tohomeCode.setXAxisFindINDVel(XAxisFindINDXVel); + tohomeCode.setYAxisFindINDVel(YAxisFindINDXVel); + tohomeCode.setZAxisFindINDVel(ZAxisFindINDXVel); + tohomeCode.setZAAxisFindINDVel(ZAAxisFindINDXVel); + tohomeCode.setDAxisFindINDVel(DAxisFindINDXVel); + tohomeCode.setZ0AxisFindINDVel(Z0AxisFindINDXVel); + tohomeCode.setZ2AxisFindINDVel(Z2AxisFindINDXVel); + tohomeCode.setXAxisINDZeroOffset(XAxisZeroPosOffset); + tohomeCode.setYAxisINDZeroOffset(YAxisZeroPosOffset); + tohomeCode.setZAxisINDZeroOffset(ZAxisZeroPosOffset); + tohomeCode.setZAAxisINDZeroOffset(ZAAxisZeroPosOffset); + tohomeCode.setDAxisINDZeroOffset(DAxisZeroPosOffset); + tohomeCode.setZ0AxisINDZeroOffset(Z0AxisZeroPosOffset); + tohomeCode.setZ2AxisINDZeroOffset(Z2AxisZeroPosOffset); + tohomeCode.setXAxisSLLimit(XAxisLeftSLimit); + tohomeCode.setXAxisSRLimit(XAxisRightSLimit); + tohomeCode.setYAxisSLLimit(YAxisLeftSLimit); + tohomeCode.setYAxisSRLimit(YAxisRightSLimit); + tohomeCode.setZAxisSLLimit(ZAxisLeftSLimit); + tohomeCode.setZAxisSRLimit(ZAxisRightSLimit); + tohomeCode.setZAAxisSLLimit(ZAAxisLeftSLimit); + tohomeCode.setZAAxisSRLimit(ZAAxisRightSLimit); + tohomeCode.setDAxisSLLimit(DAxisLeftSLimit); + tohomeCode.setDAxisSRLimit(DAxisRightSLimit); + tohomeCode.setZ0AxisSLLimit(Z0AxisLeftSLimit); + tohomeCode.setZ0AxisSRLimit(Z0AxisRightSLimit); + tohomeCode.setZ2AxisSLLimit(Z2AxisLeftSLimit); + tohomeCode.setZ2AxisSRLimit(Z2AxisRightSLimit); + tohomeCode.setXAxisVel(XAxisVel); + tohomeCode.setYAxisVel(YAxisVel); + tohomeCode.setZAxisVel(ZAxisVel); + tohomeCode.setZAAxisVel(ZAAxisVel); + tohomeCode.setDAxisVel(DAxisVel); + tohomeCode.setZ0AxisVel(Z0AxisVel); + tohomeCode.setZ2AxisVel(Z2AxisVel); + + QByteArray qbyCode = tohomeCode.getCode_z().toLatin1(); + char* code = qbyCode.data(); + acsCtl->loadBuffer(1,code); + acsCtl->compileBuffer(1); + // 把所有轴回零状态变量置为0 + char runFVName[] = ACSCTL_RUNF_V; + acsCtl->setGlobalInt(runFVName,0); + + char XToHomeFVName[] = ACSCTL_XTOHOMEF_V; + acsCtl->setGlobalInt(XToHomeFVName,0); + + char YToHomeFVName[] = ACSCTL_YTOHOMEF_V; + acsCtl->setGlobalInt(YToHomeFVName,0); + + char ZToHomeFVName[] = ACSCTL_ZTOHOMEF_V; + acsCtl->setGlobalInt(ZToHomeFVName,0); + + char ZAToHomeFVName[] = ACSCTL_ZATOHOMEF_V; + acsCtl->setGlobalInt(ZAToHomeFVName,0); + + char DToHomeFVName[] = ACSCTL_DTOHOMEF_V; + acsCtl->setGlobalInt(DToHomeFVName,0); + + char Z0ToHomeFVName[] = ACSCTL_Z0TOHOMEF_V; + acsCtl->setGlobalInt(Z0ToHomeFVName,0); + + char Z2ToHomeFVName[] = ACSCTL_Z2TOHOMEF_V; + acsCtl->setGlobalInt(Z2ToHomeFVName,0); + + acsCtl->runBuffer(1); + + connect(this,SIGNAL(CMDRunFinishSGL()),this,SLOT(resetFHandl())); + reqCMDRunFState = true; + } + catch (MyException mye) + { + exceptHandl(MyException("复位失败。",mye.getExceptCode())); + } +} + + + + void DeviceProxy::XAxisCMoveN() { if(!devIsReset) @@ -2966,6 +3205,40 @@ void DeviceProxy:: RSToZero() } } +void DeviceProxy:: RSToZero_Z0() //From R +{ + if(!devIsReset) + { + emit exceptSGL(MyException(QString("设备未初始化,未复位,无法执行测距传感器对零。请先完成复位。"),MY_WARN)); + return; + } + + if(!lastTaskIsFinish) + { + emit exceptSGL(MyException(QString("%1任务执行中,无法执行测距传感器对零。请先停止运动或等待任务结束。").arg(lastTaskName),MY_WARN)); + return; + } + if(bRunning) + { + emit exceptSGL(MyException(QString("自动运行执行中,请等待运行结束。"),MY_WARN)); + return; + } + + try + { + lastTaskIsFinish=false; + lastTaskName="R测距传感器对零"; + RSToZeroInSide_Z0(); + connect(this,SIGNAL(CMDRunFinishSGL()),this,SLOT(RSToZeroFHandl_Z0())); + reqCMDRunFState = true; + } + catch (MyException mye) + { + exceptHandl(MyException("测距传感器对零失败。",mye.getExceptCode())); + } +} + + void DeviceProxy:: MachSmallArea() { if(!devIsReset) @@ -3073,7 +3346,7 @@ void DeviceProxy::saveSScanData() { path+=QString("/"); } - QFile zData(path+"scanArMsrZ_"+timestr+".csv"); + QFile zData(path+"scanArMsrZ_"+timestr+".csv");//加晶锭编号 QFile yData(path+"scanArMsrY_"+timestr+".csv"); if(zData.open(QFile::WriteOnly|QFile::Truncate)&&yData.open(QFile::WriteOnly|QFile::Truncate)) { @@ -3186,7 +3459,7 @@ void DeviceProxy::saveSScanDataTable() { path+=QString("/"); } - QFile surfaceScanDataTableFile(path+"ScanDataTable_"+timestr+".csv"); + QFile surfaceScanDataTableFile(path+ingotNumber+"_ScanDataTable_"+timestr+".csv"); if(surfaceScanDataTableFile.open(QFile::WriteOnly|QFile::Truncate)) { @@ -3329,8 +3602,8 @@ void DeviceProxy::saveCompSScanData() { path+=QString("/"); } - QFile zData(path+"CSS_RSData_"+timestr+".csv"); - QFile yData(path+"CSS_YPosData_"+timestr+".csv"); + QFile zData(path+ingotNumber+"_CSS_RSData_"+timestr+".csv"); + QFile yData(path+ingotNumber+"_CSS_YPosData_"+timestr+".csv"); if(zData.open(QFile::WriteOnly|QFile::Truncate)&&yData.open(QFile::WriteOnly|QFile::Truncate)) { QTextStream zOut(&zData); @@ -5014,7 +5287,7 @@ void DeviceProxy::saveLookupTable_lhc() { path+=QString("/"); } - QFile lookUpTableData(path+"LookupTable_"+timestr+"_test.csv"); + QFile lookUpTableData(path+ingotNumber+"_LookupTable_"+timestr+"_test.csv"); if(lookUpTableData.open(QFile::WriteOnly|QFile::Truncate)) { @@ -5065,7 +5338,7 @@ void DeviceProxy::saveLookupTable_load() { path+=QString("/"); } - QFile lookUpTableData(path+"LookupTable_"+timestr+"_load.csv"); + QFile lookUpTableData(path+ingotNumber+"_LookupTable_"+timestr+"_load.csv"); if(lookUpTableData.open(QFile::WriteOnly|QFile::Truncate)) { @@ -5116,7 +5389,7 @@ void DeviceProxy::saveLookupTable() { path+=QString("/"); } - QFile lookUpTableData(path+"LookupTable_"+timestr+".csv"); + QFile lookUpTableData(path+ingotNumber+"_LookupTable_"+timestr+".csv"); if(lookUpTableData.open(QFile::WriteOnly|QFile::Truncate)) { @@ -5356,6 +5629,54 @@ void DeviceProxy::RSToZeroInSide() acsCtl->runBuffer(1); } + +void DeviceProxy::RSToZeroInSide_Z0() //From R +{ + DEVICE_INFO->printDeviceSystemInfo("测距传感器对零中..."); + + acsCtl->stopBuffer(1); + char vname[]= ACSCTL_RUNF_V; + acsCtl->setGlobalInt(vname,0); + RSensorToZero rSensorToZero; + + RS_SETTINGS->beginGroup("device/ZAAxisSafe"); + double ZAAxisSafePos = RS_SETTINGS->readNumEntry("/pos"); + double ZAAxisToSafePosVel = RS_SETTINGS->readNumEntry("/vel"); + RS_SETTINGS->endGroup(); + + rSensorToZero.setZAAxisSafePos(ZAAxisSafePos); + rSensorToZero.setZAAxisToSafePosVel(ZAAxisToSafePosVel); + + // 加载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(); + if (Vel1 > 5) Vel1 = 5; + if (Vel2 > 1) Vel2 = 1; + if (Vel3 > 1) Vel3 = 1; + rSensorToZero.setZAAxisToZero1Vel(Vel1); + rSensorToZero.setZAAxisToZero2Vel(Vel2); + rSensorToZero.setZAAxisToZero3Vel(Vel3); + rSensorToZero.CuCeGaoDoNum = CuCeGaoDoNum; + rSensorToZero.CuCeGaoDiNum = CuCeGaoDINum; + RS_SETTINGS->beginGroup("device/Rposition"); + double RCheckOffset = RS_SETTINGS->readNumDEntry("/RCheckOffset"); + RS_SETTINGS->endGroup(); + rSensorToZero.Z0_value = RCheckOffset; + char acsctl_Z0_VALUE[] = ACSCTL_Z0_VALUE; + acsCtl->setGlobalReal(acsctl_Z0_VALUE,RCheckOffset); + + QByteArray qByCode = rSensorToZero.getCode_Z0().toLatin1(); + char* code = qByCode.data(); + acsCtl->loadBuffer(1,code); + acsCtl->compileBuffer(1); + acsCtl->runBuffer(1); +} + + + void getCoordinate(QVector> &vec,int *row,int *col) { @@ -5519,22 +5840,27 @@ void DeviceProxy::MachSmallAreaInSide() QVector> vec; int row, col; 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 XiaoXpos = RS_SETTINGS->readNumDEntry("/XiaoXAxis"); - 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"); + 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 XiaoXpos = RS_SETTINGS->readNumDEntry("/XiaoXAxis"); //记录位置 + double XLeftOffset = RS_SETTINGS->readNumDEntry("/XLeftOffset"); //负向偏移 + double XRightOffset = RS_SETTINGS->readNumDEntry("/XRightOffset"); //正向偏移 + int YOffset = RS_SETTINGS->readNumDEntry("/YOffset"); //Y正向轴缩放条数 + int YOffset_N = RS_SETTINGS->readNumDEntry("/YOffset_N"); //Y正向轴缩放条数 + int YTanslate = RS_SETTINGS->readNumDEntry("/YTanslate"); //Y偏移 RS_SETTINGS->endGroup(); RS_SETTINGS->beginGroup("device/GlobalCameraPos"); double XAxisPos = RS_SETTINGS->readNumDEntry("/XAxis"); RS_SETTINGS->endGroup(); + //测试小面区域加工 + QString printXiaoXpos = QString::number(XiaoXpos, 'f', 2); + DEVICE_INFO->printDeviceSystemInfo("记录位置:" + printXiaoXpos); + + //根据参数进行图像的偏移和旋转 double Xoffset = XAxisPos - XiaoXpos; //double Xoffset = 0; int offsetPix = abs(Xoffset*GlobalPix); @@ -5556,6 +5882,9 @@ void DeviceProxy::MachSmallAreaInSide() } imwrite("result.jpg", dst); Mat Rotate_src = angleRotate(dst, 270); + + //找到第一个和最后一个包含非零像素的行 + int maxIndexRow=0,minIndexRow=0; row = Rotate_src.rows; @@ -5612,6 +5941,9 @@ void DeviceProxy::MachSmallAreaInSide() YOffset_N = 10; if (YTanslate > 10) YTanslate = 10; + + //找到一个 indexS,使得从 indexS 开始,每隔 internalPix 的行,都有非零像素。同时,indexSNum 记录了 indexS 和中间行索引之间的间隔数。 + if (minIndexRow < row/2) { for(int i=0;i<(int)row/internalPix;i++) @@ -5689,6 +6021,7 @@ void DeviceProxy::MachSmallAreaInSide() maxYpos = MHYAxis -XiaoInternal*indexENum-XiaoOffset; + // minYpos = MHYAxis -XiaoInternal*indexSNum-XiaoOffset+(0-YOffset)*XiaoInternal; // maxYpos = MHYAxis -XiaoInternal*indexENum-XiaoOffset-YOffset_N*XiaoInternal; @@ -5908,6 +6241,10 @@ void DeviceProxy::MachSmallAreaInSide() maxXpos = maxXpos + XiaoAccDec; minXpos = minXpos - XiaoAccDec; + //测试小面区域加工 + DEVICE_INFO->printDeviceSystemInfo(QString("minYpos:%1mm,indexSNum:%2mm").arg(minYpos).arg(indexSNum)); + DEVICE_INFO->printDeviceSystemInfo(QString("minYpos:%1mm,indexSNum:%2mm").arg(maxYpos).arg(indexENum)); + double tmpPos; for (int i=0;iprintDeviceSystemInfo(filename); } else { - filename = path+"QS_"+timestr+".csv"; + filename = path + ingotNumber + "_QS_"+timestr+".csv"; + DEVICE_INFO->printDeviceSystemInfo(filename); } + DEVICE_INFO->printDeviceSystemInfo("***已保存"); QFile filePid(filename); @@ -6428,15 +6768,38 @@ int DeviceProxy::ElectricResistanceCheckThread() RS_SETTINGS->endGroup(); if (strType == "6寸") { - str = StrPlotSixInch; + str = "(0,-60)(-30,-50)(-20,-50)(-10,-50)(0,-50)(10,-50)(20,-50)(30,-50)(-40,-40)(-30,-40)(-20,-40)(-10,-40)(0,-40)(10,-40)" + "(20,-40)(30,-40)(40,-40)(-50,-30)(-40,-30)(-30,-30)(-20,-30)(-10,-30)(0,-30)(10,-30)(20,-30)(30,-30)(40,-30)(50,-30)" + "(-50,-20)(-40,-20)(-30,-20)(-20,-20)(-10,-20)(0,-20)(10,-20)(20,-20)(30,-20)(40,-20)(50,-20)(-50,-10)(-40,-10)(-30,-10)" + "(-20,-10)(-10,-10)(0,-10)(10,-10)(20,-10)(30,-10)(40,-10)(50,-10)(-60,0)(-50,0)(-40,0)(-30,0)(-20,0)(-10,0)(0,0)(10,0)" + "(20,0)(30,0)(40,0)(50,0)(60,0)(-50,10)(-40,10)(-30,10)(-20,10)(-10,10)(0,10)(10,10)(20,10)(30,10)(40,10)(50,10)(-50,20)" + "(-40,20)(-30,20)(-20,20)(-10,20)(0,20)(10,20)(20,20)(30,20)(40,20)(50,20)(-50,30)(-40,30)(-30,30)(-20,30)(-10,30)(0,30)" + "(10,30)(20,30)(30,30)(40,30)(50,30)(-40,40)(-30,40)(-20,40)(-10,40)(0,40)(10,40)(20,40)(30,40)(40,40)(-30,50)(-20,50)" + "(-10,50)(0,50)(10,50)(20,50)(30,50)(0,60)"; } else if (strType == "8寸") { - str = StrPlotEightInch; + str = "(-44,-72)(-30,-72)(-16,-72)(-2,-72)(12,-72)(26,-72)(40,-72)(-58,-58)" + "(-44,-58)(-30,-58)(-16,-58)(-2,-58)(12,-58)(26,-58)(40,-58)(54,-58)" + "(-72,-44)(-58,-44)(-44,-44)(-30,-44)(-16,-44)(-2,-44)(12,-44)(26,-44)" + "(40,-44)(54,-44)(68,-44)(-72,-30)(-58,-30)(-44,-30)(-30,-30)(-16,-30)" + "(-2,-30)(12,-30)(26,-30)(40,-30)(54,-30)(68,-30)(-72,-16)(-58,-16)" + "(-44,-16)(-30,-16)(-16,-16)(-2,-16)(12,-16)(26,-16)(40,-16)(54,-16)" + "(68,-16)(82,-16)(-72,-2)(-58,-2)(-44,-2)(-30,-2)(-16,-2)(-2,-2)" + "(12,-2)(26,-2)(40,-2)(54,-2)(68,-2)(82,-2)(-72,12)(-58,12)(-44,12)" + "(-30,12)(-16,12)(-2,12)(12,12)(26,12)(40,12)(54,12)(68,12)(82,12)" + "(-72,26)(-58,26)(-44,26)(-30,26)(-16,26)(-2,26)(12,26)(26,26)(40,26)" + "(54,26)(68,26)(-72,40)(-58,40)(-44,40)(-30,40)(-16,40)(-2,40)(12,40)" + "(26,40)(40,40)(54,40)(68,40)(-58,54)(-44,54)(-30,54)(-16,54)(-2,54)" + "(12,54)(26,54)(40,54)(54,54)(-44,68)(-30,68)(-16,68)(-2,68)(12,68)" + "(26,68)(40,68)(-16,82)(-2,82)(12,82)"; } else { - str = StrPlotFourInch; + str = "(-2,-44)(-30,-30)(-16,-30)(-2,-30)(12,-30)(26,-30)(-30,-16)(-16,-16)" + "(-2,-16)(12,-16)(26,-16)(40,-16)(-44,-2)(-30,-2)(-16,-2)(-2,-2)(12,-2)" + "(26,-2)(40,-2)(-30,12)(-16,12)(-2,12)(12,12)(26,12)(40,12)(-30,26)(-16,26)" + "(-2,26)(12,26)(26,26)(-16,40)(-2,40)(12,40)"; } //memcpy(MODBUSTCP->array_pos,rev_buf,RevDataLen); @@ -6535,9 +6898,17 @@ int DeviceProxy::ElectricResistanceCheckThread() double max,min,med,mode; rms.RMS_ACQ(&max,&min,&med,&mode); DEV->mode = mode; + RS_SETTINGS->beginGroup("device/Para"); + DEV->R_detection_pm = RS_SETTINGS->readNumDEntry("/dsbPPM"); + DEV->R_detection_po = RS_SETTINGS->readNumDEntry("/dsbPPO"); + RS_SETTINGS->endGroup(); + rms.RMS_P(mode,&R_detection_pt,&R_detection_ps,R_detection_pm,R_detection_po); R_detection_pt = R_detection_pt * IPGLASER->PulseRepetition1.toDouble()/1000.0; R_detection_ps = R_detection_ps * IPGLASER->PulseRepetition2.toDouble()/1000.0; + DEVICE_INFO->printDeviceSystemInfo(QString("R:%1").arg(mode)); + DEVICE_INFO->printDeviceSystemInfo(QString("R_detection_qt:%1").arg(R_detection_pt)); + DEVICE_INFO->printDeviceSystemInfo(QString("R_detection_qs:%1").arg(R_detection_ps)); if (strType == "6寸") { @@ -6549,6 +6920,7 @@ int DeviceProxy::ElectricResistanceCheckThread() } else imageR = rms.RMS_Image(40); + DEV->StopElectricResistanceCheckFlag = false; DEV->emit show_Q_PP_SGL(); @@ -6567,6 +6939,232 @@ int DeviceProxy::ElectricResistanceCheckThread() } } +int DeviceProxy::ElectricResistanceCheckThread2()//From R +{ + //1、连接,获取数组 S T E + //2、到第一点,读取。循环。结束 + //除了xy位置,Z轴位置也是要计算的。增加一个Z0轴偏移,参考Z2偏移 + //测试时,第一次运行,先升Z轴,再升Z0轴,xy到位,Z0落下 + //后续只动XY,不在动z0,直至测完。 + //测完后,升z0轴,完成测试 + + + //1、连接,空采,根据尺寸获取数组,解析数组 + //2、到第一点,读取。循环。结束。正常结束时,计算数值。是否正常结束都关掉连接 + //除了xy位置,Z轴位置也是要计算的。增加一个Z0轴偏移,参考Z2偏移 + //测试时,第一次运行,先升Z轴,再升Z0轴,xy到位,Z0落下 + //后续只动XY,不在动z0,直至测完。 + //测完后,升z0轴,完成测试 + + //RMS_Dll rms; + char* ip; + + + 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()); + if (!ret) + { + return -1; + } + + QString str; + RS_SETTINGS->beginGroup("device/Type"); + QString strType = RS_SETTINGS->readEntry("/value"); + RS_SETTINGS->endGroup(); + if (strType == "6寸") + { + str = "(0,-60)(-30,-50)(-20,-50)(-10,-50)(0,-50)(10,-50)(20,-50)(30,-50)(-40,-40)(-30,-40)(-20,-40)(-10,-40)(0,-40)(10,-40)" + "(20,-40)(30,-40)(40,-40)(-50,-30)(-40,-30)(-30,-30)(-20,-30)(-10,-30)(0,-30)(10,-30)(20,-30)(30,-30)(40,-30)(50,-30)" + "(-50,-20)(-40,-20)(-30,-20)(-20,-20)(-10,-20)(0,-20)(10,-20)(20,-20)(30,-20)(40,-20)(50,-20)(-50,-10)(-40,-10)(-30,-10)" + "(-20,-10)(-10,-10)(0,-10)(10,-10)(20,-10)(30,-10)(40,-10)(50,-10)(-60,0)(-50,0)(-40,0)(-30,0)(-20,0)(-10,0)(0,0)(10,0)" + "(20,0)(30,0)(40,0)(50,0)(60,0)(-50,10)(-40,10)(-30,10)(-20,10)(-10,10)(0,10)(10,10)(20,10)(30,10)(40,10)(50,10)(-50,20)" + "(-40,20)(-30,20)(-20,20)(-10,20)(0,20)(10,20)(20,20)(30,20)(40,20)(50,20)(-50,30)(-40,30)(-30,30)(-20,30)(-10,30)(0,30)" + "(10,30)(20,30)(30,30)(40,30)(50,30)(-40,40)(-30,40)(-20,40)(-10,40)(0,40)(10,40)(20,40)(30,40)(40,40)(-30,50)(-20,50)" + "(-10,50)(0,50)(10,50)(20,50)(30,50)(0,60)"; + } + else if (strType == "8寸") + { + str = "(-44,-72)(-30,-72)(-16,-72)(-2,-72)(12,-72)(26,-72)(40,-72)(-58,-58)" + "(-44,-58)(-30,-58)(-16,-58)(-2,-58)(12,-58)(26,-58)(40,-58)(54,-58)" + "(-72,-44)(-58,-44)(-44,-44)(-30,-44)(-16,-44)(-2,-44)(12,-44)(26,-44)" + "(40,-44)(54,-44)(68,-44)(-72,-30)(-58,-30)(-44,-30)(-30,-30)(-16,-30)" + "(-2,-30)(12,-30)(26,-30)(40,-30)(54,-30)(68,-30)(-72,-16)(-58,-16)" + "(-44,-16)(-30,-16)(-16,-16)(-2,-16)(12,-16)(26,-16)(40,-16)(54,-16)" + "(68,-16)(82,-16)(-72,-2)(-58,-2)(-44,-2)(-30,-2)(-16,-2)(-2,-2)" + "(12,-2)(26,-2)(40,-2)(54,-2)(68,-2)(82,-2)(-72,12)(-58,12)(-44,12)" + "(-30,12)(-16,12)(-2,12)(12,12)(26,12)(40,12)(54,12)(68,12)(82,12)" + "(-72,26)(-58,26)(-44,26)(-30,26)(-16,26)(-2,26)(12,26)(26,26)(40,26)" + "(54,26)(68,26)(-72,40)(-58,40)(-44,40)(-30,40)(-16,40)(-2,40)(12,40)" + "(26,40)(40,40)(54,40)(68,40)(-58,54)(-44,54)(-30,54)(-16,54)(-2,54)" + "(12,54)(26,54)(40,54)(54,54)(-44,68)(-30,68)(-16,68)(-2,68)(12,68)" + "(26,68)(40,68)(-16,82)(-2,82)(12,82)"; + } + else + { + str = "(-2,-44)(-30,-30)(-16,-30)(-2,-30)(12,-30)(26,-30)(-30,-16)(-16,-16)" + "(-2,-16)(12,-16)(26,-16)(40,-16)(-44,-2)(-30,-2)(-16,-2)(-2,-2)(12,-2)" + "(26,-2)(40,-2)(-30,12)(-16,12)(-2,12)(12,12)(26,12)(40,12)(-30,26)(-16,26)" + "(-2,26)(12,26)(26,26)(-16,40)(-2,40)(12,40)"; + } + + //memcpy(MODBUSTCP->array_pos,rev_buf,RevDataLen); + + QStringList list = str.split(")"); + for (int i=0;i=0) + { + QStringList list_son_son = list_son[j].split(","); + MODBUSTCP->array_pos[i][0] = list_son_son[0].toFloat(); + MODBUSTCP->array_pos[i][1] = list_son_son[1].toFloat(); + } + + } + + } + + ret = rms.RMS_Read_Empty(); + if (!ret) + { + return -1; + } + devLaserOpenTime = 1800; + RS_SETTINGS->beginGroup("device/HeightFindPos"); + double XAxisPos = RS_SETTINGS->readNumDEntry("/XAxis"); + double YAxisPos = RS_SETTINGS->readNumDEntry("/YAxis"); + RS_SETTINGS->endGroup(); + while(1) + { + switch(step) + { + case 0: + if (!hasToBuffer) + { + toHeightFindPosInSide(); + reqCMDRunFState = true; + hasToBuffer = true; + } + else + { + if (!reqCMDRunFState)//buffer是否执行完毕 + { + step = step + 1; + hasToBuffer = false; + //continue; + } + } + break; + case 1: + if (!hasToBuffer) + { + RSToZeroInSide_Z0(); + reqCMDRunFState = true; + hasToBuffer = true; + } + else + { + if (!reqCMDRunFState)//buffer是否执行完毕 + { + step = step + 1; + hasToBuffer = false; + //continue; + } + } + break; + case 2: + acsCtl->setVEL(Z0AXIS, 10); + for (int i = 0;iABSToPoint(XAXIS,XAxisPos-MODBUSTCP->array_pos[i][0]); + acsCtl->ABSToPoint(YAXIS,YAxisPos-MODBUSTCP->array_pos[i][1]); + Sleep(20); + while(1) + { + + motorstsX = acsCtl->getMotorState(XAXIS); + motorstsY = acsCtl->getMotorState(YAXIS); + if (motorstsX && motorstsY) + break; + if (DEV->StopElectricResistanceCheckFlag) + { + acsCtl->halt(XAXIS); + acsCtl->halt(YAXIS); + rms.RMS_Disconnect(); + acsCtl->ABSToPoint(Z0AXIS,0); + return -1; + } + Sleep(1); + } + ret = rms.RMS_Read(MODBUSTCP->array_pos[i][0],MODBUSTCP->array_pos[i][1]); + //ret = rms.RMS_Read(1); + if (!ret) + { + DEVICE_INFO->printDeviceSystemInfo("接收命令失败,退出晶锭预测量"); + return -1; + } + + if (StopElectricResistanceCheckFlag) + { + rms.RMS_Disconnect(); + acsCtl->ABSToPoint(Z0AXIS,0); + return -1; + } + + } + step = step + 1; + break; + case 3: + double max,min,med,mode; + rms.RMS_ACQ(&max,&min,&med,&mode); + DEV->mode = mode; + RS_SETTINGS->beginGroup("device/Rposition"); + double R_ElectricResistance_a = RS_SETTINGS->readNumDEntry("/R_ElectricResistance_a"); + double R_ElectricResistance_m = RS_SETTINGS->readNumDEntry("/R_ElectricResistance_m"); + RS_SETTINGS->endGroup(); + rms.RMS_P(mode,&R_detection_pt,&R_detection_ps,R_detection_pm,R_detection_po);// + R_detection_pt = R_detection_pt * IPGLASER->PulseRepetition1.toDouble()/1000.0; + R_detection_ps = R_detection_ps * IPGLASER->PulseRepetition2.toDouble()/1000.0; + + if (strType == "6寸") + { + imageR = rms.RMS_Image(60); + } + else if (strType == "8寸") + { + imageR = rms.RMS_Image(80); + } + else + imageR = rms.RMS_Image(40); + DEV->StopElectricResistanceCheckFlag = false; + + + DEV->emit show_Q_PP_SGL(); + rms.RMS_Disconnect(); + acsCtl->ABSToPoint(Z0AXIS,0); + return 0; + + } + if (DEV->StopElectricResistanceCheckFlag) + { + rms.RMS_Disconnect(); + acsCtl->ABSToPoint(Z0AXIS,0); + return -1; + } + Sleep(5); + } +} + + int DeviceProxy::FindEdgeThread() { bool motorsts = false; @@ -8217,6 +8815,29 @@ void DeviceProxy::ReadData1() // ui->lbImage->setPixmap(QPixmap::fromImage(imgReceived)); } +//图像畸变矫正 +cv::Mat undistortImage(const cv::Mat& img, const cv::Mat& mtx, const cv::Mat& dist) { + // Get image dimensions + int h = img.rows; + int w = img.cols; + + // Get optimal new camera matrix + cv::Mat newCameraMatrix = cv::getOptimalNewCameraMatrix(mtx, dist, cv::Size(w, h), 1); + + // Undistort image + cv::Mat undistorted; + cv::undistort(img, undistorted, mtx, dist, newCameraMatrix); + + // Crop the image based on ROI + cv::Rect roi; + cv::Mat map1, map2; + cv::initUndistortRectifyMap(mtx, dist, cv::Mat(), newCameraMatrix, cv::Size(w, h), CV_16SC2, map1, map2); + cv::remap(undistorted, undistorted, map1, map2, cv::INTER_LINEAR); + + return undistorted; +} + + cv::Mat Func(int left,int right); int DeviceProxy::GetGlobalPhotoThread() { @@ -8241,6 +8862,18 @@ int DeviceProxy::GetGlobalPhotoThread() RS_SETTINGS->endGroup(); Mat dst(3648, 22*(StartPosRight-StartPos), CV_8UC3, Scalar(0, 0, 0)); + //相机矩阵 + cv::Mat matrix = (cv::Mat_(3, 3) << 3.65452135e+03, 0.00000000e+00, 2.68227419e+03, + 0.00000000e+00, 3.65376535e+03, 1.85203897e+03, + 0.00000000e+00, 0.00000000e+00, 1.00000000e+00); + + // cv::Mat distortion = (cv::Mat_(1, 5) << -2.82350423e-01, 4.36380572e-01, 5.89137914e-04, + // 2.92578449e-04, -2.93841329e-01); + cv::Mat distortion = (cv::Mat_(1, 5) << -2.24760208e-01, 2.86969144e-01, -4.89342095e-05, + -1.02890234e-04, -1.67326601e-01); + + + LIGHTSOURCEFIND->LightOn(4); while(1) { switch(step) @@ -8263,7 +8896,7 @@ int DeviceProxy::GetGlobalPhotoThread() if (!reqCMDRunFState)//buffer是否执行完毕 { bool motorstsD,motorstsX; - acsCtl->RToPointPos(XAXIS,-113);//转到工作位 + acsCtl->RToPointPos(XAXIS,-113);//转到工作位,拍照的起始位置 while(1) { @@ -8280,7 +8913,7 @@ int DeviceProxy::GetGlobalPhotoThread() Sleep(50); } RS_SETTINGS->beginGroup("device/Rposition"); - RS_SETTINGS->writeEntry("/XiaoXAxis", XAxisCtPos+(11*(StartPosRight-StartPos)+(5472/2-StartPos))/GlobalPix); + RS_SETTINGS->writeEntry("/XiaoXAxis", XAxisCtPos+(11*(StartPosRight-StartPos)+(StartPos-5472/2))/GlobalPix); RS_SETTINGS->endGroup(); step = step + 1; hasToBuffer = false; @@ -8310,37 +8943,51 @@ int DeviceProxy::GetGlobalPhotoThread() } Sleep(50); } - LIGHTSOURCEFIND->LightOn(4); + ret = CAMERAFIND->GetImage(image,true); - LIGHTSOURCEFIND->LightOff(4); + if (ret < 0) { return -1; } else { - QDateTime datetime = QDateTime::currentDateTime(); + // QDateTime datetime = QDateTime::currentDateTime(); char buf[200]; //sprintf(buf,"%s.jpg",datetime.toString("yyyyMMddHHmmsszzz").toLocal8Bit().data()); sprintf(buf,"%d.jpg",i); + // 对图像进行校正 + // cv::Mat undistorted = undistortImage(image, matrix, distortion); + // std::string new_filename = "undistorted_" + std::string(buf); + // imwrite(new_filename,undistorted); + //cv::flip(image, image, 0); //cv::flip(image, image, 1); + imwrite(buf,image); + //image.copyTo(srcImgs[i]); //cv::Rect roi(StartPos, 0, (int)GlobalPix*10, image.rows); - cv::Rect roi(StartPos, 0, (StartPosRight-StartPos), image.rows); + cv::Rect roi(StartPos, 0, (StartPosRight-StartPos), image.rows); cv::Mat cropped_image = image(roi); Mat dst_roi= dst(Rect(i*(StartPosRight-StartPos), 0, (StartPosRight-StartPos), dst.rows)); cropped_image.copyTo(dst_roi); + + // cv::Rect roi(StartPos, 0, (StartPosRight-StartPos), undistorted.rows); + // cv::Mat cropped_image = undistorted(roi); + // Mat dst_roi= dst(Rect(i*(StartPosRight-StartPos), 0, (StartPosRight-StartPos), dst.rows)); + // cropped_image.copyTo(dst_roi); // srcImgs.push_back(cropped_image); } } + + LIGHTSOURCEFIND->LightOff(4); step = step + 1; break; case 2: @@ -8356,6 +9003,8 @@ int DeviceProxy::GetGlobalPhotoThread() } Sleep(5); } + + } @@ -10495,8 +11144,12 @@ void DeviceProxy::detectionAllAxisCtPos() Z0AxisCtPos = acsCtl->getFPOS(Z0AXIS); emit Z0AxisCtPosSGL(Z0AxisCtPos); - Z2AxisCtPos = acsCtl->getFPOS(Z2AXIS); - emit Z2AxisCtPosSGL(Z2AxisCtPos); + //Z2AxisCtPos = acsCtl->getFPOS(Z2AXIS); + //emit Z2AxisCtPosSGL(Z2AxisCtPos); + + //char vName[] = ACSCTL_RSVALUE_V_Z0; //From R + //double Z2AxisCtPos = acsCtl->getGlobalReal(vName); //复用Z2AxisCtPos,用于R探头的测高头 + //emit Z2AxisCtPosSGL(Z2AxisCtPos); DAxisCtPos = acsCtl->getFPOS(DAXIS); emit DAxisCtPosSGL(DAxisCtPos); @@ -10811,33 +11464,33 @@ void DeviceProxy::detectionInState() emit exceptSGL(MyException(QString("急停按钮按下!"),MY_WARN)); } - int mask1 = 1; - int mask2 = 1; - mask1 = mask1<LightOpen(); - } +// int mask1 = 1; +// int mask2 = 1; +// mask1 = mask1<LightOpen(); +// } - } - else - { - if (devLightingState == 1) - { - DEV->LightClose(); - } +// } +// else +// { +// if (devLightingState == 1) +// { +// DEV->LightClose(); +// } - } +// } @@ -11126,6 +11779,12 @@ void DeviceProxy::RSToZeroFHandl() lastTaskIsFinish=true; } +void DeviceProxy::RSToZeroFHandl_Z0() //From R +{ + disconnect(this,SIGNAL(CMDRunFinishSGL()),this,SLOT(RSToZeroFHandl_Z0())); + DEVICE_INFO->printDeviceSystemInfo("R测量,距离检测完成"); + lastTaskIsFinish=true; +} void DeviceProxy::MachSmallAreaFHandl() { disconnect(this,SIGNAL(CMDRunFinishSGL()),this,SLOT(MachSmallAreaFHandl())); @@ -11181,7 +11840,7 @@ void DeviceProxy::compSScanFHandl() - buildLookupTable2();// + buildLookupTable();// saveLookupTable();// //SScanDataCheck();// @@ -11192,7 +11851,7 @@ void DeviceProxy::compSScanFHandl() /********************************************************/ QVector>().swap(lookupTable); - buildLookupTable_lhc2();// + buildLookupTable_lhc();// //saveLookupTable_lhc();// @@ -12536,7 +13195,7 @@ void DeviceProxy::toLaserApTestPosInSide() * mAxisABSMoveCode.setZ0AxisIsMove(true); * mAxisABSMoveCode.setZ0AxisTGPos(Z0AxisRightSLimit); **************************************************************/ - mAxisABSMoveCode.setZ0AxisTGPos(Z0AxisRightSLimit); + mAxisABSMoveCode.setZ0AxisTGPos(Z0AxisRightSLimit-2.0); // 加载PTP位置设置 RS_SETTINGS->beginGroup("device/ABSMove/Vel"); @@ -12550,6 +13209,12 @@ void DeviceProxy::toLaserApTestPosInSide() mAxisABSMoveCode.setYAxisVel(YAxisVel); mAxisABSMoveCode.setZAxisVel(ZAxisVel); mAxisABSMoveCode.setZAAxisVel(ZAAxisVel); + // 加载速度设置 + RS_SETTINGS->beginGroup("device/DDMotor"); + double Z0AxisVel = RS_SETTINGS->readNumDEntry("/Vel"); + RS_SETTINGS->endGroup(); + mAxisABSMoveCode.setZ0AxisVel(Z0AxisVel); + char *code; QByteArray byCode = mAxisABSMoveCode.getCode_L().toLatin1(); code = byCode.data(); @@ -13294,6 +13959,12 @@ void CDeviceProxyWorker::doWork_custom() //DEV->ShowSmallAreasSGL(); if (mParent->step >= mParent->fFileContent.count()) { + //假锭循环加工 + // mParent->step = 0; + // continue; + + + mParent->bRunning = false; // mParent->vacuumSuckerCloseInSide(); // mParent->VacuumBreakOpen(); @@ -14097,7 +14768,8 @@ void CDeviceProxyWorker::doWork_custom() } else if (tmpList.at(0) == "加工") - { + { DEVICE_INFO->printDeviceSystemInfo("加工开始..."); + //lihongchang if (mParent->SuspendFlag) { @@ -14134,6 +14806,7 @@ void CDeviceProxyWorker::doWork_custom() { IPGLASER->Power1 = QString::number(DEV->getPP(DEV->R_detection_pt,true), 'f', 3); mParent->ApPercentage = DEV->getPP(DEV->R_detection_pt,true); + DEVICE_INFO->printDeviceSystemInfo(QString("PP_T:%1").arg(mParent->ApPercentage)); } else { @@ -14158,6 +14831,7 @@ void CDeviceProxyWorker::doWork_custom() { IPGLASER->Power2 = QString::number(DEV->getPP(DEV->R_detection_ps,false), 'f', 3); mParent->ApPercentage = DEV->getPP(DEV->R_detection_ps,false); + DEVICE_INFO->printDeviceSystemInfo(QString("PP_S:%1").arg(mParent->ApPercentage)); } else { @@ -14201,6 +14875,7 @@ void CDeviceProxyWorker::doWork_custom() } else if (tmpList.at(0) == "晶锭预测量") { + DEVICE_INFO->printDeviceSystemInfo("晶锭预测量开始..."); if (mParent->SuspendFlag) { mParent->mutex.unlock(); @@ -14227,7 +14902,7 @@ void CDeviceProxyWorker::doWork_custom() else throw MyException(QString("晶锭预测量失败!"),9070); } - + DEVICE_INFO->printDeviceSystemInfo("晶锭预测量完成"); mParent->step = mParent->step + 1; } else if (tmpList.at(0) == "小面加工") diff --git a/device/deviceproxy.h b/device/deviceproxy.h index 5d73b3b..539d3a7 100644 --- a/device/deviceproxy.h +++ b/device/deviceproxy.h @@ -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 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(); diff --git a/device/lasermark/LaserMark.dll b/device/lasermark/LaserMark.dll index fd74c43..f03e16e 100644 Binary files a/device/lasermark/LaserMark.dll and b/device/lasermark/LaserMark.dll differ diff --git a/device/lasermark/LaserMark.o b/device/lasermark/LaserMark.o index c1b1ab4..aee79fa 100644 Binary files a/device/lasermark/LaserMark.o and b/device/lasermark/LaserMark.o differ diff --git a/device/lasermark/libLaserMark.a b/device/lasermark/libLaserMark.a index 69813b7..2ae513b 100644 Binary files a/device/lasermark/libLaserMark.a and b/device/lasermark/libLaserMark.a differ diff --git a/device/login.cpp b/device/login.cpp index 5c222f8..7119198 100644 --- a/device/login.cpp +++ b/device/login.cpp @@ -3,6 +3,7 @@ #include "deviceproxy.h" #include "deviceinfo.h" //#include "qc_applicationwindow.h" +#include 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("机台软件用户登录"); diff --git a/device/login.h b/device/login.h index b1acdab..fb61c6b 100644 --- a/device/login.h +++ b/device/login.h @@ -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(); diff --git a/device/rms_dll.cpp b/device/rms_dll.cpp new file mode 100644 index 0000000..0f0646c --- /dev/null +++ b/device/rms_dll.cpp @@ -0,0 +1,817 @@ +#include "rms_dll.h" +#include "QString" + +#define SIZE 15 //迭代次数 +#define MATSIZE 201 //总宽高 +#define EDGE 40 //边 +#define HALFMATSIZE 101 +#include +#include +#include + +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 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 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 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 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 && 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 && arr[SIZE%2][ix][iy]= small+eighth*3 && arr[SIZE%2][ix][iy]= small+eighth*4 && arr[SIZE%2][ix][iy]= small+eighth*5 && arr[SIZE%2][ix][iy]= small+eighth*6 && 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:"<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()<& data) +{ + double sum = 0.0; + for (double value : data) { + sum += value; + } + return sum / data.size(); +} + +double calculate_standard_deviation(const QVector& 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 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; +} + + + + + + + + + + + + + + diff --git a/device/ui/devicecontrolpanelwidget.cpp b/device/ui/devicecontrolpanelwidget.cpp index dbabba0..310160a 100644 --- a/device/ui/devicecontrolpanelwidget.cpp +++ b/device/ui/devicecontrolpanelwidget.cpp @@ -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(); + } + +} diff --git a/device/ui/devicecontrolpanelwidget.h b/device/ui/devicecontrolpanelwidget.h index 77f5427..68ee531 100644 --- a/device/ui/devicecontrolpanelwidget.h +++ b/device/ui/devicecontrolpanelwidget.h @@ -205,6 +205,8 @@ private slots: void on_spbPowerAdjust_valueChanged(int arg1); + void on_pbReset_clicked(); + private: Ui::DeviceControlPanelWidget* ui; diff --git a/device/ui/devicecontrolpanelwidget.ui b/device/ui/devicecontrolpanelwidget.ui index caa62d1..c705aa9 100644 --- a/device/ui/devicecontrolpanelwidget.ui +++ b/device/ui/devicecontrolpanelwidget.ui @@ -37,6 +37,56 @@ + + + + + 0 + 0 + + + + + 0 + 20 + + + + + 16777215 + 16777215 + + + + + 微软雅黑 + 12 + 75 + 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)); + + } + + + 停 止 + + + @@ -81,6 +131,50 @@ QPushButton:hover { + + + + + 0 + 0 + + + + + 0 + 20 + + + + + 微软雅黑 + 12 + 75 + 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)); + + } + + + 初始化 + + + @@ -131,8 +225,8 @@ QPushButton:hover { - - + + 0 @@ -157,6 +251,7 @@ QPushButton:hover { 12 75 true + true @@ -177,51 +272,7 @@ QPushButton:hover { } - 停 止 - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - - 微软雅黑 - 12 - 75 - 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)); - - } - - - 初始化 + 复 位 @@ -823,7 +874,7 @@ QRadioButton::unchecked{color:rgb(0, 0, 0);} 4 - 200.000000000000000 + 500.000000000000000 @@ -1959,6 +2010,7 @@ QPushButton:hover { 微软雅黑 + 9 @@ -2006,6 +2058,7 @@ QPushButton:hover { 微软雅黑 + 9 diff --git a/device/ui/devicesysteminfowidget.cpp b/device/ui/devicesysteminfowidget.cpp index bcb2d0b..0cb86ef 100644 --- a/device/ui/devicesysteminfowidget.cpp +++ b/device/ui/devicesysteminfowidget.cpp @@ -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)); diff --git a/device/ui/generalsetwidget.cpp b/device/ui/generalsetwidget.cpp index d37dd41..f598373 100644 --- a/device/ui/generalsetwidget.cpp +++ b/device/ui/generalsetwidget.cpp @@ -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); + } + +} diff --git a/device/ui/generalsetwidget.h b/device/ui/generalsetwidget.h index 2bcad04..445d26f 100644 --- a/device/ui/generalsetwidget.h +++ b/device/ui/generalsetwidget.h @@ -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: diff --git a/device/ui/generalsetwidget.ui b/device/ui/generalsetwidget.ui index ea4cb11..40afe05 100644 --- a/device/ui/generalsetwidget.ui +++ b/device/ui/generalsetwidget.ui @@ -6,7 +6,7 @@ 0 0 - 887 + 1308 677 @@ -23,8 +23,8 @@ 20 20 - 671 - 531 + 751 + 601 @@ -35,11 +35,709 @@ 0 0 - 669 - 529 + 749 + 599 + + + + + 9 + + + + 参数 + + + + + + + + + 0 + 25 + + + + Q_T: + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 60 + 25 + + + + + 16777215 + 16777215 + + + + Qt::AlignCenter + + + true + + + + + + 2 + + + -10.000000000000000 + + + 300000.000000000000000 + + + 0.000000000000000 + + + + + + + + + + + + 0 + 25 + + + + PP_S: + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 60 + 25 + + + + + 16777215 + 16777215 + + + + Qt::AlignCenter + + + true + + + + + + 3 + + + 0.000000000000000 + + + 100.000000000000000 + + + 0.001000000000000 + + + 0.000000000000000 + + + + + + + + + + + + 0 + 25 + + + + Q_S: + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 60 + 25 + + + + + 16777215 + 16777215 + + + + Qt::AlignCenter + + + true + + + + + + 2 + + + -40.000000000000000 + + + 300000.000000000000000 + + + 0.000000000000000 + + + + + + + + + + + + 0 + 25 + + + + R: + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 60 + 25 + + + + + 16777215 + 16777215 + + + + Qt::AlignCenter + + + true + + + + + + 4 + + + 0.000000000000000 + + + 1000.000000000000000 + + + 0.001000000000000 + + + 0.000000000000000 + + + + + + + + + + + 空采 + + + + + + + 单点标定 + + + + + + + + + + + + 0 + 25 + + + + PP_O: + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 60 + 25 + + + + + 16777215 + 16777215 + + + + Qt::AlignCenter + + + false + + + + + + 3 + + + 0.000000000000000 + + + 100.000000000000000 + + + 0.001000000000000 + + + 0.000000000000000 + + + + + + + + + + + + 0 + 25 + + + + PP_M: + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 60 + 25 + + + + + 16777215 + 16777215 + + + + Qt::AlignCenter + + + false + + + + + + 3 + + + 0.000000000000000 + + + 100.000000000000000 + + + 0.000000000000000 + + + + + + + + + 显示图片 + + + + + + + + + + 0 + 25 + + + + PP_T: + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 60 + 25 + + + + + 16777215 + 16777215 + + + + Qt::AlignCenter + + + true + + + + + + 3 + + + 0.000000000000000 + + + 100.000000000000000 + + + 0.001000000000000 + + + 0.000000000000000 + + + + + + + + + + + + + 0 + 0 + + + + + 9 + + + + 激光器 + + + + + + + 0 + 0 + + + + + 100 + 25 + + + + + 16777215 + 16777215 + + + + 连 接 + + + + + + + + 0 + 0 + + + + + 100 + 25 + + + + + 16777215 + 16777215 + + + + 断 开 + + + + + + + + 0 + 0 + + + + + 100 + 25 + + + + + 16777215 + 16777215 + + + + + + + + + + + RR: + + + + + + + + + + PG: + + + + + + + + + + PP: + + + + + + + MODE: + + + + + + + + + + PPEnable + + + + + + + + 100 + 0 + + + + + 150 + 16777215 + + + + 晶锭编号: + + + + + + + + + + + 0 + 0 + + + + + 100 + 25 + + + + + 16777215 + 16777215 + + + + 参数标定 + + + + + + + + 0 + 25 + + + + + T标定 + + + + + S标定 + + + + + + + @@ -479,510 +1177,10 @@ - - - - - - - - 0 - 0 - - - - - 9 - - - - 激光器 - - - - - - - 0 - 0 - - - - - 0 - 25 - - - - 设 置 - - - - - - - - 0 - 0 - - - - - 100 - 25 - - - - - 16777215 - 16777215 - - - - 连 接 - - - - - - - - 0 - 0 - - - - - 100 - 25 - - - - - 16777215 - 16777215 - - - - 断 开 - - - - - - - - - - 0 - 0 - - - - - 60 - 25 - - - - - 16777215 - 16777215 - - - - Qt::AlignCenter - - - - - - 2 - - - 0.000000000000000 - - - 100.000000000000000 - - - 0.001000000000000 - - - 0.000000000000000 - - - - - - - - 0 - 0 - - - - - 0 - 25 - - - - - 20 - 16777215 - - - - % - - - - - - - - - - 0 - 25 - - - - - T标定 - - - - - S标定 - - - - - - - - - 0 - 0 - - - - - 100 - 25 - - - - - 16777215 - 16777215 - - - - - - - - - 0 - 0 - - - - - 100 - 25 - - - - - 16777215 - 16777215 - - - - 参数标定 - - - - - - - - - - - 9 - - - - 参数 - - - - - - - - - 0 - 25 - - - - PP_O: - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 60 - 25 - - - - - 16777215 - 16777215 - - - - Qt::AlignCenter - - - false - - - - - - 3 - - - 0.000000000000000 - - - 100.000000000000000 - - - 0.001000000000000 - - - 0.000000000000000 - - - - - - - - - - - - 0 - 25 - - - - PP_T: - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 60 - 25 - - - - - 16777215 - 16777215 - - - - Qt::AlignCenter - - - true - - - - - - 3 - - - 0.000000000000000 - - - 100.000000000000000 - - - 0.001000000000000 - - - 0.000000000000000 - - - - - - - - - - - - 0 - 25 - - - - PP_M: - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 60 - 25 - - - - - 16777215 - 16777215 - - - - Qt::AlignCenter - - - false - - - - - - 3 - - - 0.000000000000000 - - - 100.000000000000000 - - - 0.000000000000000 - - - - - - - - - - - - 0 - 25 - - - - Q_T: - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 60 - 25 - - - - - 16777215 - 16777215 - - - - Qt::AlignCenter - - - true - - - - - - 2 - - - -10.000000000000000 - - - 300000.000000000000000 - - - 0.000000000000000 - - - - - - + - + 0 @@ -990,7 +1188,7 @@ - PP_S: + 预检测偏移: Qt::AlignCenter @@ -998,7 +1196,7 @@ - + 0 @@ -1020,9 +1218,6 @@ Qt::AlignCenter - - true - @@ -1030,10 +1225,10 @@ 3 - 0.000000000000000 + -2.000000000000000 - 100.000000000000000 + 2.000000000000000 0.001000000000000 @@ -1045,160 +1240,6 @@ - - - - - - - 0 - 25 - - - - Q_S: - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 60 - 25 - - - - - 16777215 - 16777215 - - - - Qt::AlignCenter - - - true - - - - - - 2 - - - -40.000000000000000 - - - 300000.000000000000000 - - - 0.000000000000000 - - - - - - - - - - - - 0 - 25 - - - - R: - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 60 - 25 - - - - - 16777215 - 16777215 - - - - Qt::AlignCenter - - - true - - - - - - 4 - - - 0.000000000000000 - - - 1000.000000000000000 - - - 0.001000000000000 - - - 0.000000000000000 - - - - - - - - - - - 空采 - - - - - - - 单点标定 - - - - - - - - - 显示图片 - - - diff --git a/device/ui/serialdevicetest.cpp b/device/ui/serialdevicetest.cpp index c49824a..1f543d8 100644 --- a/device/ui/serialdevicetest.cpp +++ b/device/ui/serialdevicetest.cpp @@ -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"); diff --git a/device/ui/specificareaswidget.cpp b/device/ui/specificareaswidget.cpp index 4b28630..63c393b 100644 --- a/device/ui/specificareaswidget.cpp +++ b/device/ui/specificareaswidget.cpp @@ -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()) diff --git a/device/ui/tohomesetwidget.ui b/device/ui/tohomesetwidget.ui index e54b07f..ef3f668 100644 --- a/device/ui/tohomesetwidget.ui +++ b/device/ui/tohomesetwidget.ui @@ -332,8 +332,11 @@ 4 + + -100.000000000000000 + - 200.000000000000000 + 100.000000000000000 1.000000000000000 diff --git a/main.cpp b/main.cpp index b0a4ec2..6cb58a4 100644 --- a/main.cpp +++ b/main.cpp @@ -1,9 +1,12 @@ #include "widget.h" #include +#include "rs_settings.h" int main(int argc, char *argv[]) { + RS_SETTINGS->init("LibreCAD", "LibreCAD"); + QApplication a(argc, argv); Widget w; w.show(); diff --git a/widget.cpp b/widget.cpp index b3993b3..3e83908 100644 --- a/widget.cpp +++ b/widget.cpp @@ -7,6 +7,7 @@ Widget::Widget(QWidget *parent) { ui->setupUi(this); + this->setWindowState(Qt::WindowMaximized); } Widget::~Widget() diff --git a/widget.ui b/widget.ui index 08367d2..c97f797 100644 --- a/widget.ui +++ b/widget.ui @@ -6,23 +6,35 @@ 0 0 - 1004 - 726 + 1437 + 876 Widget - - - - 370 - 30 - 551 - 671 - - - + + + + + + + + + + + + + + + + + + + + + + @@ -31,6 +43,24 @@
devicecontrolpanelwidget.h
1
+ + DeviceSetWidget + QWidget +
devicesetwidget.h
+ 1 +
+ + DeviceStateInfoWidget + QWidget +
devicestateinfowidget.h
+ 1 +
+ + DeviceSystemInfoWidget + QWidget +
devicesysteminfowidget.h
+ 1 +