#include "SettingsLgsDialog.h" #include "../../components/object/objectSystemAnchor.h" DialogSettingsLGS::DialogSettingsLGS(QWidget *parent) :QDialog( parent ){ m_pParent = parent; m_bRBlocker = false; m_bSettingsAreChanged = false; m_bLocationByWGS84 = true; setWindowModality(Qt::WindowModal); //resize( 485, 510 ); //setModal( true ); //https://www.youtube.com/watch?v=T15mFICDV-U setFixedSize( 725, 740 ); setWindowTitle(QApplication::translate("DTSettings", "LRF Device Settings", 0 )); /* Begin of Device Info Group */ m_pInfoGroupBox = new QGroupBox(this); m_pInfoGroupBox->setGeometry(QRect(6, 0, 335, 285)); m_pInfoGroupBox->setTitle(QApplication::translate("DTSettings", "LIDAR Info", 0)); /* Begin of Info Frame */ m_pFlagsFrame = new QFrame(m_pInfoGroupBox); m_pFlagsFrame->setGeometry(QRect(10, 20, 140, 255)); m_pFlagsFrame->setFrameShape(QFrame::Box); m_pFlagsFrame->setFrameShadow(QFrame::Raised); m_pFlagsLA = new QVBoxLayout(m_pFlagsFrame); m_pInfoMaster = new QLabel("Master", m_pFlagsFrame); m_pInfoMaster->setFrameShape(QFrame::Box); m_pInfoMaster->setAlignment(Qt::AlignCenter); m_pInfoMaster->setFixedSize(120, 20); m_pFlagsLA->addWidget(m_pInfoMaster); m_pInfoNoBlackTargets = new QLabel("No Black Targets", m_pFlagsFrame); m_pInfoNoBlackTargets->setFrameShape(QFrame::Box); m_pInfoNoBlackTargets->setAlignment(Qt::AlignCenter); m_pInfoNoBlackTargets->setFixedSize(120, 20); m_pFlagsLA->addWidget(m_pInfoNoBlackTargets); m_pInfoEUmode = new QLabel("SafeShore Mode", m_pFlagsFrame); m_pInfoEUmode->setFrameShape(QFrame::Box); m_pInfoEUmode->setAlignment(Qt::AlignCenter); m_pInfoEUmode->setFixedSize(120, 20); m_pFlagsLA->addWidget(m_pInfoEUmode); m_pInfoTGDmotors = new QLabel("TGD Motors", m_pFlagsFrame); m_pInfoTGDmotors->setFrameShape(QFrame::Box); m_pInfoTGDmotors->setAlignment(Qt::AlignCenter); m_pInfoTGDmotors->setFixedSize(120, 20); m_pFlagsLA->addWidget(m_pInfoTGDmotors); m_pInfoDebug = new QLabel("Debug Version", m_pFlagsFrame); m_pInfoDebug->setFrameShape(QFrame::Box); m_pInfoDebug->setAlignment(Qt::AlignCenter); m_pInfoDebug->setFixedSize(120, 20); m_pFlagsLA->addWidget(m_pInfoDebug); m_pInfoNoTargetLog = new QLabel("No Targets Log", m_pFlagsFrame); m_pInfoNoTargetLog->setFrameShape(QFrame::Box); m_pInfoNoTargetLog->setAlignment(Qt::AlignCenter); m_pInfoNoTargetLog->setFixedSize(120, 20); m_pFlagsLA->addWidget(m_pInfoNoTargetLog); m_pInfoEnaHibernate = new QLabel("Enable Hibernating", m_pFlagsFrame); m_pInfoEnaHibernate->setFrameShape(QFrame::Box); m_pInfoEnaHibernate->setAlignment(Qt::AlignCenter); m_pInfoEnaHibernate->setFixedSize(120, 20); m_pFlagsLA->addWidget(m_pInfoEnaHibernate); m_pInfoEnaMotorCtrl = new QLabel("Enable Motor Control", m_pFlagsFrame); m_pInfoEnaMotorCtrl->setFrameShape(QFrame::Box); m_pInfoEnaMotorCtrl->setAlignment(Qt::AlignCenter); m_pInfoEnaMotorCtrl->setFixedSize(120, 20); m_pFlagsLA->addWidget(m_pInfoEnaMotorCtrl); m_pInfoTGDVer2 = new QLabel("CAN Bus protocol V2", m_pFlagsFrame); m_pInfoTGDVer2->setFrameShape(QFrame::Box); m_pInfoTGDVer2->setAlignment(Qt::AlignCenter); m_pInfoTGDVer2->setFixedSize(120, 20); m_pFlagsLA->addWidget(m_pInfoTGDVer2); m_pInfoThreadFlips = new QLabel("Threadded Flip", m_pFlagsFrame); m_pInfoThreadFlips->setFrameShape(QFrame::Box); m_pInfoThreadFlips->setAlignment(Qt::AlignCenter); m_pInfoThreadFlips->setFixedSize(120, 20); m_pFlagsLA->addWidget(m_pInfoThreadFlips); m_pVersionFrame = new QFrame(m_pInfoGroupBox); m_pVersionFrame->setGeometry(QRect(155, 20, 170, 255)); m_pVersionFrame->setFrameShape(QFrame::Box); m_pVersionFrame->setFrameShadow(QFrame::Raised); m_pVersionLA = new QVBoxLayout(m_pVersionFrame); m_pBuildDate = new QLabel("-- Device is --", m_pVersionFrame); m_pBuildDate->setFrameShape(QFrame::Box); m_pBuildDate->setAlignment(Qt::AlignCenter); m_pBuildDate->setFixedSize(148, 20); m_pVersionLA->addWidget( m_pBuildDate ); m_pBuildCode = new QLabel("-- Not Connected --", m_pVersionFrame); m_pBuildCode->setFrameShape(QFrame::Box); m_pBuildCode->setAlignment(Qt::AlignCenter); m_pBuildCode->setFixedSize(148, 20); m_pVersionLA->addWidget( m_pBuildCode ); m_pPRU1LA = new QHBoxLayout(m_pVersionFrame); m_pPRU0Code = new QLabel("-UNKNOWN-", m_pVersionFrame); m_pPRU0Code->setFrameShape(QFrame::Box); m_pPRU0Code->setAlignment(Qt::AlignCenter); m_pPRU0Code->setFixedSize(70, 60); m_pPRU1LA->addWidget( m_pPRU0Code ); m_pPRU1LA->addItem( new QSpacerItem(5,5,QSizePolicy::Expanding, QSizePolicy::Minimum )); m_pPRU2Code = new QLabel("-UNKNOWN-", m_pVersionFrame); m_pPRU2Code->setFrameShape(QFrame::Box); m_pPRU2Code->setAlignment(Qt::AlignCenter); m_pPRU2Code->setFixedSize(70, 60); m_pPRU1LA->addWidget( m_pPRU2Code ); m_pPRU2LA = new QHBoxLayout(m_pVersionFrame); m_pPRU1Code = new QLabel("-UNKNOWN-", m_pVersionFrame); m_pPRU1Code->setFrameShape(QFrame::Box); m_pPRU1Code->setAlignment(Qt::AlignCenter); m_pPRU1Code->setFixedSize(70, 60); m_pPRU2LA->addWidget( m_pPRU1Code ); m_pPRU2LA->addItem( new QSpacerItem(5,5,QSizePolicy::Expanding, QSizePolicy::Minimum )); m_pPRU3Code = new QLabel("-UNKNOWN-", m_pVersionFrame); m_pPRU3Code->setFrameShape(QFrame::Box); m_pPRU3Code->setAlignment(Qt::AlignCenter); m_pPRU3Code->setFixedSize(70, 60); m_pPRU2LA->addWidget( m_pPRU3Code ); m_pVersionLA->addItem( m_pPRU1LA ); m_pVersionLA->addItem( m_pPRU2LA ); /* Begin of Detection Settings Group */ m_pDetectionGroupBox = new QGroupBox( this ); m_pDetectionGroupBox->setGeometry(QRect(339, 0, 180, 285)); m_pDetectionGroupBox->setTitle(QApplication::translate("DTSettings", "Detection Settings", 0)); m_pDetectFrame = new QFrame(m_pDetectionGroupBox); m_pDetectFrame->setGeometry(QRect(10, 20, 160, 255)); m_pDetectFrame->setFrameShape(QFrame::Box); m_pDetectFrame->setFrameShadow(QFrame::Raised); m_pFlipLabel = new QLabel(m_pDetectFrame); m_pFlipLabel->setGeometry(QRect(10, 15, 60, 13)); m_pFlipLabel->setText(QApplication::translate("DTSettings", "Flip Size", 0 )); m_pFlipSpinBox = new QSpinBox(m_pDetectFrame); m_pFlipSpinBox->setGeometry(QRect(80, 10, 70, 22)); m_pFlipSpinBox->setMinimum(8); m_pFlipSpinBox->setMaximum(1024); m_pFlipSpinBox->setProperty("displayIntegerBase", QVariant(10)); m_pSSTLabel = new QLabel(m_pDetectFrame); m_pSSTLabel->setGeometry(QRect(10, 40, 60, 13)); m_pSSTLabel->setText(QApplication::translate("DTSettings", "SST Value", 0 )); m_pSSTSpinBox = new QSpinBox(m_pDetectFrame); m_pSSTSpinBox->setGeometry(QRect(80, 35, 70, 22)); m_pSSTSpinBox->setMinimum(0); m_pSSTSpinBox->setMaximum(3); m_pSSTSpinBox->setProperty("displayIntegerBase", QVariant(10)); m_pOrderLabel = new QLabel(m_pDetectFrame); m_pOrderLabel->setGeometry(QRect(10, 65, 60, 13)); m_pOrderLabel->setText(QApplication::translate("DTSettings", "Order Value", 0 )); m_pOrderSpinBox = new QSpinBox(m_pDetectFrame); m_pOrderSpinBox->setGeometry(QRect(80, 60, 70, 22)); m_pOrderSpinBox->setMinimum(1); m_pOrderSpinBox->setMaximum(7); m_pOrderSpinBox->setProperty("displayIntegerBase", QVariant(10)); m_pOffsetLabel = new QLabel(m_pDetectFrame); m_pOffsetLabel->setGeometry(QRect(10, 90, 60, 13)); m_pOffsetLabel->setText(QApplication::translate("DTSettings", "Offset Value", 0 )); m_pOffsetSpinBox = new QSpinBox(m_pDetectFrame); m_pOffsetSpinBox->setGeometry(QRect(80, 85, 70, 22)); m_pOffsetSpinBox->setMinimum(10); m_pOffsetSpinBox->setMaximum(64); m_pOffsetSpinBox->setProperty("displayIntegerBase", QVariant(10)); m_pWidthLabel = new QLabel(m_pDetectFrame); m_pWidthLabel->setGeometry(QRect(10, 115, 60, 13)); m_pWidthLabel->setText(QApplication::translate("DTSettings", "Width Value", 0)); m_pWidthSpinBox = new QSpinBox(m_pDetectFrame); m_pWidthSpinBox->setGeometry(QRect(80, 110, 70, 22)); m_pWidthSpinBox->setMinimum(100); m_pWidthSpinBox->setMaximum(12000); m_pWidthSpinBox->setSingleStep(100); m_pWidthSpinBox->setProperty("displayIntegerBase", QVariant(10)); m_pGoodPointsLabel = new QLabel(m_pDetectFrame); m_pGoodPointsLabel->setGeometry(QRect(10, 140, 60, 13)); m_pGoodPointsLabel->setText(QApplication::translate("DTSettings", "Good Points", 0)); m_pGoodPointsSpinBox = new QSpinBox(m_pDetectFrame); m_pGoodPointsSpinBox->setGeometry(QRect(80, 135, 70, 22)); m_pGoodPointsSpinBox->setMinimum(4); m_pGoodPointsSpinBox->setMaximum(24); //m_pMGoodPointsSpinBox->setSingleStep(1); m_pGoodPointsSpinBox->setProperty("displayIntegerBase", QVariant(10)); m_pSunBitFiltering = new QCheckBox("Sun Bit Filtering", m_pDetectFrame ); m_pSunBitFiltering->setGeometry(QRect(10, 155, 140, 32)); m_pButtonCmdApplyDetectionSettings = new QPushButton(m_pDetectFrame); m_pButtonCmdApplyDetectionSettings->setGeometry(QRect(10, 185, 140, 32)); m_pButtonCmdApplyDetectionSettings->setText(QApplication::translate("DTSettings", "Apply Settings", 0)); m_pButtonCmdApplyDetectionSettings->setIcon( QIcon(":pictures/appbar.repeat.png")); m_pButtonCmdApplyDetectionSettings->setIconSize(QSize(32,32)); m_pButtonCmdApplyDetectionSettings->setStyleSheet(QStringLiteral("Text-align:left")); m_pButtonCmdFullReset = new QPushButton(m_pDetectFrame); m_pButtonCmdFullReset->setGeometry(QRect(10, 220, 140, 32)); m_pButtonCmdFullReset->setText(QApplication::translate("DTSettings", "Full Reset", 0)); m_pButtonCmdFullReset->setIcon( QIcon(":pictures/appbar.reset.png")); m_pButtonCmdFullReset->setIconSize(QSize(32,32)); m_pButtonCmdFullReset->setStyleSheet("Text-align:left"); connect( m_pButtonCmdFullReset, &QPushButton::clicked, this, &DialogSettingsLGS::onFullReset ); /* End of Master detection settings Frame */ /* Begin of Master hardware settings Frame */ m_pHardwareGroupBox = new QGroupBox(this); m_pHardwareGroupBox->setGeometry(QRect(517, 0, 198, 680 )); m_pHardwareGroupBox->setTitle(QApplication::translate("DTSettings", "Hardware Control", 0)); QVBoxLayout *tVLayout; tVLayout = new QVBoxLayout(m_pHardwareGroupBox); tVLayout->setContentsMargins(5,0,5,0); tVLayout->setSpacing(3); m_pHWGeneralFrame = new QFrame(m_pHardwareGroupBox); m_pHWGeneralFrame->setFixedSize( 185, 90 ); //m_pHWGeneralFrame->setGeometry(QRect(10, 20, 185, 90 )); m_pHWGeneralFrame->setFrameShape(QFrame::Box); m_pHWGeneralFrame->setFrameShadow(QFrame::Raised); tVLayout->addWidget( m_pHWGeneralFrame ); m_pLrfEnableToggle = new QToolButton(m_pHWGeneralFrame); m_pLrfEnableToggle->setGeometry(QRect(10, 10, 165, 32 )); QIcon icon1; icon1.addFile( QStringLiteral(":pictures/appbar.new.png"), QSize(), QIcon::Normal, QIcon::Off); icon1.addFile( QStringLiteral(":pictures/appbar.laser.png"), QSize(), QIcon::Normal, QIcon::On); m_pLrfEnableToggle->setIcon(icon1); m_pLrfEnableToggle->setText(QApplication::translate("DTSettings", "Laser Beam", 0)); m_pLrfEnableToggle->setIconSize(QSize(32, 32)); m_pLrfEnableToggle->setCheckable(true); m_pLrfEnableToggle->setChecked(false); m_pLrfEnableToggle->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); m_pLrfEnableToggle->setStyleSheet("Text-align:left"); connect(m_pLrfEnableToggle, &QToolButton::clicked, this, &DialogSettingsLGS::onEnableBeam); m_pMotorsEnableToggle = new QToolButton(m_pHWGeneralFrame); m_pMotorsEnableToggle->setGeometry(QRect(10, 50, 165, 32 )); QIcon icon2; icon2.addFile( QStringLiteral(":pictures/appbar.base.select.png"), QSize(), QIcon::Normal, QIcon::Off); icon2.addFile( QStringLiteral(":pictures/appbar.base.png"), QSize(), QIcon::Normal, QIcon::On); m_pMotorsEnableToggle->setIcon(icon2); m_pMotorsEnableToggle->setText(QApplication::translate("DTSettings", "Base/Mirror Run", 0)); m_pMotorsEnableToggle->setIconSize(QSize(32, 32)); m_pMotorsEnableToggle->setCheckable(true); m_pMotorsEnableToggle->setChecked(false); m_pMotorsEnableToggle->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); m_pMotorsEnableToggle->setStyleSheet("Text-align:left"); connect(m_pMotorsEnableToggle, &QToolButton::clicked, this, &DialogSettingsLGS::onEnableMotors); m_pHWShiftFrame = new QFrame(m_pHardwareGroupBox); m_pHWShiftFrame->setFixedSize( 185, 55 ); m_pHWShiftFrame->setFrameShape(QFrame::Box); m_pHWShiftFrame->setFrameShadow(QFrame::Raised); tVLayout->addWidget( m_pHWShiftFrame ); m_pQ_ShiftLabel = new QLabel("Mirror Shift:", m_pHWShiftFrame); m_pQ_ShiftLabel->setGeometry(QRect(20, 5, 60, 22)); m_pQ_ShiftSpinBox = new QSpinBox(m_pHWShiftFrame); m_pQ_ShiftSpinBox->setGeometry(QRect(100, 5, 60, 22)); m_pQ_ShiftSpinBox->setMinimum(0); m_pQ_ShiftSpinBox->setMaximum(287); m_pQ_ShiftSpinBox->setSingleStep(1); connect(m_pQ_ShiftSpinBox, static_cast(&QSpinBox::valueChanged), this, &DialogSettingsLGS::onUpdateQMotorSpinBox); m_pB_ShiftLabel = new QLabel("Base Shift:", m_pHWShiftFrame); m_pB_ShiftLabel->setGeometry(QRect(20, 30, 60, 22)); m_pB_ShiftSpinBox = new QSpinBox(m_pHWShiftFrame); m_pB_ShiftSpinBox->setGeometry(QRect(100, 30, 60, 22)); m_pB_ShiftSpinBox->setMinimum(0); m_pB_ShiftSpinBox->setMaximum(2303); m_pB_ShiftSpinBox->setSingleStep(1); connect(m_pB_ShiftSpinBox, static_cast(&QSpinBox::valueChanged), this, &DialogSettingsLGS::onUpdateQMotorSpinBox); m_pHWMotorFrame = new QFrame(m_pHardwareGroupBox); m_pHWMotorFrame->setFixedSize( 185, 70 ); //m_pHWMotorFrame->setGeometry(QRect(10, 114, 185, 80 )); m_pHWMotorFrame->setFrameShape(QFrame::Box); m_pHWMotorFrame->setFrameShadow(QFrame::Raised); tVLayout->addWidget( m_pHWMotorFrame ); m_pNoMotorCtrl = new QRadioButton(m_pHWMotorFrame); m_pNoMotorCtrl->setGeometry(QRect(10, 5, 165, 18 )); m_pNoMotorCtrl->setIcon(QIcon(":pictures/appbar.cog.png")); m_pNoMotorCtrl->setText(QApplication::translate("DTSettings", "No Motor Controll", 0)); m_pPwmMotorCtrl = new QRadioButton(m_pHWMotorFrame); m_pPwmMotorCtrl->setGeometry(QRect(10, 25, 165, 18 )); m_pPwmMotorCtrl->setIcon(QIcon(":pictures/appbar.cog.png")); m_pPwmMotorCtrl->setText(QApplication::translate("DTSettings", "PWM Motor Controll", 0)); m_pTgzMotorCtrl = new QRadioButton(m_pHWMotorFrame); m_pTgzMotorCtrl->setGeometry(QRect(10, 45, 165, 18 )); m_pTgzMotorCtrl->setIcon(QIcon(":pictures/appbar.cog.png")); m_pTgzMotorCtrl->setText(QApplication::translate("DTSettings", "TGZ Motor Controll", 0)); connect(m_pNoMotorCtrl, &QRadioButton::clicked, this, &DialogSettingsLGS::onRadioNoMotors); connect(m_pPwmMotorCtrl, &QRadioButton::clicked, this, &DialogSettingsLGS::onRadioPwmMotors); connect(m_pTgzMotorCtrl, &QRadioButton::clicked, this, &DialogSettingsLGS::onRadioTgzMotors); m_pHWPwmFrame = new QFrame(m_pHardwareGroupBox); m_pHWPwmFrame->setFixedSize( 185, 110 ); //m_pHWPwmFrame->setGeometry(QRect(10, 200, 185, 110)); m_pHWPwmFrame->setFrameShape(QFrame::Box); m_pHWPwmFrame->setFrameShadow(QFrame::Raised); tVLayout->addWidget( m_pHWPwmFrame ); QLabel *tLab1 = new QLabel("Mirror Block Encoder Frequency", m_pHWPwmFrame); tLab1->setGeometry(QRect(20, 5, 160, 15)); m_pQMotorFreqLabel = new QLabel("Hertz:", m_pHWPwmFrame); m_pQMotorFreqLabel->setGeometry(QRect(20, 25, 30, 22)); m_pQMotorFreqSpinBox = new QSpinBox(m_pHWPwmFrame); m_pQMotorFreqSpinBox->setGeometry(QRect(55, 25, 100, 22)); m_pQMotorFreqSpinBox->setMinimum(3000); m_pQMotorFreqSpinBox->setMaximum(80000); m_pQMotorFreqSpinBox->setSingleStep(100); connect( m_pQMotorFreqSpinBox, static_cast(&QSpinBox::valueChanged) , this, &DialogSettingsLGS::onUpdateQMotorSpinBox ); QLabel *tLab2 = new QLabel("Base Block Encoder Frequency", m_pHWPwmFrame); tLab2->setGeometry(QRect(20, 53, 160, 15)); m_pBMotorFreqLabel = new QLabel("Hertz:", m_pHWPwmFrame); m_pBMotorFreqLabel->setGeometry(QRect(20, 75, 30, 22)); m_pBMotorFreqSpinBox = new QSpinBox(m_pHWPwmFrame); m_pBMotorFreqSpinBox->setGeometry(QRect(55, 75, 100, 22)); m_pBMotorFreqSpinBox->setMinimum(1000); m_pBMotorFreqSpinBox->setMaximum(200000); m_pBMotorFreqSpinBox->setSingleStep(100); connect(m_pBMotorFreqSpinBox, static_cast(&QSpinBox::valueChanged), this, &DialogSettingsLGS::onUpdateBMotorSpinBox); m_pHWTgzFrame = new QFrame(m_pHardwareGroupBox); m_pHWTgzFrame->setFixedSize( 185, 200 ); //m_pHWTgzFrame->setGeometry(QRect(10, 315, 185, 139)); m_pHWTgzFrame->setFrameShape(QFrame::Box); m_pHWTgzFrame->setFrameShadow(QFrame::Raised); tVLayout->addWidget( m_pHWTgzFrame ); QLabel *tLab3 = new QLabel("CAN Bus Communication Settings", m_pHWTgzFrame); tLab3->setGeometry(QRect(15, 5, 160, 15)); m_pTGZ_CanBusID = new QLabel("CAN Bus ID:", m_pHWTgzFrame); m_pTGZ_CanBusID->setGeometry(QRect(20, 25, 80, 15)); m_pTGZ_CanBusIDSpinBox = new QSpinBox(m_pHWTgzFrame); m_pTGZ_CanBusIDSpinBox->setGeometry(QRect(90, 25, 60, 22)); m_pTGZ_CanBusIDSpinBox->setMinimum(0); m_pTGZ_CanBusIDSpinBox->setMaximum(255); m_pTGZ_CanBusIDSpinBox->setSingleStep(1); m_pTGZ_CanHHID = new QLabel("CAN Host ID:", m_pHWTgzFrame); m_pTGZ_CanHHID->setGeometry(QRect(20, 45, 80, 15)); m_pTGZ_CanHHIDSpinBox = new QSpinBox(m_pHWTgzFrame); m_pTGZ_CanHHIDSpinBox->setGeometry(QRect(90, 50, 60, 22)); m_pTGZ_CanHHIDSpinBox->setMinimum(0); m_pTGZ_CanHHIDSpinBox->setMaximum(65535); m_pTGZ_CanHHIDSpinBox->setSingleStep(1); m_pTGZ_CanDDID = new QLabel("CAN TGZ ID:", m_pHWTgzFrame); m_pTGZ_CanDDID->setGeometry(QRect(20, 65, 80, 15)); m_pTGZ_CanDDIDSpinBox = new QSpinBox(m_pHWTgzFrame); m_pTGZ_CanDDIDSpinBox->setGeometry(QRect(90, 75, 60, 22)); m_pTGZ_CanDDIDSpinBox->setMinimum(0); m_pTGZ_CanDDIDSpinBox->setMaximum(65535); m_pTGZ_CanDDIDSpinBox->setSingleStep(1); QLabel *tLab4 = new QLabel("TGZ Controller Settings", m_pHWTgzFrame); tLab4->setGeometry(QRect(35, 100, 160, 15)); m_pTGZ_ParamA = new QLabel("TGZ Param A:", m_pHWTgzFrame); m_pTGZ_ParamA->setGeometry(QRect(20, 120, 80, 15)); m_pTGZ_ParamASpinBox= new QSpinBox(m_pHWTgzFrame); m_pTGZ_ParamASpinBox->setGeometry(QRect(90, 120, 60, 22)); m_pTGZ_ParamASpinBox->setMinimum(0); m_pTGZ_ParamASpinBox->setMaximum(65535); m_pTGZ_ParamASpinBox->setSingleStep(1); m_pTGZ_ParamB = new QLabel("TGZ Param B:", m_pHWTgzFrame); m_pTGZ_ParamB->setGeometry(QRect(20, 145, 80, 15)); m_pTGZ_ParamBSpinBox= new QSpinBox(m_pHWTgzFrame); m_pTGZ_ParamBSpinBox->setGeometry(QRect(90, 145, 60, 22)); m_pTGZ_ParamBSpinBox->setMinimum(0); m_pTGZ_ParamBSpinBox->setMaximum(65535); m_pTGZ_ParamBSpinBox->setSingleStep(1); m_pTGZ_ParamC = new QLabel("TGZ Param C:", m_pHWTgzFrame); m_pTGZ_ParamC->setGeometry(QRect(20, 170, 80, 15)); m_pTGZ_ParamCSpinBox= new QSpinBox(m_pHWTgzFrame); m_pTGZ_ParamCSpinBox->setGeometry(QRect(90, 170, 60, 22)); m_pTGZ_ParamCSpinBox->setMinimum(0); m_pTGZ_ParamCSpinBox->setMaximum(65535); m_pTGZ_ParamCSpinBox->setSingleStep(1); m_pHWSeashoreFrame = new QFrame(m_pHardwareGroupBox); m_pHWSeashoreFrame->setFixedSize( 185, 55 ); //m_pHWSeashoreFrame->setGeometry(QRect(10, 490, 185, 139)); m_pHWSeashoreFrame->setFrameShape(QFrame::Box); m_pHWSeashoreFrame->setFrameShadow(QFrame::Raised); tVLayout->addWidget( m_pHWSeashoreFrame ); m_pSeashoreCheckBox = new QCheckBox("SafeShore Server Enabled", m_pHWSeashoreFrame ); m_pSeashoreCheckBox->setGeometry(20, 5, 150, 22); m_pSeashoreIP4Address = new QLineEdit( m_pHWSeashoreFrame ); m_pSeashoreIP4Address->setGeometry(20, 25, 100, 22); m_pSeashoreIP4Port = new QLineEdit( m_pHWSeashoreFrame ); m_pSeashoreIP4Port->setGeometry(123, 25, 40, 22); m_pButtonCmdApplyMotorSettings = new QPushButton( m_pHardwareGroupBox ); m_pButtonCmdApplyMotorSettings->setFixedSize(185, 32 ); //m_pButtonCmdApplyMotorSettings->setGeometry(QRect(10, 410, 165, 32)); m_pButtonCmdApplyMotorSettings->setIcon(QIcon(":pictures/appbar.transit.hazard.png")); m_pButtonCmdApplyMotorSettings->setIconSize(QSize(32, 32)); m_pButtonCmdApplyMotorSettings->setText(QApplication::translate("DTSettings", "Apply Settings", 0)); connect( m_pButtonCmdApplyMotorSettings, &QPushButton::clicked, this, &DialogSettingsLGS::onUpdateDevice ); tVLayout->addWidget( m_pButtonCmdApplyMotorSettings ); // End of Master Settings Group m_pConPosGroupBox = new QGroupBox( this ); m_pConPosGroupBox->setGeometry(QRect(6, 285, 512, 450)); m_pConPosGroupBox->setTitle(QApplication::translate("DTSettings", "Sensor Position/Connection", 0)); // Map Controll m_pMapControl = new MapControl( QSize(490, 300), MapControl::Panning, true, true, m_pConPosGroupBox ); m_pMapAdapter = new OSMMapAdapter(); m_pMapLayer = new MapLayer("Custom Layer", m_pMapAdapter); m_pMapControl->addLayer( m_pMapLayer ); m_pMapControl->setView(QPointF(35.095117, 32.904578)); m_pMapControl->setZoom(22); m_pMapControl->setGeometry(10, 20, 490, 300); //m_pMapControl->enablePersistentCache(QDir()); connect( m_pMapControl, &MapControl::viewChanged, this, &DialogSettingsLGS::onMapChanged ); // POSITION GROUP m_pPositionGroupBox = new QGroupBox(m_pConPosGroupBox); m_pPositionGroupBox->setGeometry(QRect(8, 320, 300, 124)); m_pPositionGroupBox->setTitle(QApplication::translate("DTSettings", "Position", 0)); m_pPosByWGS84 = new QRadioButton("Absolute by WGS84", m_pPositionGroupBox ); m_pPosByWGS84->setGeometry(QRect(10, 20, 115, 13)); m_pPosByWGS84->setChecked( true ); m_pPosByMeters = new QRadioButton("Delta from Main Anchor", m_pPositionGroupBox ); m_pPosByMeters->setGeometry(QRect(130, 20, 130, 13)); connect(m_pPosByWGS84, &QRadioButton::clicked, this, &DialogSettingsLGS::onPositionWGS84); connect(m_pPosByMeters, &QRadioButton::clicked, this, &DialogSettingsLGS::onPositionMeters); m_pLonLabel = new QLabel(m_pPositionGroupBox); m_pLonLabel->setGeometry(QRect(10, 45, 25, 13)); m_pLonLabel->setText(QApplication::translate("DTSettings", "Lon:", 0)); m_pLongitude = new QDoubleSpinBox(m_pPositionGroupBox); m_pLongitude->setGeometry(QRect(35, 40, 75, 22)); m_pLongitude->setDecimals(6); m_pLongitude->setMinimum(-99.0); m_pLongitude->setMaximum(99.0); m_pLongitude->setSingleStep(1e-05); m_pLongitude->setValue(35.095117); connect(m_pLongitude, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogSettingsLGS::onPositionLonChange); m_pLatLabel = new QLabel(m_pPositionGroupBox); m_pLatLabel->setGeometry(QRect(115, 45, 25, 13)); m_pLatLabel->setText(QApplication::translate("DTSettings", "Lat:", 0)); m_pLatitude = new QDoubleSpinBox(m_pPositionGroupBox); m_pLatitude->setGeometry(QRect(138, 40, 75, 22)); m_pLatitude->setDecimals(6); m_pLatitude->setMinimum(-99); m_pLatitude->setSingleStep(1e-05); m_pLatitude->setValue(32.904578); connect(m_pLatitude, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogSettingsLGS::onPositionLatChange); m_pAltLabel = new QLabel(m_pPositionGroupBox); m_pAltLabel->setGeometry(QRect(220, 45, 25, 13)); m_pAltLabel->setText(QApplication::translate("DTSettings", "Alt:", 0)); m_pAltitude = new QDoubleSpinBox(m_pPositionGroupBox); m_pAltitude->setGeometry(QRect(240, 40, 50, 22)); m_pAltitude->setDecimals(2); m_pAltitude->setMinimum(-99); m_pAltitude->setSingleStep(0.01); m_pAltitude->setValue(18.0); connect(m_pAltitude, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogSettingsLGS::onPositionAltChange); /* Orientation */ m_pYawLabel = new QLabel(m_pPositionGroupBox); m_pYawLabel->setGeometry(QRect(10, 70, 25, 13)); m_pYawLabel->setText(QApplication::translate("DTSettings", "Yaw:", 0)); m_pYaw = new QDoubleSpinBox(m_pPositionGroupBox); m_pYaw->setGeometry(QRect(35, 65, 60, 22)); m_pYaw->setDecimals(3); m_pYaw->setMinimum(-99); m_pYaw->setSingleStep(1e-03); m_pYaw->setValue(0.0); connect(m_pYaw, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogSettingsLGS::onOrientationYawChange); m_pRollLabel = new QLabel(m_pPositionGroupBox); m_pRollLabel->setGeometry(QRect(115, 70, 25, 13)); m_pRollLabel->setText(QApplication::translate("DTSettings", "Roll:", 0)); m_pRoll = new QDoubleSpinBox(m_pPositionGroupBox); m_pRoll->setGeometry(QRect(138, 65, 60, 22)); m_pRoll->setDecimals(3); m_pRoll->setMinimum(-99); m_pRoll->setSingleStep(1e-03); m_pRoll->setValue(0.0); connect(m_pRoll, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogSettingsLGS::onOrientationRollChange); m_pPitchLabel = new QLabel(m_pPositionGroupBox); m_pPitchLabel->setGeometry(QRect(220, 70, 25, 13)); m_pPitchLabel->setText(QApplication::translate("DTSettings", "Pitch:", 0)); m_pPitch = new QDoubleSpinBox(m_pPositionGroupBox); m_pPitch->setGeometry(QRect(240, 65, 50, 22)); m_pPitch->setDecimals(3); m_pPitch->setMinimum(-99); m_pPitch->setSingleStep(1e-03); m_pPitch->setValue(0.0); connect(m_pPitch, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogSettingsLGS::onOrientationPitchChange); m_pButtonCmdSetToMainAnchore = new QPushButton(m_pPositionGroupBox); m_pButtonCmdSetToMainAnchore->setGeometry(QRect(10, 90, 32, 32)); m_pButtonCmdSetToMainAnchore->setIcon(QIcon(":pictures/appbar.centerline.png")); m_pButtonCmdSetToMainAnchore->setIconSize(QSize(32, 32)); //m_pButtonCmdSetToMainAnchore->setText(""); connect(m_pButtonCmdSetToMainAnchore, &QPushButton::clicked, this, &DialogSettingsLGS::setPositionSystemAnchor); m_pButtonCmdSetPosition = new QPushButton(m_pPositionGroupBox); m_pButtonCmdSetPosition->setGeometry(QRect(50, 90, 100, 32)); m_pButtonCmdSetPosition->setIcon(QIcon(":pictures/appbar.map.treasure.png")); m_pButtonCmdSetPosition->setIconSize(QSize(32, 32)); m_pButtonCmdSetPosition->setText(QApplication::translate("DTSettings", "Set Position", 0)); connect(m_pButtonCmdSetPosition, &QPushButton::clicked, this, &DialogSettingsLGS::onSetPosition); // Connection m_pConmunicationGroupBox = new QGroupBox(m_pConPosGroupBox); //517, 0, 210, 700 m_pConmunicationGroupBox->setGeometry(QRect(315, 320, 210, 124)); //m_pConmunicationGroupBox->setFixedSize(185, 120); m_pConmunicationGroupBox->setTitle(QApplication::translate("DTSettings", "Connection", 0)); m_pIP4Address = new QLineEdit(m_pConmunicationGroupBox); m_pIP4Address->setGeometry(QRect(20, 20, 113, 20)); m_pIP4Address->setMaxLength(15); m_pIP4Address->setPlaceholderText(QApplication::translate("DTSettings", "IP4 Address", 0)); m_pIP4Port = new QLineEdit(m_pConmunicationGroupBox); m_pIP4Port->setGeometry(QRect(135, 20, 40, 20)); m_pIP4Port->setMaxLength(5); m_pIP4Port->setPlaceholderText(QApplication::translate("DTSettings", "Port", 0)); m_pButtonCmdSetConnection = new QPushButton(m_pConmunicationGroupBox); m_pButtonCmdSetConnection->setGeometry(QRect(20, 45, 165, 32)); m_pButtonCmdSetConnection->setIcon(QIcon(":pictures/appbar.calendar.tomorrow.png")); m_pButtonCmdSetConnection->setIconSize(QSize(32, 32)); m_pButtonCmdSetConnection->setText(QApplication::translate("DTSettings", "Apply Settings", 0)); connect(m_pButtonCmdSetConnection, &QPushButton::clicked, this, &DialogSettingsLGS::onSetCommunication); m_pButtonCmdRemoveDevice = new QPushButton(m_pConmunicationGroupBox); m_pButtonCmdRemoveDevice->setGeometry(QRect(20, 80, 165, 32)); m_pButtonCmdRemoveDevice->setIcon(QIcon(":pictures/appbar.delete.png")); m_pButtonCmdRemoveDevice->setIconSize(QSize(32, 32)); m_pButtonCmdRemoveDevice->setText(QApplication::translate("DTSettings", "Remove Device", 0)); connect(m_pButtonCmdRemoveDevice, &QPushButton::clicked, this, &DialogSettingsLGS::onSetCommunication); /* Status Bar */ //m_pStatusBar = new QStatusBar(this); //m_pStatusBar->setObjectName(QStringLiteral("statusBar")); //m_pStatusBar->setStyleSheet(QStringLiteral("background-color: rgb(255, 170, 0);")); //m_pProgressBar = new QProgressBar(m_pStatusBar); //m_pProgressBar->setGeometry(QRect(10, 2, 118, 16)); //m_pProgressBar->setValue(100); //m_pProgressBar->setEnabled(false); //setStatusBar(m_pStatusBar); }; DialogSettingsLGS::~DialogSettingsLGS(){ delete(m_pFlipLabel); }; void DialogSettingsLGS::attachDevice(objectLGS *ptr){ m_pDevice = ptr; if( m_pDevice != NULL ){ // Enable Master Controls //m_pGroupBox->setEnabled(true); m_pPositionGroupBox->setEnabled(true); m_pMapControl->setEnabled(true); } else { //m_pGroupBox->setEnabled(false); }; }; void DialogSettingsLGS::onUpdateQMotorSpinBox( int value ){ //m_pQMotorFreq->setValue( ( value - m_pQMotorFreqSpinBox->minimum() ) * 100.0 / (m_pQMotorFreqSpinBox->maximum() - m_pQMotorFreqSpinBox->minimum()) ); }; void DialogSettingsLGS::onUpdateBMotorSpinBox(int value){ //m_pBMotorFreq->setValue((value - m_pBMotorFreqSpinBox->minimum()) * 100.0 / (m_pBMotorFreqSpinBox->maximum() - m_pBMotorFreqSpinBox->minimum())); }; void DialogSettingsLGS::onBMotorControlClicked(void){ //if (m_pBMotorCheckBox->checkState()){ //m_pBMotorFreq->setEnabled(true); m_pBMotorFreqSpinBox->setEnabled(true); //} else { // m_pBMotorFreq->setEnabled(false); // m_pBMotorFreqSpinBox->setEnabled(false); //}; }; void DialogSettingsLGS::onQMotorControlClicked(void){ //if (m_pQMotorCheckBox->checkState()){ //m_pQMotorFreq->setEnabled(true); m_pQMotorFreqSpinBox->setEnabled(true); //} else { // m_pQMotorFreq->setEnabled(false); // m_pQMotorFreqSpinBox->setEnabled(false); //}; }; void DialogSettingsLGS::onSetCommunication(void){ if (m_pDevice != NULL){ char tBuf[64]; int tPort; sprintf(tBuf, "%s", m_pIP4Address->text().toStdString().c_str()); m_pDevice->setHost(tBuf); tPort = atoi(m_pIP4Port->text().toStdString().c_str()); m_pDevice->setPort(tPort); m_pDevice->updateSettings(); }; }; void DialogSettingsLGS::onFullReset(void){ if( m_pDevice != NULL ){ m_pDevice->startDeviceReset( true ); }; }; void DialogSettingsLGS::onRadioNoMotors(void){ m_pMotorsEnableToggle->setEnabled( false ); m_pHWPwmFrame->setEnabled( false ); m_pHWTgzFrame->setEnabled( false ); m_pHWSeashoreFrame->setEnabled( false ); }; void DialogSettingsLGS::onRadioPwmMotors(void){ m_pMotorsEnableToggle->setEnabled( true ); m_pHWPwmFrame->setEnabled( true ); m_pHWTgzFrame->setEnabled( false ); m_pHWSeashoreFrame->setEnabled( false ); }; void DialogSettingsLGS::onRadioTgzMotors(void){ m_pMotorsEnableToggle->setEnabled( true ); m_pHWPwmFrame->setEnabled( false ); m_pHWTgzFrame->setEnabled( true ); m_pHWSeashoreFrame->setEnabled( true ); }; void DialogSettingsLGS::onEnableBeam(void){ if( m_pLrfEnableToggle->isChecked() ){ QMessageBox *msgBox = new QMessageBox(this); msgBox->setText("Are you sure to turn on laser beam?"); msgBox->setWindowModality(Qt::NonModal); msgBox->setWindowTitle("Turn On Laser Beam"); msgBox->setFixedSize(400, 200); msgBox->setInformativeText("Be sure that all motors are running!"); msgBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel ); msgBox->setDefaultButton(QMessageBox::Cancel); int ret = msgBox->exec(); if (ret == QMessageBox::Ok){ //m_pDevice->startBeam(); } else { m_pLrfEnableToggle->setChecked(false); }; } else { QMessageBox *msgBox = new QMessageBox(this); msgBox->setText("Are you sure to turn off laser beam?"); msgBox->setWindowModality(Qt::NonModal); msgBox->setWindowTitle("Turn Off Laser Beam"); msgBox->setFixedSize(400, 200); msgBox->setInformativeText("This will make stop the detection process."); msgBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox->setDefaultButton(QMessageBox::Cancel); int ret = msgBox->exec(); if (ret == QMessageBox::Ok){ //m_pDevice->stopBeam(); } else { m_pLrfEnableToggle->setChecked(true); }; }; }; void DialogSettingsLGS::onEnableMotors(void){ if (m_pMotorsEnableToggle->isChecked()){ QMessageBox *msgBox = new QMessageBox(this); msgBox->setText("Are you sure to turn on motors?"); msgBox->setWindowModality(Qt::NonModal); msgBox->setWindowTitle("Turn On Motors"); msgBox->setFixedSize(400, 200); msgBox->setInformativeText("Be sure that all parameters are correct and device is not blocked."); msgBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel ); msgBox->setDefaultButton(QMessageBox::Cancel); int ret = msgBox->exec(); if (ret == QMessageBox::Ok){ m_pDevice->startStartMotors(); } else { m_pMotorsEnableToggle->setChecked(false); }; } else { QMessageBox *msgBox = new QMessageBox(this); msgBox->setText("Are you sure to turn off motors?"); msgBox->setWindowModality(Qt::NonModal); msgBox->setWindowTitle("Turn Off Motors"); msgBox->setFixedSize(400, 200); msgBox->setInformativeText("This will make stop the detection process."); msgBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox->setDefaultButton(QMessageBox::Cancel); int ret = msgBox->exec(); if (ret == QMessageBox::Ok){ m_pDevice->startStopMotors(); } else { m_pMotorsEnableToggle->setChecked(true); }; }; }; void DialogSettingsLGS::onMapChanged(const QPointF &coordinate, int zoom){ if (m_bRBlocker)return; m_bRBlocker = true; m_tPosition.setPositionWGS84(coordinate.y(), coordinate.x(), m_tPosition.getAlt()); if (m_pPosByWGS84->isChecked()){ m_pLatitude->setValue(m_tPosition.getLat()); m_pLongitude->setValue(m_tPosition.getLon()); } else { m_pLatitude->setValue(m_tPosition.getY() - systemAnchor::getInstance()->getY()); m_pAltitude->setValue(m_tPosition.getZ() - systemAnchor::getInstance()->getZ()); }; m_bRBlocker = false; }; void DialogSettingsLGS::onPositionLonChange(double value){ if (m_bRBlocker)return; m_bRBlocker = true; if (m_pPosByWGS84->isChecked()){ m_tPosition.setPositionWGS84(m_tPosition.getLat(), value, m_tPosition.getAlt()); } else { m_tPosition.setPositionXYZ(systemAnchor::getInstance()->getX() + value, m_tPosition.getY(), m_tPosition.getZ(), systemAnchor::getInstance()->getUTMZone()); }; m_pMapControl->setView(QPointF(m_tPosition.getLon(), m_tPosition.getLat())); m_bRBlocker = false; }; void DialogSettingsLGS::onPositionLatChange(double value){ if (m_bRBlocker)return; m_bRBlocker = true; if (m_pPosByWGS84->isChecked()){ m_tPosition.setPositionWGS84(value, m_tPosition.getLon(), m_tPosition.getAlt()); } else { m_tPosition.setPositionXYZ(m_tPosition.getX(), systemAnchor::getInstance()->getY() + value, m_tPosition.getZ(), systemAnchor::getInstance()->getUTMZone()); }; m_pMapControl->setView(QPointF(m_tPosition.getLon(), m_tPosition.getLat())); m_bRBlocker = false; }; void DialogSettingsLGS::onPositionAltChange(double value){ if (m_bRBlocker)return; m_bRBlocker = true; if (m_pPosByWGS84->isChecked()){ m_tPosition.setPositionWGS84(m_tPosition.getLat(), m_tPosition.getLon(), value); } else { m_tPosition.setPositionXYZ(m_tPosition.getX(), m_tPosition.getY(), systemAnchor::getInstance()->getZ() + value, systemAnchor::getInstance()->getUTMZone()); }; m_bRBlocker = false; }; void DialogSettingsLGS::onOrientationRollChange(double value){ if (m_bRBlocker)return; m_bRBlocker = true; m_tPosition.setOrientationDeg(m_tPosition.getRotX_deg(), value, m_tPosition.getRotZ_deg()); m_bRBlocker = false; }; void DialogSettingsLGS::onOrientationPitchChange(double value){ if (m_bRBlocker)return; m_bRBlocker = true; m_tPosition.setOrientationDeg(value, m_tPosition.getRotY_deg(), m_tPosition.getRotZ_deg()); m_bRBlocker = false; }; void DialogSettingsLGS::onOrientationYawChange(double value){ if (m_bRBlocker)return; m_bRBlocker = true; m_tPosition.setOrientationDeg(m_tPosition.getRotX_deg(), m_tPosition.getRotY_deg(), value); m_bRBlocker = false; }; void DialogSettingsLGS::onSetPosition(void){ m_pDevice->getPosition()->setPositionRad(m_tPosition.getLat(), m_tPosition.getLon(), m_tPosition.getAlt(),m_tPosition.getRotX_rad(), m_tPosition.getRotY_rad(), m_tPosition.getRotZ_rad()); m_pDevice->updateSettings(); }; void DialogSettingsLGS::onPositionWGS84(void){ if (m_bLocationByWGS84) return; m_bLocationByWGS84 = true; m_pLonLabel->setText(QApplication::translate("DTSettings", "Lon:", 0)); m_pLatLabel->setText(QApplication::translate("DTSettings", "Lat:", 0)); m_pAltLabel->setText(QApplication::translate("DTSettings", "Alt:", 0)); if( m_pDevice!= NULL ){ m_bRBlocker = true; m_pLongitude->setDecimals(6); m_pLongitude->setMinimum(-99.0); m_pLongitude->setMaximum(99.0); m_pLongitude->setSingleStep(1e-05); m_pLongitude->setValue(m_tPosition.getLon()); m_pLatitude->setDecimals(6); m_pLatitude->setMinimum(-99.0); m_pLatitude->setMaximum(99.0); m_pLatitude->setSingleStep(1e-05); m_pLatitude->setValue(m_tPosition.getLat()); m_pAltitude->setValue(m_tPosition.getAlt()); //m_pMapControl->setView(QPointF(m_tPosition.getLon(), m_tPosition.getLat())); m_bRBlocker = false; }; }; void DialogSettingsLGS::onPositionMeters(void){ if (!m_bLocationByWGS84)return; m_bLocationByWGS84 = false; m_pLonLabel->setText(QApplication::translate("DTSettings", "X:", 0)); m_pLatLabel->setText(QApplication::translate("DTSettings", "Y:", 0)); m_pAltLabel->setText(QApplication::translate("DTSettings", "Z:", 0)); if( m_pDevice!= NULL ){ m_bRBlocker = true; m_pLongitude->setDecimals(2); m_pLongitude->setMinimum(-1000.0); m_pLongitude->setMaximum(1000.0); m_pLongitude->setSingleStep(1e-02); m_pLongitude->setValue(m_tPosition.getX() - systemAnchor::getInstance()->getX()); m_pLatitude->setDecimals(2); m_pLatitude->setMinimum(-1000.0); m_pLatitude->setMaximum(1000.0); m_pLatitude->setSingleStep(1e-02); m_pLatitude->setValue(m_tPosition.getY() - systemAnchor::getInstance()->getY()); m_pAltitude->setValue(m_tPosition.getZ() - systemAnchor::getInstance()->getZ()); //m_pMapControl->setView(QPointF(m_tPosition.getLon(), m_tPosition.getLat())); m_bRBlocker = false; }; }; void DialogSettingsLGS::setPositionSystemAnchor(void){ m_tPosition.setPositionWGS84(systemAnchor::getInstance()->getLat(), systemAnchor::getInstance()->getLon(), systemAnchor::getInstance()->getAlt()); if( m_pPosByWGS84->isChecked() ){ m_pLatitude->setValue(m_tPosition.getLat()); m_pLongitude->setValue(m_tPosition.getLon()); m_pAltitude->setValue(m_tPosition.getAlt()); } else { m_pLongitude->setValue( 0 ); m_pLatitude->setValue( 0 ); m_pAltitude->setValue( 0 ); }; }; void DialogSettingsLGS::updateValues(){ if( m_pDevice != NULL ){ E_LGS_STAGE tSTG; m_bRBlocker = true; tSTG = m_pDevice->getCurrentSTG(); m_tPosition.setPositionWGS84(m_pDevice->getPosition()->getLat(), m_pDevice->getPosition()->getLon(), m_pDevice->getPosition()->getAlt()); m_tPosition.setOrientationRad(m_pDevice->getPosition()->getRotX_rad(), m_pDevice->getPosition()->getRotY_rad(), m_pDevice->getPosition()->getRotZ_rad()); m_pLatitude->setValue(m_tPosition.getLat()); m_pLongitude->setValue(m_tPosition.getLon()); m_pAltitude->setValue(m_tPosition.getAlt()); m_pPitch->setValue(m_tPosition.getRotX_deg()); m_pRoll->setValue(m_tPosition.getRotY_deg()); m_pYaw->setValue(m_tPosition.getRotZ_deg()); m_pPositionGroupBox->setEnabled(true); m_pMapControl->setEnabled(true); //m_pConnectionCheckBox->setChecked(true); m_pIP4Address->setText(QString(m_pDevice->getHost())); char tBuf[64]; sprintf(tBuf, "%d", m_pDevice->getPort()); m_pIP4Port->setText(QString(tBuf)); char *enabledStyle = "background-color: #00ff00; color: black;"; char *disabledStyle = "background-color: gray; color: black;"; char *abnormalStyle = "background-color: #ff0000; color: yellow;"; if( tSTG >= STG_CONNECTED ){ // Set Compiled Options First SOFTWARE_INFO *tSINFO; tSINFO = m_pDevice->getSoftwareInfo(); if (tSINFO->DATA_VALID){ if((tSINFO->SW_MODE_FLAGS & SW_INFO_FLAG_MASTER) != 0 ){ m_pInfoMaster->setStyleSheet(enabledStyle); if ((tSINFO->SW_MODE_FLAGS & SW_INFO_MOTOR_CTRL_ENA) != 0){ m_pInfoEnaMotorCtrl->setStyleSheet(enabledStyle); m_pMotorsEnableToggle->setEnabled( true ); } else { m_pInfoEnaMotorCtrl->setStyleSheet(disabledStyle); onRadioNoMotors(); //m_pNoMotorCtrl->setChecked( true ); m_pNoMotorCtrl->setEnabled( true ); m_pPwmMotorCtrl->setEnabled( false ); m_pTgzMotorCtrl->setEnabled( false ); }; } else { m_pInfoMaster->setStyleSheet(disabledStyle); if ((tSINFO->SW_MODE_FLAGS & SW_INFO_MOTOR_CTRL_ENA) != 0){ m_pInfoEnaMotorCtrl->setStyleSheet(abnormalStyle); } else { m_pInfoEnaMotorCtrl->setStyleSheet(disabledStyle); }; onRadioNoMotors(); m_pNoMotorCtrl->setEnabled( true ); m_pPwmMotorCtrl->setEnabled( false ); m_pTgzMotorCtrl->setEnabled( false ); //m_pHWMotorFrame->setEnabled( false ); }; if ((tSINFO->SW_MODE_FLAGS & SW_INFO_NO_BLACK_TARGETS) != 0){ m_pInfoNoBlackTargets->setStyleSheet(enabledStyle); } else { m_pInfoNoBlackTargets->setStyleSheet(disabledStyle); }; if ((tSINFO->SW_MODE_FLAGS & SW_INFO_EU_PROJECT) != 0){ m_pInfoEUmode->setStyleSheet(enabledStyle); m_pPwmMotorCtrl->setEnabled( false ); m_pPwmMotorCtrl->setChecked( false ); m_pTgzMotorCtrl->setEnabled( true ); } else { m_pInfoEUmode->setStyleSheet(disabledStyle); m_pTgzMotorCtrl->setEnabled( false ); }; if ((tSINFO->SW_MODE_FLAGS & SW_INFO_TGD_MOTORS) != 0){ m_pInfoTGDmotors->setStyleSheet(enabledStyle); m_pPwmMotorCtrl->setEnabled(false); m_pPwmMotorCtrl->setChecked(false); m_pTgzMotorCtrl->setEnabled(true); } else { m_pInfoTGDmotors->setStyleSheet(disabledStyle); m_pTgzMotorCtrl->setChecked(false); m_pTgzMotorCtrl->setEnabled(false); }; if ((tSINFO->SW_MODE_FLAGS & SW_INFO_DEBUG_MODE) != 0){ m_pInfoDebug->setStyleSheet(enabledStyle); } else { m_pInfoDebug->setStyleSheet(disabledStyle); }; if ((tSINFO->SW_MODE_FLAGS & SW_INFO_NO_TARGET_LOG) != 0){ m_pInfoNoTargetLog->setStyleSheet(enabledStyle); } else { m_pInfoNoTargetLog->setStyleSheet(disabledStyle); }; if ((tSINFO->SW_MODE_FLAGS & SW_INFO_HIBERNATE_ENA) != 0){ m_pInfoEnaHibernate->setStyleSheet(enabledStyle); } else { m_pInfoEnaHibernate->setStyleSheet(disabledStyle); }; if ((tSINFO->SW_MODE_FLAGS & SW_INFO_TGD_VER_2) != 0){ m_pInfoTGDVer2->setStyleSheet(enabledStyle); } else { m_pInfoTGDVer2->setStyleSheet(disabledStyle); }; if ((tSINFO->SW_MODE_FLAGS & SW_INFO_THREAD_FLIP) != 0){ m_pInfoThreadFlips->setStyleSheet(enabledStyle); } else { m_pInfoThreadFlips->setStyleSheet(disabledStyle); } char tBuff[120]; time_t t = tSINFO->SW_BUILD_DATE; struct tm *tm = localtime(&t); strftime(tBuff, sizeof(tBuff), "%Y-%m-%d %H:%M:%S", tm); m_pBuildDate->setText(tBuff); sprintf( tBuff, "0x%X", tSINFO->SW_MODE_FLAGS ); m_pBuildCode->setText( tBuff ); sprintf( tBuff, "%08X\n%08X", tSINFO->FW_CORE1_VER, tSINFO->FW_CORE1_TYP ); m_pPRU0Code->setText( tBuff ); sprintf( tBuff, "%08X\n%08X", tSINFO->FW_CORE2_VER, tSINFO->FW_CORE2_TYP ); m_pPRU1Code->setText( tBuff ); sprintf( tBuff, "%08X\n%08X", tSINFO->FW_CORE3_VER, tSINFO->FW_CORE3_TYP ); m_pPRU2Code->setText( tBuff ); sprintf( tBuff, "%08X\n%08X", tSINFO->FW_CORE4_VER, tSINFO->FW_CORE4_TYP ); m_pPRU3Code->setText( tBuff ); }; // Set Parametric Option second // Enable Master Controls m_pHardwareGroupBox->setEnabled(true); m_pDetectionGroupBox->setEnabled(true); PLGS_PARAMETERS tPARAMS; //m_pProgressBar->setValue(30); tPARAMS = m_pDevice->getSettings(); m_pFlipSpinBox->setValue( tPARAMS->nFlip ); //tPARAMS->nDelta; m_pSSTSpinBox->setValue(tPARAMS->bSST); m_pGoodPointsSpinBox->setValue( tPARAMS->nGPointSamples ); m_pOffsetSpinBox->setValue( tPARAMS->nOffset ); m_pOrderSpinBox->setValue( tPARAMS->nOrder ); m_pSunBitFiltering->setChecked(tPARAMS->flags.Sunbit_filter); m_pQ_ShiftSpinBox->setValue(tPARAMS->flags.Q_shift); m_pB_ShiftSpinBox->setValue(tPARAMS->flags.B_shift); //tPARAMS->nSun; m_pWidthSpinBox->setValue( tPARAMS->nWidth ); m_pLrfEnableToggle->setChecked( tPARAMS->flags.LaserPulsesOn ); m_pQMotorFreqSpinBox->setValue( tPARAMS->flags.VerticalFreq ); m_pBMotorFreqSpinBox->setValue( tPARAMS->flags.HorizontalFreq ); m_pTGZ_CanBusIDSpinBox->setValue( tPARAMS->flags.TGZ_canBus ); m_pTGZ_CanHHIDSpinBox->setValue( tPARAMS->flags.TGZ_canSRC ); m_pTGZ_CanDDIDSpinBox->setValue( tPARAMS->flags.TGZ_canDST ); if( tPARAMS->flags.TGZ_canENA ){ }; if( tPARAMS->flags.LaserPulsesOn ) { m_pLrfEnableToggle->setChecked(true); m_pLrfEnableToggle->setIcon(QIcon(":pictures/appbar.laser.png")); } else { m_pLrfEnableToggle->setChecked(false); m_pLrfEnableToggle->setIcon(QIcon(":pictures/appbar.new.png")); }; if( tPARAMS->flags.AutostartMotors ){ m_pMotorsEnableToggle->setChecked(true); m_pMotorsEnableToggle->setIcon(QIcon(":pictures/appbar.base.png")); } else { m_pMotorsEnableToggle->setChecked(false); m_pMotorsEnableToggle->setIcon(QIcon(":pictures/appbar.base.select.png")); }; if( tPARAMS->flags.HorizontalMotorOn == 0 && tPARAMS->flags.VerticalMotorOn == 0 ){ m_pNoMotorCtrl->setChecked( true ); onRadioNoMotors(); }; } else { m_pInfoMaster->setStyleSheet(disabledStyle); m_pInfoNoBlackTargets->setStyleSheet(disabledStyle); m_pInfoEUmode->setStyleSheet(disabledStyle); m_pInfoTGDmotors->setStyleSheet(disabledStyle); m_pInfoDebug->setStyleSheet(disabledStyle); m_pInfoNoTargetLog->setStyleSheet(disabledStyle); m_pInfoEnaHibernate->setStyleSheet(disabledStyle); m_pInfoEnaMotorCtrl->setStyleSheet(disabledStyle); m_pInfoTGDVer2->setStyleSheet(disabledStyle); m_pInfoThreadFlips->setStyleSheet(disabledStyle); // Disable Controls m_pInfoGroupBox->setEnabled(false); m_pDetectionGroupBox->setEnabled(false); m_pHardwareGroupBox->setEnabled(false); }; }; m_bSettingsAreChanged = false; m_bRBlocker = false; }; void DialogSettingsLGS::onUpdateDevice(void){ if( m_pDevice != NULL ){ E_LGS_STAGE tSTG; tSTG = m_pDevice->getCurrentSTG(); if( tSTG >= STG_CONNECTED ){ // Check Master Controls if( 1 ){//m_pMGroupBox->isEnabled() ){ PLGS_PARAMETERS tPARAMS; tPARAMS = (PLGS_PARAMETERS) malloc(sizeof( LGS_PARAMETERS )); memset( tPARAMS, 0, sizeof( LGS_PARAMETERS )); tPARAMS->nFlip = m_pFlipSpinBox->value(); tPARAMS->nDelta = 0; tPARAMS->bSST = m_pSSTSpinBox->value(); tPARAMS->nGPointSamples = m_pGoodPointsSpinBox->value(); tPARAMS->nOffset = m_pOffsetSpinBox->value(); tPARAMS->nOrder = m_pOrderSpinBox->value(); tPARAMS->nSun = 0; tPARAMS->nWidth = m_pWidthSpinBox->value(); tPARAMS->flags.LaserPulsesOn = m_pLrfEnableToggle->isChecked(); tPARAMS->flags.VerticalMotorOn = 1;// m_pQMotorCheckBox->isChecked(); tPARAMS->flags.HorizontalMotorOn = 1;// m_pBMotorCheckBox->isChecked(); tPARAMS->flags.VerticalFreq = m_pQMotorFreqSpinBox->value(); tPARAMS->flags.HorizontalFreq = m_pBMotorFreqSpinBox->value(); // Send Data to device m_pDevice->setSettings( tPARAMS ); }; }; }; };