diff --git a/CounterVarSet.cpp b/CounterVarSet.cpp index 5fe3b4c..54ad40f 100644 --- a/CounterVarSet.cpp +++ b/CounterVarSet.cpp @@ -11,10 +11,6 @@ CounterVarSet::CounterVarSet(QWidget *parent) : { ui->setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - ui->label_35->hide(); ui->spinBoxdecimalpointnum->hide(); ui->pushButtonVAR->hide(); @@ -38,6 +34,11 @@ void CounterVarSet::init() connect(ui->closeBtn, &QPushButton::clicked, this, &CounterVarSet::buttonClickedSlot); } +void CounterVarSet::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} + void CounterVarSet::bindTxTEdit(QTextEdit* textEdit){ m_textEdit = textEdit; } @@ -178,14 +179,15 @@ void CounterVarSet::applyUIPara(){ sysPara->para.cnt1StartValue = ui->spinBoxCnt1StartValue->value(); sysPara->para.cnt1StepValue = ui->spinBoxCnt1StepValue->value(); sysPara->para.cnt1CurrValue = ui->spinBoxCnt1CurrValue->value(); - sysPara->status.cnt1CurrentValueInitDoneFlag = !ui->checkBoxResetCnt1CurrValue->isChecked(); + sysPara->status.cnt1CurrentValueInitDoneFlag = ui->checkBoxResetCnt1CurrValue->isChecked(); + // sysPara->status.cnt1CurrentValueInitDoneFlag = false; sysPara->para.cnt2EndValue = ui->spinBoxCnt2EndValue->value(); sysPara->para.cnt2RepeateValue = ui->spinBoxCnt2RepeateCnt->value(); sysPara->para.cnt2StartValue = ui->spinBoxCnt2StartValue->value(); sysPara->para.cnt2StepValue = ui->spinBoxCnt2StepValue->value(); sysPara->para.cnt2CurrValue = ui->spinBoxCnt2CurrValue->value(); - sysPara->status.cnt2CurrentValueInitDoneFlag = !ui->checkBoxResetCnt2CurrValue->isChecked(); + sysPara->status.cnt2CurrentValueInitDoneFlag = ui->checkBoxResetCnt2CurrValue->isChecked(); if(ui->eleCNT1IncEn->isChecked()) sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x10); // CNT1 +1 diff --git a/CounterVarSet.h b/CounterVarSet.h index 25b8946..ea06d78 100644 --- a/CounterVarSet.h +++ b/CounterVarSet.h @@ -24,6 +24,8 @@ public: void getValue(int *varType,int *digitalWidth,unsigned char *splitMode); void on_buttonInsertVari_pressed(); + void bindSysPara(SysPara *sysPara); + void bindTxTEdit(QTextEdit* textEdit); QString getFamilyName(int); diff --git a/DateVarSet.cpp b/DateVarSet.cpp index 1409d32..f3a7ae6 100644 --- a/DateVarSet.cpp +++ b/DateVarSet.cpp @@ -14,10 +14,6 @@ DateVarSet::DateVarSet(QWidget *parent) : { ui->setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - digitWidth = 4; varTypeSet = 0; @@ -132,6 +128,10 @@ void DateVarSet::initReplaceValue(){ } +void DateVarSet::bindSysPara(SysPara *sysPara){ + this->sysPara = sysPara; +} + void DateVarSet::buttonClickedSlot() { QPushButton* btn = qobject_cast(sender()); diff --git a/DateVarSet.h b/DateVarSet.h index 22c3779..4cb87de 100644 --- a/DateVarSet.h +++ b/DateVarSet.h @@ -32,7 +32,7 @@ public: void bindSysPara(SysPara *sysPara); -void bindTxTEdit(QTextEdit* textEdit); + void bindTxTEdit(QTextEdit* textEdit); void on_buttonInsertVari_pressed(); diff --git a/DevOp.cpp b/DevOp.cpp index e4a7280..e465364 100644 --- a/DevOp.cpp +++ b/DevOp.cpp @@ -2559,8 +2559,8 @@ int DevOp::writeFpgaPrintPara(bool ignoreWarn){ } } else if(sysPara->status.build_dat.builTime == 73){ + writeDacValue2Fpga_No73(); if(sysPara->status.currVoltageVersion != sysPara->status.lastVoltageVersion){ - writeDacValue2Fpga_No73(); sysPara->status.lastVoltageVersion = sysPara->status.currVoltageVersion; } } @@ -2639,8 +2639,9 @@ int DevOp::writeFpgaPrintPara(bool ignoreWarn){ expected_voltage_DAC += highVoltageStep*(sysPara->para.HighVoltageAmplitude%10)/10; if(!expected_voltage_DAC){ sysPara->para.maxHighVoltageDAC = 0; //为零时,逻辑将忽略所有高压故障 - if(!ignoreWarn) - QMessageBox::warning(NULL,tr("警告"),tr("字高太小或是高压包数据未初始化,您当前错误将忽略所有高压错误")); + if(!ignoreWarn){ + QMessageBox::warning(nullptr, tr("警告"),tr("字高太小或是高压包数据未初始化,您当前错误将忽略所有高压错误")); + } } else sysPara->para.maxHighVoltageDAC = expected_voltage_DAC + sysPara->para.highVoltageLevel; diff --git a/InkJetPrinter.cpp b/InkJetPrinter.cpp index da6a2f0..665d1b0 100644 --- a/InkJetPrinter.cpp +++ b/InkJetPrinter.cpp @@ -19,9 +19,6 @@ static unsigned int PulseCnt = 0; //时间间隔内的脉冲累计数 InkJetPrinter::InkJetPrinter(QWidget* parent) : QWidget(parent) { - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } // 加载.ui文件生成的UI界面 ui.setupUi(this); @@ -158,6 +155,22 @@ void InkJetPrinter::init() m_LogInfo->checkState(); }); + SysPara *para = new SysPara(); + sysPara = para; + m_MainWidget->bindSysPara(para); + m_FontSetWidget->bindSysPara(para); + m_PrintSetting->bindSysPara(para); + m_SystemManage->bindSysPara(para); + m_SystemSetting->bindSysPara(para); + m_OtherInfo->bindSysPara(para); + m_TestPrintWidget->bindSysPara(para); + m_DateVarSet->bindSysPara(para); + m_CounterVarSet->bindSysPara(para); + m_MainInstruction->bindSysPara(para); + m_BarCodeDlg->bindSysPara(para); + m_QRCodeDlg->bindSysPara(para); + m_LogInfo->bindSysPara(para); + if(sysPara->para.gearPumpEnable) pushButtonStartFlag = true; @@ -283,6 +296,7 @@ void InkJetPrinter::init() void InkJetPrinter::slt_editCounter(CounterViewModel vm) { if (m_CounterVarSet) { + m_CounterVarSet->updateSysParaToUI(); m_CounterVarSet->setCounterConfig(vm); m_StackedWidget->setCurrentWidget(m_CounterVarSet); } @@ -699,20 +713,16 @@ void InkJetPrinter::timerHandler(void){ } if(pulse_1s && flagOfSerialThreadStratEn){ + #ifdef ARCH_AARCH64 if (!m_serialThreadFPGA->isRunning()) { qDebug()<<"start FPGA tread"; -#ifdef ARCH_AARCH64 m_serialThreadFPGA->start(); - LogInfo::setRunStatusText(tr("FPGA tread start")); -#endif } if (!m_serialThreadSTM32->isRunning()){ qDebug()<<"start STM32 tread"; -#ifdef ARCH_AARCH64 m_serialThreadSTM32->start(); - LogInfo::setRunStatusText(tr("STM32 tread start")); -#endif - } + } + #endif flagOfSerialThreadStratEn = false; } @@ -815,7 +825,7 @@ void InkJetPrinter::timerHandler(void){ // } if(sysPara->status.isPrinting) { - m_MainWidget->SendPrintDataToFpga(0); + m_MainWidget->SendPrintDataToFpga(0, true); } if(m_StackedWidget->currentWidget() == m_MainWidget) { @@ -873,6 +883,12 @@ void InkJetPrinter::timerHandler(void){ sysPara->devOp->mainInkCtrl(); sysPara->status.canRunAirPushing = true; + // 自检结束发送打印设置 + qInfo() << "Self check done and send print para to FPGA"; + sysPara->devOp->setHighVoltageAmplitudetoSTM32(); + sysPara->devOp->writeFpgaCalandar(0); + sysPara->devOp->writeFpgaPrintPara(); + if(sysPara->para.Reciclar) test_flag = 1; } @@ -945,7 +961,7 @@ void InkJetPrinter::timerHandler(void){ LogInfo::setRunStatusText(QString("jd.addr:%1").arg(addr)); flag6 = false; if (manager_rfid) - manager_rfid->initRFIDMoudle(addr); + manager_rfid->initRFIDMoudle(addr, sysPara); } if(pulse_300ms){ @@ -1360,6 +1376,7 @@ void InkJetPrinter::getTestPrintWidgetButtonClickedSlot(int index) case 9: { + m_PrintSetting->updateSysParaToUI(); m_StackedWidget->setCurrentWidget(m_PrintSetting); break; } @@ -1862,7 +1879,11 @@ void InkJetPrinter::closeSerialFPGA(){ } void InkJetPrinter::closeSerialSTM32(){ + if(m_serialThreadSTM32->isRunning()){ + + LogInfo::setRunStatusText("Closing STM32 serial port and exit thread..."); + m_serialThreadSTM32->requestInterruption(); m_serialThreadSTM32->quit(); m_serialThreadSTM32->wait(); @@ -2327,7 +2348,7 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){ if(sysPara->devOp->isReclaimTankOpenEnable()) sysPara->devOp->controlReclaimTankOpen(false); //到头,关闭 sysPara->status.reclainTankReachEnd = true; -// m_MainWidget->setRunStatus(tr("回收槽到头")); + m_MainWidget->setRunStatus(tr("回收槽到头")); m_MainWidget->setReclaimStatus(true, 100); m_MainWidget->enablePrintButton(true); //仅仅在此时能使能打印按钮 sysPara->devOp->highVoltageCtrl(1); @@ -2750,7 +2771,6 @@ void InkJetPrinter::initRFIDManager() this, &InkJetPrinter::slt_showMsg); connect(manager_rfid,SIGNAL(sig_maintenanceShow()), m_MainInstruction,SLOT(maintenanceDialogShow())); - } } #endif diff --git a/ItemEditor.cpp b/ItemEditor.cpp index f009b9b..5dcee3a 100644 --- a/ItemEditor.cpp +++ b/ItemEditor.cpp @@ -15,6 +15,8 @@ ItemEditor::ItemEditor(QWidget *parent) : gridLayout->setContentsMargins(0, 0, 0, 0); gridLayout->addWidget(m_generalSettings); ui->generalSettingsTab->setLayout(gridLayout); + + ui->okBtn->setMinimumSize(100, 40); } ItemEditor::~ItemEditor() diff --git a/ItemEditor.ui b/ItemEditor.ui index 51a0282..1106983 100644 --- a/ItemEditor.ui +++ b/ItemEditor.ui @@ -35,23 +35,16 @@ 0 - - - - - 0 - 40 - - - - - 16777215 - 40 - - - - background-color:#4E679F; + + + + 0 + + + 整体设置 + + @@ -146,16 +139,23 @@ - - - - 0 + + + + + 0 + 40 + + + + + 16777215 + 40 + + + + background-color:#4E679F; - - - 整体设置 - - diff --git a/LogInfo.cpp b/LogInfo.cpp index ab0166c..e995068 100644 --- a/LogInfo.cpp +++ b/LogInfo.cpp @@ -23,10 +23,6 @@ LogInfo::LogInfo(QWidget *parent) : { ui->setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - ui->textEditRunStatus->setReadOnly(true); ui->textEditRunStatus_2->setReadOnly(true); textEdit = ui->textEditRunStatus; @@ -62,6 +58,10 @@ LogInfo::LogInfo(QWidget *parent) : ui->label_11->setText(tr("齿轮泵转速")); connect(ui->labelFaultResume,SIGNAL(pressed()),this,SIGNAL(faultTesumePress())); + + timerCheckReclaimStatus = new QTimer(this); + connect(timerCheckReclaimStatus, &QTimer::timeout, this, &LogInfo::checkReclaimStatus); + timerCheckReclaimStatus->start(500); } LogInfo::~LogInfo() @@ -514,6 +514,11 @@ void LogInfo::updateSysStatusToUI(const AlarmStatus& alarmStatus){ } +void LogInfo::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} + void LogInfo::checkState() { ui->tabWidget->setCurrentIndex(3); @@ -636,6 +641,22 @@ void LogInfo::slt_cleanOver(bool flag) } } +void LogInfo::checkReclaimStatus() +{ + static bool CleanUPEn=1,preCleanUP=0; + if(!sysPara->para.isCheckMagnet) + { + CleanUPEn = (sysPara->status.currReclaimTankPos<70) && (sysPara->status.statWarn & WARN_STATUS_HDINT); + } + else + { + CleanUPEn = (sysPara->status.currReclaimTankPos<70) ; + } + if(CleanUPEn != preCleanUP){ + ui->btn_clean->setEnabled(CleanUPEn); + } + preCleanUP=CleanUPEn; +} void LogInfo::lockUI() { @@ -664,16 +685,4 @@ void LogInfo::showEvent(QShowEvent *event) // 先执行父类事件 QWidget::showEvent(event); // 更新UI和状态 - if (sysPara) { - if(!sysPara->para.isCheckMagnet) - { - ui->btn_clean->setEnabled( (sysPara->status.currReclaimTankPos<70) - && (sysPara->status.statWarn & WARN_STATUS_HDINT)); - } - else - { - ui->btn_clean->setEnabled( (sysPara->status.currReclaimTankPos<70) ); - } - } - } diff --git a/LogInfo.h b/LogInfo.h index 7e5ea2f..b894678 100644 --- a/LogInfo.h +++ b/LogInfo.h @@ -58,6 +58,7 @@ public: void init(); void applyStyleSheet(); // 应用样式表 + void bindSysPara(SysPara *sysPara); void updateSysStatusToUI(const AlarmStatus& alarmStatus); @@ -80,6 +81,9 @@ private slots: void on_btn_clean_clicked(); void slt_cleanOver(bool flag); + + void checkReclaimStatus(); + signals: void sendButtonClickedSignal(int); void faultTesumePress(); @@ -96,12 +100,14 @@ private: static QString r_CurrentDate; QTimer *timerLogdel; + QTimer *timerCheckReclaimStatus = nullptr; + LogInfoCtrl *ctrl_loginfo = nullptr; // 锁定全局控件,放出逆清洗 void lockUI(); void unlockUI(); protected: - SysPara *sysPara; + SysPara *sysPara = nullptr; void showEvent(QShowEvent *event) override; }; diff --git a/MainInstruction.cpp b/MainInstruction.cpp index f4e36ba..29c251c 100644 --- a/MainInstruction.cpp +++ b/MainInstruction.cpp @@ -11,10 +11,6 @@ MainInstruction::MainInstruction(QWidget *parent) : { ui->setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - m_graphicsEditor = new ZkEdit(); // 连接几个特殊按钮,这些按钮将由外部处理 @@ -68,6 +64,10 @@ MainInstruction::~MainInstruction() delete m_graphicsEditor; } +void MainInstruction::bindSysPara(SysPara *sysPara){ + this->sysPara = sysPara; +} + void MainInstruction::onGraphicsEditBtnClicked() { // 在arm主机上以全屏模式显示,而在x86上无所谓 diff --git a/MainInstruction.h b/MainInstruction.h index 978ac2b..15df646 100644 --- a/MainInstruction.h +++ b/MainInstruction.h @@ -27,6 +27,8 @@ public: ~MainInstruction(); void onSpecialButtonClicked(int btnID); + void bindSysPara(SysPara *SysPara); + DlgInputAddr *dlgInputAddr; signals: diff --git a/MainInstruction.ui b/MainInstruction.ui index 3bff5c1..96dc3ef 100644 --- a/MainInstruction.ui +++ b/MainInstruction.ui @@ -98,7 +98,7 @@ - 0 + 1 diff --git a/MainWidget.ui b/MainWidget.ui index c24ae76..7ac2c58 100644 --- a/MainWidget.ui +++ b/MainWidget.ui @@ -18,7 +18,7 @@ - 16777215 + 800 16777215 diff --git a/MemDisplayAndEdit.cpp b/MemDisplayAndEdit.cpp index 4b8a839..2f47b42 100644 --- a/MemDisplayAndEdit.cpp +++ b/MemDisplayAndEdit.cpp @@ -6,9 +6,6 @@ MemDisplayAndEdit::MemDisplayAndEdit(QWidget *parent) : ui(new Ui::MemDisplayAndEdit) { ui->setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } for(int i = 0; i < MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL; i++){ memLineEdit[i] = new QLineEdit(this); @@ -51,6 +48,10 @@ void MemDisplayAndEdit::updateSysStatusToUI(void){ } } +void MemDisplayAndEdit::bindSysPara(SysPara *SysPara) +{ + this->sysPara = SysPara; +} void MemDisplayAndEdit::on_comboBoxBaseAddress_activated(const QString &str) { diff --git a/MemDisplayAndEdit.h b/MemDisplayAndEdit.h index 73f99f6..065164f 100644 --- a/MemDisplayAndEdit.h +++ b/MemDisplayAndEdit.h @@ -22,6 +22,8 @@ public: void updateSysStatusToUI(void); + void bindSysPara(SysPara *SysPara); + private slots: void on_comboBoxBaseAddress_activated(const QString &arg1); diff --git a/OtherInfo.cpp b/OtherInfo.cpp index 5873b2f..e5bb65b 100644 --- a/OtherInfo.cpp +++ b/OtherInfo.cpp @@ -14,12 +14,6 @@ OtherInfo::OtherInfo(QWidget *parent) : { ui->setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - lockPhaseFlag = sysPara->para.phaseByHand != 0; - updateLockPhaseWidgets(); - } - lockedPhase = 0; ui->memDisplayAndEdit->setHidden(1); @@ -62,6 +56,16 @@ void OtherInfo::OtherupdateSysParaToUI(){ } #define PHASE_BY_HAND_DIV 8 //相位会在逻辑里面放大 + +void OtherInfo::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; + ui->phaseGraphic->bindSysPara(sysPara); + ui->memDisplayAndEdit->bindSysPara(sysPara); + lockPhaseFlag = sysPara->para.phaseByHand != 0; + updateLockPhaseWidgets(); +} + void OtherInfo::init() { // 应用样式表 diff --git a/OtherInfo.h b/OtherInfo.h index ff13d3f..534679f 100644 --- a/OtherInfo.h +++ b/OtherInfo.h @@ -24,6 +24,7 @@ public: void phaseDetectResultRecord(); void OtherInfoLog(); + void bindSysPara(SysPara *sysPara); void applyStyleSheet(); // 应用样式表 void init(); private slots: diff --git a/PhaseGraphic.cpp b/PhaseGraphic.cpp index bc4c350..d82424e 100644 --- a/PhaseGraphic.cpp +++ b/PhaseGraphic.cpp @@ -14,9 +14,6 @@ PhaseGraphic::PhaseGraphic(QWidget *parent) : QWidget(parent){ - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } pen.setStyle(Qt::SolidLine); pen.setWidth(2); pen.setBrush(Qt::red); @@ -98,6 +95,10 @@ void PhaseGraphic::paintEvent(QPaintEvent *){ } } +void PhaseGraphic::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} void PhaseGraphic::updateSysStatusToUI(){ update(); diff --git a/PhaseGraphic.h b/PhaseGraphic.h index 7deac21..36f907f 100644 --- a/PhaseGraphic.h +++ b/PhaseGraphic.h @@ -25,6 +25,8 @@ public: void paintEvent(QPaintEvent *); + void bindSysPara(SysPara *sysPara); + void updateSysStatusToUI(); void setLockedPhase(bool enable,int val); diff --git a/PrintTextDisplay.cpp b/PrintTextDisplay.cpp index 5f8d661..232773a 100644 --- a/PrintTextDisplay.cpp +++ b/PrintTextDisplay.cpp @@ -23,9 +23,6 @@ PrintTextDisplay::PrintTextDisplay(QWidget *parent): QWidget(parent){ - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } setPalette(QPalette(Qt::white)); setAutoFillBackground(true); @@ -98,6 +95,11 @@ int PrintTextDisplay::currScaleRatio() return this->scaleRatio; } +void PrintTextDisplay::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} + void PrintTextDisplay::paintEvent(QPaintEvent *event){ QRect updateRect = event->rect(); updateRect.setY(0); diff --git a/PrintTextDisplay.h b/PrintTextDisplay.h index 2a0a011..990bdff 100644 --- a/PrintTextDisplay.h +++ b/PrintTextDisplay.h @@ -37,6 +37,8 @@ public: int currScaleRatio(); + void bindSysPara(SysPara *sysPara); + void scroll_update(); private: SysPara* sysPara = nullptr; diff --git a/Printsetting.cpp b/Printsetting.cpp index 2888fec..7fa7283 100644 --- a/Printsetting.cpp +++ b/Printsetting.cpp @@ -9,11 +9,6 @@ PrintSetting::PrintSetting(QWidget *parent) : ui(new Ui::PrintSetting) { ui->setupUi(this); - - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - m_checkBtn = ui->checkBtn; m_closeBtn = ui->closeBtn; @@ -27,8 +22,21 @@ PrintSetting::PrintSetting(QWidget *parent) : ui->labelSynTriggerPrintLenRatio->setHidden(1); ui->spinBoxSynTriggerPrintLenRatio->setHidden(1); - ui->labelTimeTriggerMode->setEnabled(false); - ui->comboBoxTimeTriggerMode->setEnabled(false); + // 隐藏延时、产生脉冲所需计数、脉冲输出使能、禁止电眼清零、字符宽度、电眼清零 + ui->labelOutputPulseDelayMs->hide(); + ui->spinBoxOutputPulseDelayMs->hide(); + ui->labelProductCntPerOutputPulse->hide(); + ui->spinBoxProductCntPerOutputPulse->hide(); + ui->labelSynTriggerPrintLenRatio->hide(); + ui->spinBoxSynTriggerPrintLenRatio->hide(); + ui->checkBoxEleEyeMakeClean->hide(); + ui->spinBoxOuputPulseCol->hide(); + ui->checkBoxPulseOutputEnable->hide(); + ui->comboBoxEleEyeMakeClean->hide(); + + + // ui->labelTimeTriggerMode->setEnabled(false); + // ui->comboBoxTimeTriggerMode->setEnabled(false); init(); @@ -50,6 +58,26 @@ void PrintSetting::init() connect(m_closeBtn, &QPushButton::clicked, this, &PrintSetting::buttonClickedSlot); connect(m_checkBtn,&QPushButton::clicked, this, &PrintSetting::buttonClickedSlot); + + connect(ui->eleEyeEdgetTriggerExternal, &QRadioButton::toggled, this, [this](bool b){ + if(b) + on_eleEyeEdgetTriggerExternal_clicked(); + }); + + connect(ui->eleEyeEdgetTriggerInner, &QRadioButton::toggled, this, [this](bool b){ + if(b) + on_eleEyeEdgetTriggerInner_clicked(); + }); + + connect(ui->radioButtonSynTriggerInner, &QRadioButton::toggled, this, [this](bool b){ + if(b) + on_radioButtonSynTriggerInner_clicked(); + }); + + connect(ui->radioButtonSynTriggerExternal, &QRadioButton::toggled, this, [this](bool b){ + if(b) + on_radioButtonSynTriggerExternal_clicked(); + }); } extern void MySleep(unsigned int msec); @@ -69,10 +97,17 @@ void PrintSetting::on_pushButtonApply_pressed(){ applyUIPara(); applyUITriggerPara(); - if(sysPara->devOp->writeFpgaPrintPara() != -1) - QMessageBox::information(this,tr("提示"),tr("应用成功")); - if(sysPara)sysPara->saveParaToFile (); + if(sysPara->devOp->writeFpgaPrintPara(true) != -1) { + QMessageBox box(QMessageBox::Icon::Information, tr("提示"), tr("应用成功"), QMessageBox::Ok, nullptr); + auto btn = box.button(QMessageBox::Ok); + // btn->setFixedSize(80, 40); + + box.exec(); + } + + if(sysPara) + sysPara->saveParaToFile (); } void PrintSetting::applyUIPara(){ @@ -80,7 +115,7 @@ void PrintSetting::applyUIPara(){ sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; //延时触发 sysPara->para.printDelayMs = 200; //重复间隔 sysPara->para.checkSpace = 0;//ui->checkSpace->isChecked(); - ui->spinBoxColDelay->setEnabled(1); + // ui->spinBoxColDelay->setEnabled(1); sysPara->para.leftRightInverse = ui->checkBoxLeftRightInverse->isChecked(); sysPara->para.upDownInverse = ui->checkBoxUpDownInverse->isChecked(); sysPara->para.currSelectVolPara = ui->comboBox_selcetVolPara->currentIndex(); @@ -99,6 +134,11 @@ void PrintSetting::applyUIPara(){ } } +void PrintSetting::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} + void PrintSetting::updateSysParaToUI(){ if(sysPara){ ui->checkBoxLeftRightInverse->setChecked(sysPara->para.leftRightInverse); @@ -134,6 +174,10 @@ void PrintSetting::TriggerupdateSysParaToUI(){ sysPara->para.eleEyeEdgetTriggerExternal = 1; sysPara->para.synTriggerExternal = 1; } + + qDebug() << sysPara->para.eleEyeEdgetTriggerInner; + qDebug() << sysPara->para.eleEyeEdgetTriggerExternal; + ui->eleEyeEdgetTriggerInner->setChecked(sysPara->para.eleEyeEdgetTriggerInner); ui->eleEyeEdgetTriggerExternal->setChecked(sysPara->para.eleEyeEdgetTriggerExternal); ui->radioButtonSynTriggerInner->setChecked(sysPara->para.synTriggerInner); @@ -162,15 +206,15 @@ void PrintSetting::TriggerupdateSysParaToUI(){ ui->comboBoxEleEyeMakeClean->setCurrentIndex( sysPara->para.eleEyeClearCntInSynMode & 0x0f); ui->checkBoxPulseOutputEnable->setChecked(sysPara->para.pulseOutputEnable); - ui->labelProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable); - ui->spinBoxProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable); + // ui->labelProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable); + // ui->spinBoxProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable); ui->spinBoxProductCntPerOutputPulse->setValue(sysPara->para.productCntPerOutputPulse); - ui->labelOutputPulseDelayMs->setEnabled(sysPara->para.pulseOutputEnable); + // ui->labelOutputPulseDelayMs->setEnabled(sysPara->para.pulseOutputEnable); //ui->spinBoxOutputPulseDelayMs->setEnabled(sysPara->para.pulseOutputEnable); - ui->spinBoxOutputPulseDelayMs->setEnabled(isPulseEenable); + // ui->spinBoxOutputPulseDelayMs->setEnabled(isPulseEenable); ui->spinBoxOuputPulseCol->setValue(sysPara->para.OuputPulseCol); ui->comboBoxSyncActType->setCurrentIndex (sysPara->para.synchronizorActType); //ui->checkBoxAutoSpeedEN->setChecked (sysPara->para.autoSynSpeedEn ); @@ -190,14 +234,12 @@ void PrintSetting::TriggerupdateSysParaToUI(){ } void PrintSetting::updateSysStatusToUI(){ - - } void PrintSetting::on_pushButtonApplyPulseFix_clicked() { -// pulseNumFix->bindSysPara(sysPara); -// pulseNumFix->hide(); + pulseNumFix->bindSysPara(sysPara); + pulseNumFix->hide(); pulseNumFix->show(); } @@ -219,7 +261,7 @@ void PrintSetting::applyUITriggerPara(){ { if( sysPara->para.synTriggerPrintLenMm < sysPara->para.eleEyeTriggerPrintDelay ) { - QMessageBox::information(this,tr("提示:参数不正确"),tr("要求:触发长度小于喷印间隔")); + QMessageBox::information(nullptr,tr("提示:参数不正确"),tr("要求:触发长度小于喷印间隔")); } } sysPara->para.eleEyeEdgetTriggerInner = ui->eleEyeEdgetTriggerInner->isChecked(); @@ -259,7 +301,7 @@ void PrintSetting::GetTriggerUIPara(){ sysPara->para.timeTriggerPrintMode = ui->comboBoxTimeTriggerMode->currentIndex(); sysPara->para.elecEyeTriggerInterval = ui->spinBoxEleEyeTriggerIntervalMs->value(); //电眼触发的重复间隔 int value = 0; - if (ui->cb_unlimited->isChecked()) value = 65535; + if (ui->cb_unlimited->isChecked()) value = UINT_MAX / 2; else value = ui->spinBoxEleEyeTriggerRepeatCnt->value(); sysPara->para.photoElectricityRepeateNum = value; @@ -297,11 +339,23 @@ void PrintSetting::GetTriggerUIPara(){ else sysPara->para.printTriggerMode = PRINT_TRIGGER_NONE; + + if(ui->eleEyeEdgetTriggerExternal->isChecked() && ui->radioButtonSynTriggerExternal->isChecked()) { + if(ui->radioButtonEleEyeEdgetTrigger->isChecked()) { + sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_EDGE; + } + else { + sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL; + } + + sysPara->para.eleEyeTriggerSynPrintEn = true; + } + else{ + sysPara->para.eleEyeTriggerSynPrintEn = false; + } + // sysPara->para.eleEyeTriggerSynPrintEn = ui->checkEyeTriggerSynPrintEn->isChecked (); - if(ui->eleEyeEdgetTriggerExternal->isChecked() && ui->radioButtonSynTriggerExternal->isChecked()) //都选外部--电眼+同步触发 - sysPara->para.eleEyeTriggerSynPrintEn=true; - else - sysPara->para.eleEyeTriggerSynPrintEn=false; + // sysPara->para.eleEyeTriggerSynPrintEn = ui->eleEyeEdgetTriggerExternal->isChecked() && ui->radioButtonSynTriggerExternal->isChecked(); sysPara->para.eleEyeTriggerPrintDelay = ui->spinBoxEleEyeTriggerPrintDelay->value(); sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xf0) + ui->comboBoxEleEyeMakeClean->currentIndex(); //ui->checkBoxEleEyeMakeClean->isChecked(); @@ -361,25 +415,25 @@ void PrintSetting::on_radioButtonSynTrigger_pressed() void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked) { - ui->cb_unlimited->setEnabled(checked); + // ui->cb_unlimited->setEnabled(checked); if(sysPara) { int triggerMode = sysPara->para.printTriggerMode; if( checked) { #ifndef NON_CABLE - ui->spinBoxSynTriggerPrintLen->setEnabled(1); + // ui->spinBoxSynTriggerPrintLen->setEnabled(1); #endif - ui->labelSynTriggerPrintLen->setEnabled(1); - ui->lineEditTriggerPulsePerMm->setEnabled(1); - ui->labelTriggerPulsePerMm->setEnabled(1); - ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); - ui->labelSynTriggerPrintLenRatio->setEnabled(1); - ui->checkBoxEleEyeMakeClean->setEnabled(1); - ui->pushButtonApplyPulseFix->setEnabled(1); - ui->comboBoxSynPrintMode->setEnabled(1); - ui->labelSynPrintMode->setEnabled(1); - ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0); + // ui->labelSynTriggerPrintLen->setEnabled(1); + // ui->lineEditTriggerPulsePerMm->setEnabled(1); + // ui->labelTriggerPulsePerMm->setEnabled(1); + // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); + // ui->labelSynTriggerPrintLenRatio->setEnabled(1); + // ui->checkBoxEleEyeMakeClean->setEnabled(1); + // ui->pushButtonApplyPulseFix->setEnabled(1); + // ui->comboBoxSynPrintMode->setEnabled(1); + // ui->labelSynPrintMode->setEnabled(1); + // ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0); ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)")); ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)")); ui->labelEleMaskTime->setText(tr("抑止距离(毫米)")); @@ -392,18 +446,18 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked) else { #ifndef NON_CABLE - ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); #endif - ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1); + // ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1); ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)")); ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)")); ui->labelEleMaskTime->setText(tr("抑止距离(毫秒)")); @@ -412,36 +466,36 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked) } void PrintSetting::setTriggerUI(int triggerMode){ - ui->sb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME); - ui->lb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME); + // ui->sb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME); + // ui->lb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME); ui->radioButtonEleEyeEdgetTrigger->setChecked( triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); ui->radioButtonEleEyeLevelTrigger->setChecked(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL); - ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || triggerMode == PRINT_TRIGGER_TIME); - ui->labelEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->labelEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->spinBoxEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER); - ui->labelEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER); - ui->labelEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); - ui->spinBoxEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + // ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || triggerMode == PRINT_TRIGGER_TIME); + // ui->labelEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + // ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + // ui->labelEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + // ui->spinBoxEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER); + // ui->labelEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER); + // ui->labelEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); + // ui->spinBoxEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); if(sysPara->para.eleEyeTriggerSynPrintEn && (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE) ) { - ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0); - ui->labelSynTriggerPrintLen->setEnabled(1); - ui->lineEditTriggerPulsePerMm->setEnabled(1); - ui->labelTriggerPulsePerMm->setEnabled(1); - ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); - ui->labelSynTriggerPrintLenRatio->setEnabled(1); - ui->checkBoxEleEyeMakeClean->setEnabled(1); - ui->pushButtonApplyPulseFix->setEnabled(1); - ui->comboBoxSynPrintMode->setEnabled(1); - ui->labelSynPrintMode->setEnabled(1); - ui->labelEleMaskTime->setEnabled(1); - ui->spinBoxEleMaskTime->setEnabled(1); + // ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0); + // ui->labelSynTriggerPrintLen->setEnabled(1); + // ui->lineEditTriggerPulsePerMm->setEnabled(1); + // ui->labelTriggerPulsePerMm->setEnabled(1); + // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); + // ui->labelSynTriggerPrintLenRatio->setEnabled(1); + // ui->checkBoxEleEyeMakeClean->setEnabled(1); + // ui->pushButtonApplyPulseFix->setEnabled(1); + // ui->comboBoxSynPrintMode->setEnabled(1); + // ui->labelSynPrintMode->setEnabled(1); + // ui->labelEleMaskTime->setEnabled(1); + // ui->spinBoxEleMaskTime->setEnabled(1); ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)")); ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)")); @@ -450,17 +504,17 @@ void PrintSetting::setTriggerUI(int triggerMode){ else { #ifndef NON_CABLE - ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); #endif - ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); - ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); + // ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); if(triggerMode == PRINT_TRIGGER_SYNCHRONIZER) { @@ -494,11 +548,11 @@ void PrintSetting::setSynPrintMode(int mode){ ui->spinBoxSynTriggerPrintLenRatio->setValue(sysPara->para.synTriggerPrintLenRatio); } - const bool bShow=SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH!=mode; + const bool bShow = SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH != mode; //隐藏文本框 - ui->labelSynTriggerPrintLenRatio->setVisible(bShow); + ui->labelSynTriggerPrintLenRatio->setVisible(false); //隐藏输入框 - ui->spinBoxSynTriggerPrintLenRatio->setVisible(bShow); + ui->spinBoxSynTriggerPrintLenRatio->setVisible(false); } void PrintSetting::applyStyleSheet() @@ -638,10 +692,12 @@ void PrintSetting::on_eleEyeEdgetTriggerInner_clicked() setEnableEleEyeSetting(false); if (sysPara == NULL) return; + if(ui->radioButtonSynTriggerInner->isChecked()){ sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; }else sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER; + setTriggerUI(sysPara->para.printTriggerMode); sysPara->para.eleEyeTriggerSynPrintEn = false; @@ -650,20 +706,14 @@ void PrintSetting::on_eleEyeEdgetTriggerInner_clicked() void PrintSetting::setEnableEleEyeSetting(bool flag){ - ui->labelEleEyeTriggerIntervalMs->setEnabled(flag); - if (sysPara) { - ui->spinBoxEleEyeTriggerIntervalMs-> - setEnabled(flag || sysPara->para.printTriggerMode == PRINT_TRIGGER_TIME); - } - ui->labelEleMaskTime->setEnabled(flag); + ui->labelEleEyeTriggerIntervalMs->setEnabled(!(!flag && ui->radioButtonSynTriggerInner->isChecked())); ui->spinBoxEleMaskTime->setEnabled(flag); - ui->labelEleEyeTriggerRepeatCnt->setEnabled(flag); ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(flag); ui->radioButtonEleEyeEdgetTrigger->setEnabled(flag); ui->radioButtonEleEyeLevelTrigger->setEnabled(flag); ui->cb_unlimited->setEnabled(flag); + ui->sb_printingDelay->setEnabled(flag); if (!flag) ui->cb_unlimited->setChecked(false); - } void PrintSetting::on_eleEyeEdgetTriggerExternal_clicked() @@ -677,13 +727,13 @@ void PrintSetting::on_eleEyeEdgetTriggerExternal_clicked() void PrintSetting::setEnableSynTriggerSetting(bool flag){ - ui->labelTriggerPulsePerMm->setEnabled(flag); + // ui->labelTriggerPulsePerMm->setEnabled(flag); ui->lineEditTriggerPulsePerMm->setEnabled(flag); ui->pushButtonApplyPulseFix->setEnabled(flag); - ui->labelSynTriggerPrintLen->setEnabled(flag); + // ui->labelSynTriggerPrintLen->setEnabled(flag); ui->spinBoxSynTriggerPrintLen->setEnabled(flag); ui->comboBoxSyncActType->setEnabled(flag); - ui->labelSynPrintMode->setEnabled(flag); + // ui->labelSynPrintMode->setEnabled(flag); ui->comboBoxSynPrintMode->setEnabled(flag); } @@ -700,7 +750,7 @@ void PrintSetting::on_radioButtonSynTriggerInner_clicked() on_checkEyeTriggerSynPrintEn_clicked(false); } - + setEnableEleEyeSetting(!ui->eleEyeEdgetTriggerInner->isChecked()); } void PrintSetting::on_radioButtonSynTriggerExternal_clicked() @@ -714,6 +764,7 @@ void PrintSetting::on_radioButtonSynTriggerExternal_clicked() on_checkEyeTriggerSynPrintEn_clicked(sysPara->para.eleEyeTriggerSynPrintEn); } setEnableSynTriggerSetting(true); + setEnableEleEyeSetting(!ui->eleEyeEdgetTriggerInner->isChecked()); } @@ -731,10 +782,10 @@ void PrintSetting::on_radioButtonEleEyeLevelTrigger_clicked() void PrintSetting::on_checkBoxPulseOutputEnable_clicked(bool checked) { isPulseEenable = checked; - ui->spinBoxOutputPulseDelayMs->setEnabled(checked); + // ui->spinBoxOutputPulseDelayMs->setEnabled(checked); } void PrintSetting::on_cb_unlimited_clicked(bool checked) { - ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(!checked); + // ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(!checked); } diff --git a/Printsetting.h b/Printsetting.h index 14825bf..aba9fdf 100644 --- a/Printsetting.h +++ b/Printsetting.h @@ -23,6 +23,7 @@ public: void updateSysParaToUI(); //重载 void applyUIPara(); //重载 + void bindSysPara(SysPara *sysPara); void updateSysStatusToUI(); void applyUITriggerPara(); diff --git a/Printsetting.ui b/Printsetting.ui index c6a4674..e066560 100644 --- a/Printsetting.ui +++ b/Printsetting.ui @@ -902,6 +902,12 @@ 0 + + + 16777215 + 37 + + diff --git a/PulseNumFix.cpp b/PulseNumFix.cpp index 68585e0..0c744a5 100644 --- a/PulseNumFix.cpp +++ b/PulseNumFix.cpp @@ -8,9 +8,6 @@ PulseNumFix::PulseNumFix(QWidget *parent) : ui(new Ui::PulseNumFix) { ui->setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } this->setWindowTitle(tr("脉冲数修正")); setUIEnableStatus(); @@ -31,6 +28,11 @@ PulseNumFix::~PulseNumFix() delete ui; } +void PulseNumFix::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} + void PulseNumFix::setUIEnableStatus(){ ui->lineEditRate->setEnabled(ui->radioButtonAccordingRate->isChecked()); ui->labelRate->setEnabled(ui->radioButtonAccordingRate->isChecked()); diff --git a/PulseNumFix.h b/PulseNumFix.h index 00e17bc..0bace40 100644 --- a/PulseNumFix.h +++ b/PulseNumFix.h @@ -14,6 +14,8 @@ class PulseNumFix : public QDialog public: explicit PulseNumFix(QWidget *parent = 0); ~PulseNumFix(); + + void bindSysPara(SysPara *sysPara); Q_SIGNALS: void pulseNuxFixDone(float); diff --git a/QBarCode.cpp b/QBarCode.cpp index 37605fb..e36c073 100644 --- a/QBarCode.cpp +++ b/QBarCode.cpp @@ -27,10 +27,6 @@ QBarCode::QBarCode(QWidget *parent) : { ui->setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - bcOK=false; connect(ui->BarCodeGenerate,SIGNAL(pressed()),this,SLOT(ImgSave())); connect(ui->pushBarPreview,SIGNAL(pressed()),this,SLOT(onEnCodeBar())); @@ -401,7 +397,13 @@ void QBarCode::onXposChange(int n){ } } -void QBarCode::SetOption(bcOption_t *bcOption){ +void QBarCode::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} + +void QBarCode::SetOption(bcOption_t *bcOption) +{ AutoCount1=bcOption->var1En | bcOption->var2En; diff --git a/QBarCode.h b/QBarCode.h index 4ed2910..75044cf 100644 --- a/QBarCode.h +++ b/QBarCode.h @@ -35,6 +35,7 @@ class QBarCode : public QDialog public: explicit QBarCode(QWidget *parent = 0); ~QBarCode(); + void bindSysPara(SysPara *sysPara); //unsigned char pointMap[40*1000]; QString pictureName;//当前显示的图片 diff --git a/Serial/serial.cpp b/Serial/serial.cpp index 3f3d58e..ab47e93 100644 --- a/Serial/serial.cpp +++ b/Serial/serial.cpp @@ -8,6 +8,8 @@ #include #include #include +#include + #define MAX_LEN1 1024 #define MAX_LEN2 224 @@ -31,8 +33,8 @@ Serial::Serial(const QString comport) } Serial::~Serial(){ - if(serial) - serial->close(); + if (serial) serial->close(); + } int baudRateValue = 0; @@ -153,11 +155,11 @@ void Serial::readData(){ if(!isCommunication) return; if(!timerRead->isActive() && !flagOfUpgradeSTM32) timerRead->start(50); - QByteArray recData = serial->readAll(); + QByteArray recDat = serial->readAll(); if(com == "/dev/ttyAS5") - readFPGAData(recData); + readFPGAData(recDat); else if(com == "/dev/ttyAS2") - readSTM32Data(recData); + readSTM32Data(recDat); } unsigned char dataFPGA_FE[12] = {0}; @@ -169,11 +171,9 @@ unsigned char dataFPGA_1B8[12] = {0}; void Serial::readFPGAData(QByteArray data) { recData.append(data); - if(recData.length() < curLen+10){ return; } - if(timerRead->isActive()) timerRead->stop(); @@ -189,30 +189,39 @@ void Serial::readFPGAData(QByteArray data) { /***************出队列***************/ { QMutexLocker locker(&Mutex); - if(recData[1]==0x01 || !set.contains(addr)){ - if(queue.size() > 0) - queue.dequeue(); + if(recData[1]==0x01 || !set.contains(addr)){ + if(queue.size() > 0) + queue.dequeue(); } } - if(queue.size() > 1){ + if(queue.size() > 0){ qDebug()<<"send FPGA queue data 0"; emit sendQueueData(0,0,NULL,0,0); } int headCode=recData[0]; if(headCode != 0xAA){ qDebug()<<"FPGA接收数据帧头错误:Frameheader"< 0) + queue.dequeue(); + } return; } if(recData[1] == 0x02 && set.contains(addr) && recData[7] != 0x00){ qDebug()<<"FPGA写错误"; + recData.clear(); emit resendFPGAData(2,addr,NULL,1,0); return; } @@ -236,8 +245,7 @@ void Serial::readFPGAData(QByteArray data) { memcpy(dataFPGA_100,recData.constData(),74); emit getFPGAPhaseDetectHighTm(dataFPGA_100); break; - case 0x180: - { + case 0x180:{ //dataofFPGACalandarAndDat=reinterpret_cast(recData.data()); memcpy(dataFPGA_180,recData.constData(),26); emit getFPGACalandarAndDat(dataFPGA_180); @@ -266,8 +274,9 @@ void Serial::readFPGAData(QByteArray data) { emit FPGABuildDat(fpgaBuildDat); break; } + } } - } + recData.clear(); // 正常处理完毕,清空缓冲区 } @@ -300,16 +309,15 @@ void Serial::readSTM32Data(QByteArray data) { { QMutexLocker locker(&Mutex); - if(queue.size() > 0){ - queue.dequeue(); + if(queue.size() > 0){ + queue.dequeue(); } } - if(queue.size() > 2){ + if(queue.size() > 0){ qDebug()<<"send STM32 queue data 0"; emit sendQueueData(0,0,NULL,0,0); } - int addr = recData[2]; int headCode = recData[0]; if(headCode != 0xBB){ @@ -319,26 +327,29 @@ void Serial::readSTM32Data(QByteArray data) { } if(recData[1] != 0xF0 && recData[1] != 0x01 && recData[1] != 0x02){ qDebug()<<"STM32接收指令字节错误."<< "addr:"<= recData.size()) { qDebug() << "STM32 帧尾索引越界,数据不完整"; + recData.clear(); // 数据不完整,清空缓冲区 return; } if(recData[recData[3]+6] != 0x55){ qDebug()<<"STM32接收数据帧尾错误."<<"addr:"<stop(); serial->clear(QSerialPort::Input); + recData.clear(); // 超时时清空接收缓冲区,防止残留数据污染下次接收 if(com == "/dev/ttyAS5") qDebug()<<"Read FPGA Serial data Timeout"; else if(com == "/dev/ttyAS2") @@ -379,47 +392,26 @@ void Serial::readTimeOut(){ sendSerialData(0,0,NULL,0,0); } +// 每个逻辑写操作以一条记录入队;sendDataToFPGA 内部负责分包,队列只记录逻辑单元 +static constexpr int QUEUE_FPGA_MAX = 50; // queueFPGA 积压上限 +static constexpr int QUEUE_STM32_MAX = 100; // queue 积压上限 + void Serial::enQueue(int cmd, int addr, unsigned char *data, int len, int type, bool flag){ - send_Data sendData; + const send_Data sendData = {cmd, addr, data, len, type}; if(flag){ - int max = 0; - if(cmd == 0xD2) - max = MAX_LEN1; - else - max = MAX_LEN2; - int num = len/max; - if(len <= max){ - sendData.cmd = cmd; - sendData.addr = addr; - sendData.data = data; - sendData.len = len; - sendData.type = type; - queueFPGA.append(sendData); - } - else{ - for(int i=0;i QUEUE_FPGA_MAX){ + qDebug()<<"queueFPGA 积压过多,清空旧数据,当前大小:"< QUEUE_STM32_MAX){ + qDebug()<<"queue 积压过多,清空旧数据,当前大小:"<flush(); serial->waitForBytesWritten(waitTime); if (bytesWritten == -1) { -// qDebug() << "STM32写入数据失败。read"; + qDebug() << "STM32写入数据失败。read"; } else { // qDebug() << "STM32成功发送 " << bytesWritten << " 个字节的数据。read"; flagOfReadFinished = false; @@ -571,11 +560,11 @@ void Serial::sendDataToSTM32(int cmd,int addr, unsigned char* data, int len) sendData.resize(len+7); serial->clear(QSerialPort::Input); bytesWritten=serial->write(sendData,len+7); - + serial->flush(); serial->waitForBytesWritten(waitTime); if (bytesWritten == -1) { -// qDebug() << "STM32写入数据失败。"; + qDebug() << "STM32写入数据失败。"; } else { flagOfReadFinished = false; recData.clear(); @@ -696,6 +685,9 @@ void Serial::sendDataToFPGA(int cmd,int addr, unsigned char* data, int len){ serial->clear(QSerialPort::Input); bytesWritten=serial->write(sendData,len+10); + if(addr == 0xB170) + qDebug() << "Counter2 sectional group: " << sendData.toHex(' '); + serial->flush(); if(cmd == 0xD2) serial->waitForBytesWritten(12); diff --git a/Serial/serial.h b/Serial/serial.h index 243c678..37345ed 100644 --- a/Serial/serial.h +++ b/Serial/serial.h @@ -130,6 +130,7 @@ private: bool waitForAck(int); unsigned char checkSumForUpgrade(unsigned char *data,int len); bool sendDataToUART2(QByteArray,int); + }; #endif // SERIAL_H diff --git a/SysPara.cpp b/SysPara.cpp index ccad2b3..2d75457 100644 --- a/SysPara.cpp +++ b/SysPara.cpp @@ -78,15 +78,6 @@ SysPara::SysPara(void): #endif } -SysPara *SysPara::ins() -{ - static SysPara* ins = nullptr; - if (ins == nullptr) { - ins = new SysPara(); - } - return ins; -} - void SysPara::loadParaFromFile(){ QFile file(PARA_FILE_PATH); QFile DeviceCodefile(DeviceCode_FILE_PATH); @@ -168,7 +159,7 @@ void SysPara::loadDefaultPara(){ para.synPulseNumPerMm = 8;// 同步器参数 脉冲/毫米 para.OuputPulseCol = 0;//桂林客户,精准控制输出脉冲的位置,精确到打印的列数 para.gearPumpEnable = 1; - para.flagOfReclaimPumEnable = false; + para.flagOfReclaimPumEnable = true; para.oscillatorVoltage = 30;//晶振电压 para.highVoltageLevel = 100;//高压包容差 @@ -202,27 +193,27 @@ void SysPara::saveParaToFile(){ // qDebug()<<"saveParaToFile:"<setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - timeDia.hide(); setPumpValveBottonEnable(false); ui->pushButtonCompressPump->setEnabled(false); @@ -344,14 +340,14 @@ void SystemManage::on_pushButtonControlByHand_pressed() void SystemManage::on_pushButtonReclaimTankOpen_pressed() { if(sysPara){ - if(!sysPara->para.isCheckMagnet) - { - if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ - QMessageBox::warning(this, tr("警告"), - tr("请先移开喷头盖!")); - return ; - } - } + // if(!sysPara->para.isCheckMagnet) + // { + // if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ + // QMessageBox::warning(this, tr("警告"), + // tr("请先移开喷头盖!")); + // return ; + // } + // } sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable()); ui->labelReclaimTankOpen->setText(sysPara->devOp->isReclaimTankOpenEnable()?tr("启动"):tr("停止")); sysPara->devOp->highVoltageCtrl(0); @@ -365,14 +361,14 @@ void SystemManage::on_pushButtonReclaimTankOpen_pressed() void SystemManage::on_pushButtonReclaimTankClose_pressed() { if(sysPara){ - if(!sysPara->para.isCheckMagnet) - { - if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ - QMessageBox::warning(this, tr("警告"), - tr("请先移开喷头盖!")); - return ; - } - } + // if(!sysPara->para.isCheckMagnet) + // { + // if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ + // QMessageBox::warning(this, tr("警告"), + // tr("请先移开喷头盖!")); + // return ; + // } + // } sysPara->devOp->controlReclaimTankClose(!sysPara->devOp->isReclaimTankCloseEnable()); ui->labelReclaimTankClose->setText(sysPara->devOp->isReclaimTankCloseEnable()?tr("启动"):tr("停止")); sysPara->devOp->highVoltageCtrl(0); @@ -1377,6 +1373,11 @@ void SystemManage::PowerOnSetTime(QString date){ } +void SystemManage::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} + void SystemManage::on_pushButton_EnvConf_clicked() { // 检查源文件 diff --git a/SystemManage.h b/SystemManage.h index 5c3da49..aec2494 100644 --- a/SystemManage.h +++ b/SystemManage.h @@ -29,6 +29,8 @@ public: void setPumpValveBottonEnable(bool enable); void PowerOnSetTime(QString); + void bindSysPara(SysPara *sysPara); + void loadKeyBoardType(); int hasSingleStm32Bin(const QString &dirPath = "/udisk"); QString fileName; diff --git a/SystemSetting.cpp b/SystemSetting.cpp index 71134a1..f849f53 100644 --- a/SystemSetting.cpp +++ b/SystemSetting.cpp @@ -36,10 +36,6 @@ SystemSetting::SystemSetting(QWidget *parent) : ui->setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - progressBar.setGeometry(200,200,300,40); //将其放在最中间 progressBar.hide(); timer = new QTimer(); @@ -59,9 +55,6 @@ SystemSetting::SystemSetting(QWidget *parent) : } init(); - - ui->label->hide(); - ui->comboBoxEditMode->hide(); } SystemSetting::~SystemSetting() @@ -92,6 +85,7 @@ void SystemSetting::buttonClickedSlot() }else if(btn == ui->checkBtn){ emit sendButtonClickedSignal(2); applyUIPara(); + sysPara->saveParaToFile(); // SystemSettingLog(); int freq = sysPara->para.oscillatorFreqFix+ convertFreq(sysPara->para.oscillatoFreq); @@ -139,7 +133,6 @@ void SystemSetting::SystemSettingLog(){ qDebug()<spinBoxReclaimTankTime->value()); qDebug()<spinBoxSeptalPostion->value()); qDebug()<comboBoxDiaphramOffset->currentIndex()); - qDebug()<comboBoxEditMode->currentIndex()); qDebug()<spinBoxPressure->value()); qDebug()<spinBoxVIscosity->value()); qDebug()<spinBoxTemperature->value()); @@ -171,7 +164,6 @@ void SystemSetting::updateSysParaToUI(){ if(sysPara->para.EditMode>SCENE) sysPara->para.EditMode=TXTFILE; - ui->comboBoxEditMode->setCurrentIndex(sysPara->para.EditMode); } } @@ -193,7 +185,6 @@ void SystemSetting::applyUIPara(){ sysPara->para.viscosityAdjust = ui->ViscosityAdujstSelect->currentIndex(); sysPara->para.oscillatoFreq = ui->comboBoxOscillatorFreq->currentIndex(); sysPara->para.oscillatorFreqFix = ui->spinBoxOscillatorFreqFix->value(); - sysPara->para.EditMode = ui->comboBoxEditMode->currentIndex(); sysPara->para.diameter = ui->comboBoxDiameter->currentIndex();// qDebug()<<"EditMode1"<para.EditMode; int freq = sysPara->para.oscillatorFreqFix+ convertFreq(sysPara->para.oscillatoFreq); @@ -244,14 +235,23 @@ void SystemSetting::updateSysStatusToUI(){ { setSpinBoxPressureMaxValue(5000); } + + // 逆清洗使能判定 + static bool CleanUPEn=1,preCleanUP=0; if(!sysPara->para.isCheckMagnet) { - ui->pushButtonCleanUP->setEnabled( (sysPara->status.currReclaimTankPos<70) && (sysPara->status.statWarn & WARN_STATUS_HDINT)); // sysPara->status.currReclaimTankPos + CleanUPEn = (sysPara->status.currReclaimTankPos<70) && (sysPara->status.statWarn & WARN_STATUS_HDINT); } else { - ui->pushButtonCleanUP->setEnabled( (sysPara->status.currReclaimTankPos<70) ); + CleanUPEn = (sysPara->status.currReclaimTankPos<70) ; } + if(CleanUPEn != preCleanUP){ + ui->pushButtonCleanUP->setEnabled(CleanUPEn); + } + preCleanUP=CleanUPEn; + + if(sysPara->status.currReclaimTankPos<55 && sysPara->status.currReclaimTankPos>44 && enCleanUpAppendFlag==2) { if(timer2->isActive()) timer2->stop(); @@ -280,6 +280,11 @@ void SystemSetting::updateSysStatusToUI(){ } } +void SystemSetting::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} + void SystemSetting::on_pushButtonCleanUP_pressed() { if(sysPara){ @@ -452,10 +457,12 @@ void SystemSetting::ondialogAuthorizationAccepted() QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ - if((sysPara->status.statWarn & WARN_STATUS_HDINT)){ - QMessageBox::information(this,tr("错误"),tr("喷头盖未关,请先关喷头盖!")); - return ; - } + + // 暂时不检测喷头盖 byons@2026年6月21日 + // if((sysPara->status.statWarn & WARN_STATUS_HDINT)){ + // QMessageBox::information(this,tr("错误"),tr("喷头盖未关,请先关喷头盖!")); + // return ; + // } lastHighVoltageOpen = sysPara->devOp->isHighVoltageOpen(); sysPara->status.detectHighVoltageAppending = true; diff --git a/SystemSetting.h b/SystemSetting.h index dfe7e6d..96acb7f 100644 --- a/SystemSetting.h +++ b/SystemSetting.h @@ -24,6 +24,7 @@ public: void updateSysParaToUI(); //重载 void applyUIPara(); //重载 void updateSysStatusToUI(); //重载 + void bindSysPara(SysPara *sysPara); QProgressBar progressBar; void updateReclaimTime(int time); void updateViscosityAdjust(int offset); diff --git a/TestPrintWidget.ui b/TestPrintWidget.ui index 702c565..f255d7e 100644 --- a/TestPrintWidget.ui +++ b/TestPrintWidget.ui @@ -10,6 +10,12 @@ 549 + + + 800 + 16777215 + + Testprint diff --git a/conf/1_table_dac_raw.txt b/conf/1_table_dac_raw.txt new file mode 100644 index 0000000..dd721f9 --- /dev/null +++ b/conf/1_table_dac_raw.txt @@ -0,0 +1,48 @@ +700 +753 +805 +869 +924 +973 +1034 +1076 +1129 +1179 +1241 +1276 +1331 +1386 +1446 +1485 +1540 +1595 +1650 +1703 +1762 +1809 +1860 +1915 +1970 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/conf/2_table_dac_raw.txt b/conf/2_table_dac_raw.txt new file mode 100644 index 0000000..a8ea082 --- /dev/null +++ b/conf/2_table_dac_raw.txt @@ -0,0 +1,48 @@ +709,757 +748,819 +839,892 +887,940 +931,995 +984,1061 +1036,1100 +1086,1155 +1145,1196 +1191,1260 +1237,1315 +1287,1364 +1342,1424 +1400,1480 +1443,1527 +1493,1578 +1547,1632 +1596,1683 +1645,1740 +1708,1793 +1767,1857 +1820,1909 +1874,1973 +1915,2013 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 +0,0 diff --git a/conf/3_table_dac_raw.txt b/conf/3_table_dac_raw.txt new file mode 100644 index 0000000..8a82fa7 --- /dev/null +++ b/conf/3_table_dac_raw.txt @@ -0,0 +1,48 @@ +710,756,828 +748,819,869 +825,887,946 +896,947,1023 +941,1006,1067 +990,1056,1116 +1049,1116,1177 +1100,1155,1221 +1133,1199,1265 +1199,1265,1331 +1230,1309,1375 +1287,1375,1444 +1343,1427,1493 +1396,1479,1545 +1446,1523,1598 +1506,1589,1650 +1545,1628,1703 +1592,1683,1755 +1661,1754,1820 +1705,1798,1864 +1755,1848,1919 +1804,1903,1969 +1866,1958,2028 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 +0,0,0 diff --git a/conf/4_table_dac_raw.txt b/conf/4_table_dac_raw.txt new file mode 100644 index 0000000..2376d1d --- /dev/null +++ b/conf/4_table_dac_raw.txt @@ -0,0 +1,48 @@ +717,762,825,877 +759,819,869,940 +825,887,946,1006 +887,940,1006,1067 +941,1006,1067,1116 +990,1056,1116,1177 +1045,1116,1177,1225 +1095,1155,1221,1276 +1133,1206,1277,1338 +1192,1265,1331,1380 +1240,1314,1375,1430 +1291,1364,1424,1490 +1350,1424,1490,1545 +1404,1489,1549,1609 +1452,1523,1595,1653 +1510,1573,1639,1705 +1544,1620,1694,1755 +1583,1670,1738,1802 +1635,1716,1782,1843 +1700,1777,1854,1920 +1762,1843,1920,1980 +1830,1915,1980,2046 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 +0,0,0,0 diff --git a/conf/5_table_dac_raw.txt b/conf/5_table_dac_raw.txt new file mode 100644 index 0000000..4cc7a9c --- /dev/null +++ b/conf/5_table_dac_raw.txt @@ -0,0 +1,48 @@ +709,761,826,875,930 +759,819,869,940,1006 +825,887,946,1006,1061 +892,946,1006,1067,1127 +933,1006,1067,1116,1177 +990,1056,1116,1177,1237 +1036,1116,1177,1225,1282 +1086,1151,1217,1272,1335 +1138,1213,1278,1338,1390 +1194,1265,1331,1390,1445 +1245,1325,1386,1441,1497 +1301,1380,1441,1507,1562 +1346,1424,1490,1553,1606 +1401,1476,1540,1603,1664 +1452,1523,1587,1653,1713 +1505,1592,1648,1710,1769 +1551,1631,1700,1766,1826 +1603,1695,1755,1825,1878 +1647,1738,1799,1868,1928 +1705,1788,1861,1933,1985 +1756,1843,1920,1980,2040 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 diff --git a/conf/VoltDataStd4R7DOf34Dot.bin b/conf/VoltDataStd4R7DOf34Dot.bin index 413616e..00de3cd 100644 Binary files a/conf/VoltDataStd4R7DOf34Dot.bin and b/conf/VoltDataStd4R7DOf34Dot.bin differ diff --git a/conf/VoltDataStd4Row7Dot.bin b/conf/VoltDataStd4Row7Dot.bin index f624fe2..00de3cd 100644 Binary files a/conf/VoltDataStd4Row7Dot.bin and b/conf/VoltDataStd4Row7Dot.bin differ diff --git a/conf/continous_dac_raw.txt b/conf/continous_dac_raw.txt new file mode 100644 index 0000000..ce02386 --- /dev/null +++ b/conf/continous_dac_raw.txt @@ -0,0 +1,48 @@ +0 +0 +0 +869 +946 +1006 +1067 +1122 +1182 +1237 +1284 +1336 +1386 +1441 +1501 +1551 +1606 +1661 +1719 +1773 +1826 +1873 +1925 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/conf/full_dac_raw.txt b/conf/full_dac_raw.txt new file mode 100644 index 0000000..97c24a9 --- /dev/null +++ b/conf/full_dac_raw.txt @@ -0,0 +1,48 @@ +693 +770 +830 +907 +959 +1014 +1074 +1124 +1184 +1239 +1294 +1349 +1404 +1459 +1514 +1569 +1624 +1679 +1734 +1789 +1844 +1899 +1954 +2009 +2064 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/conf/full_row_delay.txt b/conf/full_row_delay.txt new file mode 100644 index 0000000..139dced --- /dev/null +++ b/conf/full_row_delay.txt @@ -0,0 +1,48 @@ +4 +4 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +4 +4 +4 +4 +4 +5 +5 +5 +5 +6 +6 +6 +6 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/conf/gap_dac_raw.txt b/conf/gap_dac_raw.txt new file mode 100644 index 0000000..9296db7 --- /dev/null +++ b/conf/gap_dac_raw.txt @@ -0,0 +1,48 @@ +0,0,0,0,0 +0,0,0,0,0 +16,0,0,0,0 +15,20,0,0,0 +9,11,10,0,0 +17,12,12,10,0 +15,12,10,2,4 +21,11,17,17,10 +21,22,23,12,16 +28,22,23,11,13 +19,12,10,12,8 +29,18,21,22,19 +29,22,23,18,20 +23,21,16,17,14 +24,12,17,12,10 +32,27,25,22,16 +36,22,20,19,18 +32,12,13,18,15 +32,17,17,17,16 +31,21,17,13,10 +29,18,7,10,5 +28,18,16,10,14 +28,24,19,15,14 +25,19,17,16,16 +28,12,12,12,13 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 diff --git a/conf/general_dac_parameter.txt b/conf/general_dac_parameter.txt new file mode 100644 index 0000000..74bc717 --- /dev/null +++ b/conf/general_dac_parameter.txt @@ -0,0 +1,16 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/conf/head1_row_delay.txt b/conf/head1_row_delay.txt new file mode 100644 index 0000000..6a35cc6 --- /dev/null +++ b/conf/head1_row_delay.txt @@ -0,0 +1,48 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/conf/p3dot_gap_dac_raw.txt b/conf/p3dot_gap_dac_raw.txt new file mode 100644 index 0000000..0c92d34 --- /dev/null +++ b/conf/p3dot_gap_dac_raw.txt @@ -0,0 +1,48 @@ +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +21,0,0,0,0 +20,20,0,0,0 +20,20,18,0,0 +31,26,21,12,0 +32,26,16,13,20 +33,30,25,19,24 +30,31,12,18,5 +41,35,32,31,24 +38,35,30,25,24 +37,32,37,31,21 +30,25,26,21,18 +51,37,32,32,26 +45,35,32,30,26 +45,35,30,26,26 +42,35,30,20,25 +42,42,25,24,21 +34,31,22,22,12 +48,32,32,25,25 +50,37,32,20,21 +43,38,34,27,14 +42,37,30,25,15 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 +0,0,0,0,0 diff --git a/conf/row_delay.txt b/conf/row_delay.txt new file mode 100644 index 0000000..2f82066 --- /dev/null +++ b/conf/row_delay.txt @@ -0,0 +1,48 @@ +4 +4 +4 +5 +6 +6 +6 +6 +6 +6 +7 +7 +7 +7 +7 +7 +8 +8 +8 +8 +8 +8 +8 +8 +8 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/conf/steal_dac_raw.txt b/conf/steal_dac_raw.txt new file mode 100644 index 0000000..c8e3250 --- /dev/null +++ b/conf/steal_dac_raw.txt @@ -0,0 +1,48 @@ +24072 +23800 +25712 +26280 +26800 +28144 +20384 +21384 +30120 +30728 +31208 +8824 +9952 +2304 +-1464 +4536 +4904 +5480 +6008 +6632 +7208 +19136 +19800 +31736 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/dlgQrCode.cpp b/dlgQrCode.cpp index 17d76d9..845cb9d 100644 --- a/dlgQrCode.cpp +++ b/dlgQrCode.cpp @@ -49,10 +49,6 @@ dlgQrCode::dlgQrCode(QWidget *parent) : { ui->setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - qrOption = new qrOption_t; //ui->labQRImage->setText(""); ui->labName->setText(""); diff --git a/dlgmutilanguage.cpp b/dlgmutilanguage.cpp index c35a705..34f29f5 100644 --- a/dlgmutilanguage.cpp +++ b/dlgmutilanguage.cpp @@ -12,9 +12,6 @@ DlgMutiLanguage::DlgMutiLanguage(QWidget *parent) : { ui->setupUi(this); // ui->listWidget->hide(); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(SetNewLanguage())); LangIndex=INPUT_METHOD_TYPE_CHINESE; @@ -67,7 +64,12 @@ int DlgMutiLanguage::getCurrentLanguage(){ // } return LangIndex; } -void DlgMutiLanguage::SetNewLanguage(){ +void DlgMutiLanguage::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} +void DlgMutiLanguage::SetNewLanguage() +{ LangIndex = INPUT_METHOD_TYPE_CHINESE; diff --git a/dlgmutilanguage.h b/dlgmutilanguage.h index e1b4ca4..a36ceef 100644 --- a/dlgmutilanguage.h +++ b/dlgmutilanguage.h @@ -19,6 +19,9 @@ public: void setCurrentLanguage(); int getCurrentLanguage(); + + void bindSysPara(SysPara * sysPara); + int LangIndex; public slots: void SetNewLanguage(); diff --git a/fontsetwidget.cpp b/fontsetwidget.cpp index 2ee8ef0..d856e88 100644 --- a/fontsetwidget.cpp +++ b/fontsetwidget.cpp @@ -12,10 +12,6 @@ FontSetWidget::FontSetWidget(QWidget *parent) : { ui->setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - lineSpaceEdit = ui->lineSpaceEdit; lineSpaceMinusBtn = ui->lineSpaceMinusBtn; lineSpacePlusBtn = ui->lineSpacePlusBtn; @@ -68,6 +64,11 @@ void FontSetWidget::bindTxTEdit(QTextEdit* textEdit){ m_textEdit = textEdit; } +void FontSetWidget::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; +} + void FontSetWidget::on_buttonSelectFont_pressed(){ // int fontSize; diff --git a/fontsetwidget.h b/fontsetwidget.h index f3579d6..bf7b2d2 100644 --- a/fontsetwidget.h +++ b/fontsetwidget.h @@ -26,6 +26,8 @@ public: void bindTxTEdit(QTextEdit* textEdit); + void bindSysPara(SysPara *sysPara); + int getValueFont(); void setValueFont(int value); QFont font; diff --git a/loginfo.ui b/loginfo.ui index f64fb54..f0f9295 100644 --- a/loginfo.ui +++ b/loginfo.ui @@ -12,7 +12,7 @@ - 16777215 + 800 550 @@ -43,7 +43,7 @@ - 3 + 1 @@ -671,6 +671,15 @@ + + + + 0 + 0 + 255 + + + @@ -700,6 +709,15 @@ + + + + 0 + 0 + 255 + + + @@ -729,6 +747,15 @@ + + + + 0 + 0 + 255 + + + @@ -781,6 +808,15 @@ + + + + 0 + 0 + 255 + + + @@ -810,6 +846,15 @@ + + + + 0 + 0 + 255 + + + @@ -839,6 +884,15 @@ + + + + 0 + 0 + 255 + + + @@ -894,6 +948,15 @@ + + + + 0 + 0 + 255 + + + @@ -923,6 +986,15 @@ + + + + 0 + 0 + 255 + + + @@ -952,6 +1024,15 @@ + + + + 0 + 0 + 255 + + + @@ -1004,6 +1085,15 @@ + + + + 0 + 0 + 255 + + + @@ -1033,6 +1123,15 @@ + + + + 0 + 0 + 255 + + + @@ -1062,6 +1161,15 @@ + + + + 0 + 0 + 255 + + + @@ -1114,6 +1222,15 @@ + + + + 0 + 0 + 255 + + + @@ -1143,6 +1260,15 @@ + + + + 0 + 0 + 255 + + + @@ -1172,6 +1298,15 @@ + + + + 0 + 0 + 255 + + + @@ -1224,6 +1359,15 @@ + + + + 0 + 0 + 255 + + + @@ -1253,6 +1397,15 @@ + + + + 0 + 0 + 255 + + + @@ -1282,6 +1435,15 @@ + + + + 0 + 0 + 255 + + + @@ -1334,6 +1496,15 @@ + + + + 0 + 0 + 255 + + + @@ -1363,6 +1534,15 @@ + + + + 0 + 0 + 255 + + + @@ -1392,6 +1572,15 @@ + + + + 0 + 0 + 255 + + + @@ -1444,6 +1633,15 @@ + + + + 0 + 0 + 255 + + + @@ -1473,6 +1671,15 @@ + + + + 0 + 0 + 255 + + + @@ -1502,6 +1709,15 @@ + + + + 0 + 0 + 255 + + + @@ -1554,6 +1770,15 @@ + + + + 0 + 0 + 255 + + + @@ -1583,6 +1808,15 @@ + + + + 0 + 0 + 255 + + + @@ -1612,6 +1846,15 @@ + + + + 0 + 0 + 255 + + + diff --git a/mainwidget.cpp b/mainwidget.cpp index 07b1be2..509842a 100644 --- a/mainwidget.cpp +++ b/mainwidget.cpp @@ -43,10 +43,6 @@ MainWidget::MainWidget(QWidget* parent) // 加载UI文件 ui.setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - // 关联成员变量到UI控件 m_EditBtn = ui.m_EditBtn; m_AddBtn = ui.m_AddBtn; @@ -125,6 +121,7 @@ void MainWidget::init() m_setNumDlg = new SetNumDlg(this); } connect(m_setNumDlg, &SetNumDlg::sig_setNum, this, &MainWidget::slt_setNum); + connect(m_setNumDlg, &SetNumDlg::sig_clearCnt, this, &MainWidget::slt_clearCnt); } void MainWidget::buttonClickedSlot() @@ -174,6 +171,21 @@ void MainWidget::bindPicScene(PicScene* pPicScene){ this->pPicScene = pPicScene; } +void MainWidget::bindSysPara(SysPara *sysPara){ + this->sysPara = sysPara; + // ui->textEditOption->bindSysPara(sysPara); + m_PrintDisplay->bindSysPara(sysPara); +#ifdef _2DCODE_ +// barcode->bindSysPara(sysPara); +// dlgqrcode->setSysPara(sysPara); +// dlgqrcode->barCodeFlag = this->sysPara->para.qrOption.barCodeFlag; +// dlgqrcode->SetOption((qrOption_t*)&sysPara->para.qrOption); +#endif +#ifdef PICSCENE + // ui->senceEditOption->bindSysPara(sysPara); +#endif +} + void MainWidget::_on_pushButtonPowerOff_pressed(bool notice) { if(!sysPara) @@ -1063,7 +1075,7 @@ void MainWidget::generateCharRamData() else width = (p_var->digitalNum)?(10*(p_var->width/p_var->digitalNum)):12; int width2 = width;//+(sysPara->status.addSpace?width:0); - int height = Public::derivePixelSizeFromHeight(p_var->height); + int height = p_var->height; textEdit.clear(); int DPI = textEdit.logicalDpiX(); @@ -1422,7 +1434,8 @@ bool MainWidget::dateTimeItemsDotUpdate() if(!codeItem) continue; - QVector counterValus{sysPara->para.cnt1CurrValue, sysPara->para.cnt2CurrValue}; + QVector counterValus{QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue,16).toInt(), + QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue,16).toInt()}; auto b = codeItem->updateVariants(counterValus); isUpdate |= b; if(!b) @@ -1435,14 +1448,14 @@ bool MainWidget::dateTimeItemsDotUpdate() continue; } - auto sceneRect = pPicScene->sceneRect(); - auto boundingRect = pPicScene->itemsBoundingRect(); - QRectF itemRect(item->pos() - boundingRect.topLeft(), img.size()); + auto sceneRect = pPicScene->sceneRect().toRect(); + auto boundingRect = pPicScene->itemsBoundingRect().toRect(); + QRect itemRect(item->pos().x() - boundingRect.x(), item->pos().y() - boundingRect.y(), img.width(), img.height()); totalOfDatetimeNumber++; // 裁剪item位置, 确保item位于场景内 // 如果item超出了场景范围,则裁剪img并更新itemRect,只显示场景内的部分 - QRectF intersectRect = itemRect.intersected(sceneRect); + QRect intersectRect = itemRect.intersected(sceneRect); if(!intersectRect.isEmpty() && intersectRect != itemRect) { // 计算裁剪区域在原图中的偏移 @@ -1538,7 +1551,9 @@ void MainWidget::updateTotalCnt(int en) // ui.labelTotalProductCnt->setText(QString::number( sysPara->para.totalProductCnt+sysPara->status.totalProductCnt)); // 20260410 总数栏改为预设数值栏 if (m_setNumDlg->getIsSet() && m_setNumDlg->getNum() > 0 && - ui.labelProductCnt->text() == ui.labelTotalProductCnt->text()) { + sysPara->status.productCnt == m_setNumDlg->getNum()) { + LogInfo::setRunStatusText(QString("productCnt:%1 setNum:%2") + .arg(sysPara->status.productCnt).arg(m_setNumDlg->getNum())); on_m_StopBtn_clicked(); } } @@ -1573,8 +1588,8 @@ void MainWidget::on_m_StartBtn_clicked() print_len_min = stroke * size.width(); if(print_len_min > sysPara->para.synTriggerPrintLenMm && !sysPara->para.charWidthSetEnable) { -// QMessageBox::information(this,tr("错误"),tr("喷印间隔过短,应高于%1!").arg(print_len_min)); -// return; + QMessageBox::information(this,tr("错误"),tr("喷印间隔过短,应高于%1!").arg(print_len_min)); + return; } } /******2020/2/29 end*****/ @@ -1656,10 +1671,13 @@ void MainWidget::on_m_StartBtn_clicked() printintFlag = true; } - startPrintingFlag = true;sysPara->status.isPrinting=true; + startPrintingFlag = true; + sysPara->status.isPrinting=true; // 高亮切换 changeHighLight(true); + + LogInfo::setRunStatusText("Start print..."); } } @@ -1703,17 +1721,23 @@ void MainWidget::on_m_StopBtn_clicked() } // 高亮切换 changeHighLight(false); + + LogInfo::setRunStatusText("Stop print..."); } } unsigned char blankDat1[BLANK_COL_NUM*MAX_PRINT_ROW_BYTE_NUM]={0}; -void MainWidget::SendPrintDataToFpga(unsigned char alterEnable) +void MainWidget::SendPrintDataToFpga(unsigned char alterEnable, bool isUpdate) { if(!sysPara) return ; // fileChange=false; - sysPara->devOp->writeFpgaPrintPara(1); /*务必放在最后一步*/ - sysPara->devOp->writeFpgaVariCtrl(); + Q_UNUSED(alterEnable); + + if(!isUpdate) { + sysPara->devOp->writeFpgaPrintPara(1); + sysPara->devOp->writeFpgaVariCtrl(); + } sysPara->devOp->fpgaWr(0,blankDat1,sizeof(blankDat1));//...所加的空白偏移地址 // 交替打印处理 @@ -2092,11 +2116,12 @@ void MainWidget::slt_setNum() ui.labelTotalProductCnt->hide(); ui.lb_counter->hide(); } +} - // 当前值 - if (m_setNumDlg->getIsSetCur()) { - unsigned int curNum = m_setNumDlg->getCurNum(); - ui.labelProductCnt->setText(QString::number(curNum)); +void MainWidget::slt_clearCnt() +{ + if (sysPara) { + sysPara->devOp->clearProductCnt(1);//当前产品计数器立即清零 } } @@ -2321,12 +2346,10 @@ void MainWidget::updateSysStatusToUI(){ //100ms if(sysPara->RFIDPara.inkCardTimeOut || sysPara->RFIDPara.solventCardTimeOut || sysPara->RFIDPara.needMaintenance) m_RightBtn->setEnabled(false); - else if(sysPara->status.selfCheckDone == 1) - { - m_RightBtn->setEnabled(true); - } - - + // else if(sysPara->status.selfCheckDone == 1) + // { + // m_RightBtn->setEnabled(true); + // } } } @@ -3164,6 +3187,13 @@ void MainWidget::onPreviewScene() /*-------------------------------切换到显示窗口-----------------------------------*/ qDebug() << "currPrintCol: " << sysPara->status.currPrintCol; + LogInfo::setRunStatusText("currPrintCol: " + QString::number(sysPara->status.currPrintCol)); + LogInfo::setRunStatusText("currPrintRow: " + QString::number(sysPara->status.currPrintRow)); + LogInfo::setRunStatusText(QString("Items bounding rect: {%1, %2}").arg(pPicScene->itemsBoundingRect().width()).arg(pPicScene->itemsBoundingRect().height())); + + sysPara->status.currPrintRow = pPicScene->itemsBoundingRect().height(); + sysPara->status.currPrintCol = pPicScene->itemsBoundingRect().width(); + auto rows = sysPara->para.AlterMode?sysPara->status.currAlterPrintRow : sysPara->status.currPrintRow; rows = std::max(rows, (m_PrintDisplay->parentWidget()->height() / m_PrintDisplay->currScaleRatio())); auto cols = sysPara->status.currPrintCol; diff --git a/mainwidget.h b/mainwidget.h index 02a6b4c..e10268c 100644 --- a/mainwidget.h +++ b/mainwidget.h @@ -36,6 +36,8 @@ public: MainWidget(QWidget* parent = nullptr); ~MainWidget(); + void bindSysPara(SysPara *SysPara); + void bindTxTEdit(QTextEdit* textEdit); void bindPicScene(PicScene* pPicScene); void PreviewPressed(); @@ -100,7 +102,7 @@ public: QTimer *timerShowItem,*timerPowerOff; - void SendPrintDataToFpga(unsigned char); + void SendPrintDataToFpga(unsigned char alterMode, bool isUpdate = false); void updatePrintDisplayLabel(); @@ -179,6 +181,8 @@ private slots: void slt_setNum(); + void slt_clearCnt(); + signals: void sendButtonClickedSignal(int index); void setDisableAll(); diff --git a/rfid/rfidmanager.cpp b/rfid/rfidmanager.cpp index dc08ca4..b825d7f 100644 --- a/rfid/rfidmanager.cpp +++ b/rfid/rfidmanager.cpp @@ -7,6 +7,7 @@ #include #include #include "runtimectrl.h" +#include "SysPara.h" //#define HLPDEBUG @@ -348,8 +349,9 @@ int RFIDManager::RFIDmarkCardUsedAsync(int type) } -void RFIDManager::initRFIDMoudle(unsigned int addr) +void RFIDManager::initRFIDMoudle(unsigned int addr, SysPara *sysPara) { + this->sysPara = sysPara; setICReaderModeFlag = true; setRFIDReaderWorkMode(); setRFIDReaderKey(addr,1); @@ -368,10 +370,10 @@ void RFIDManager::handleCheck(unsigned int addr) || strRevdata.left(3) == "100") { if(strRevdata.at(3) == 'A') { - if(!SysPara::ins()->RFIDPara.needInkCard && false){ + if(!sysPara->RFIDPara.needInkCard && false){ emit sig_showMsg(tr("不需要刷墨水卡!")); } - else if(SysPara::ins()->status.statWarn & WARN_STATUS_INK_WARN && false){ + else if(sysPara->status.statWarn & WARN_STATUS_INK_WARN && false){ emit sig_showMsg(tr("请先添加墨水再刷墨水卡!")); } else @@ -381,24 +383,24 @@ void RFIDManager::handleCheck(unsigned int addr) LogInfo::setRunStatusText("The user has canceled the operation about marking the ink card."); } else if(RFIDmarkCardUsedAsync(0) == 1){ - SysPara::ins()->RFIDPara.needInkCard = false; - SysPara::ins()->RFIDPara.inkCardTimeOut = false; - SysPara::ins()->saveRFIDPara(); + sysPara->RFIDPara.needInkCard = false; + sysPara->RFIDPara.inkCardTimeOut = false; + sysPara->saveRFIDPara(); emit sig_showMsg(tr("刷墨水卡成功!")); - SysPara::ins()->para.inkWarnDate = 0; - SysPara::ins()->para.inkWarnTime = 0; - SysPara::ins()->saveParaToFile(); + sysPara->para.inkWarnDate = 0; + sysPara->para.inkWarnTime = 0; + sysPara->saveParaToFile(); } } } else if(strRevdata.at(3) == 'B') { - SysPara::ins()->para.flagOfInkWarning = false; + sysPara->para.flagOfInkWarning = false; - if(!SysPara::ins()->RFIDPara.needSolventCard && false){ + if(!sysPara->RFIDPara.needSolventCard && false){ emit sig_showMsg(tr("不需要刷溶剂卡!")); } - else if(SysPara::ins()->status.statWarn & WARN_STATUS_SOLV_WARN && false){ + else if(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN && false){ emit sig_showMsg(tr("请先添加溶剂再刷溶剂卡!")); } else @@ -408,14 +410,14 @@ void RFIDManager::handleCheck(unsigned int addr) LogInfo::setRunStatusText("The user has canceled the operation about marking the solvent card."); } else if(RFIDmarkCardUsedAsync(1) == 1) { - SysPara::ins()->RFIDPara.needSolventCard = false; - SysPara::ins()->RFIDPara.solventCardTimeOut = false; - SysPara::ins()->saveRFIDPara(); + sysPara->RFIDPara.needSolventCard = false; + sysPara->RFIDPara.solventCardTimeOut = false; + sysPara->saveRFIDPara(); emit sig_showMsg(tr("刷溶剂卡成功!")); - SysPara::ins()->para.flagOfSolventWarning = false; - SysPara::ins()->para.solventWarnDate = 0; - SysPara::ins()->para.solventWarnTime = 0; - SysPara::ins()->saveParaToFile(); + sysPara->para.flagOfSolventWarning = false; + sysPara->para.solventWarnDate = 0; + sysPara->para.solventWarnTime = 0; + sysPara->saveParaToFile(); } } @@ -429,16 +431,16 @@ void RFIDManager::handleCheck(unsigned int addr) emit sig_maintenanceShow(); - SysPara::ins()->RFIDPara.needMaintenance = false; - SysPara::ins()->status.needMaintenanceRemind = false; + sysPara->RFIDPara.needMaintenance = false; + sysPara->status.needMaintenanceRemind = false; QDate curDate = QDate::currentDate(); - SysPara::ins()->RFIDPara.maintenanceDate = curDate.toString("yyMMdd").toInt(); - QDate mtEndDate = curDate.addMonths(SysPara::ins()->RFIDPara.maintenanceInterval); - SysPara::ins()->RFIDPara.maintenanceEndDate = mtEndDate.toString("yyMMdd").toInt(); - SysPara::ins()->RFIDPara.runTime = 0; - RunTimeCtrl::instance()->updatePara(&SysPara::ins()->RFIDPara); - SysPara::ins()->saveRFIDPara(); + sysPara->RFIDPara.maintenanceDate = curDate.toString("yyMMdd").toInt(); + QDate mtEndDate = curDate.addMonths(sysPara->RFIDPara.maintenanceInterval); + sysPara->RFIDPara.maintenanceEndDate = mtEndDate.toString("yyMMdd").toInt(); + sysPara->RFIDPara.runTime = 0; + RunTimeCtrl::instance()->updatePara(&sysPara->RFIDPara); + sysPara->saveRFIDPara(); emit sig_showMsg(tr("刷保养卡成功!")); } else { @@ -898,7 +900,7 @@ bool RFIDManager::cardTouchConfirm(QString msgTxt, QString variableMsgTxt) QMessageBox box(QMessageBox::Warning, tr("警告"), msgTxt, QMessageBox::Ok | QMessageBox::Cancel); - int rfidCountDown = SysPara::ins()->para.rfidCountDown; + int rfidCountDown = sysPara->para.rfidCountDown; QTimer msgTimer; QString boxTxt = variableMsgTxt; connect(&msgTimer, &QTimer::timeout, [this, &box, &rfidCountDown, boxTxt]() { @@ -910,8 +912,8 @@ bool RFIDManager::cardTouchConfirm(QString msgTxt, QString variableMsgTxt) } }); - if(SysPara::ins()->para.rfidCountDown > 0) { - box.setText(boxTxt.arg(SysPara::ins()->para.rfidCountDown)); + if(sysPara->para.rfidCountDown > 0) { + box.setText(boxTxt.arg(sysPara->para.rfidCountDown)); msgTimer.start(1000); } diff --git a/rfid/rfidmanager.h b/rfid/rfidmanager.h index 2dfde76..0017ba8 100644 --- a/rfid/rfidmanager.h +++ b/rfid/rfidmanager.h @@ -7,6 +7,8 @@ #include #include +class SysPara; + typedef unsigned char UCHAR; class RFIDManager : public QObject { @@ -23,7 +25,7 @@ public: // InkJetPrinter定时器timerHandler触发,检查刷卡状态 // 初始化刷卡模块 - void initRFIDMoudle(unsigned int addr); + void initRFIDMoudle(unsigned int addr, SysPara *sysPara); // 300ms检查处理 void handleCheck(unsigned int addr); @@ -58,6 +60,7 @@ private: QString strRevdata; bool setICReaderModeFlag; uint checkCardIntervalTime; + SysPara* sysPara = nullptr; QTimer* RFIDTimer = nullptr; void initTimer(); diff --git a/scene/BarcodeEditor.cpp b/scene/BarcodeEditor.cpp index ef77b2c..05215df 100644 --- a/scene/BarcodeEditor.cpp +++ b/scene/BarcodeEditor.cpp @@ -44,11 +44,6 @@ BarcodeEditor::BarcodeEditor(QWidget *parent) : ui(new Ui::BarcodeEditor) { ui->setupUi(this); - - if (m_sysPara == nullptr) { - m_sysPara = SysPara::ins(); - } - applyStyleSheet(); m_dateFormatEditor = new DateFormatEditor(); @@ -264,7 +259,7 @@ void BarcodeEditor::applyCounterConfigToSysPara() m_sysPara->para.cnt1RepeateValue = cnt.counter1.repeatValue; m_sysPara->para.cnt1StepValue = cnt.counter1.stepValue; m_sysPara->para.cnt1CurrValue = cnt.counter1.currValue; - m_sysPara->status.cnt1CurrentValueInitDoneFlag = !cnt.counter1.editCurrValue; + m_sysPara->status.cnt1CurrentValueInitDoneFlag = cnt.counter1.editCurrValue; if(cnt.counter1.eleEyeIncEn) m_sysPara->para.eleEyeClearCntInSynMode = (m_sysPara->para.eleEyeClearCntInSynMode | 0x10); // CNT1 +1 @@ -278,7 +273,7 @@ void BarcodeEditor::applyCounterConfigToSysPara() m_sysPara->para.cnt2RepeateValue = cnt.counter2.repeatValue; m_sysPara->para.cnt2StepValue = cnt.counter2.stepValue; m_sysPara->para.cnt2CurrValue = cnt.counter2.currValue; - m_sysPara->status.cnt2CurrentValueInitDoneFlag = !cnt.counter2.editCurrValue; + m_sysPara->status.cnt2CurrentValueInitDoneFlag = cnt.counter2.editCurrValue; if(cnt.counter2.eleEyeIncEn) m_sysPara->para.eleEyeClearCntInSynMode = (m_sysPara->para.eleEyeClearCntInSynMode | 0x20); // CNT2 +1 diff --git a/scene/ItemCommon.cpp b/scene/ItemCommon.cpp index e9a9228..9a18df7 100644 --- a/scene/ItemCommon.cpp +++ b/scene/ItemCommon.cpp @@ -419,17 +419,17 @@ QString ItemUtils::generateTxtFromDateItemModel(const DateItemModel &model, cons QString ItemUtils::generateTxtFromBarcodeViewModel(const BarcodeViewModel &vm, const std::array counterValues, const QDateTime &time) { QString txt = vm.contentPattern; - auto pos = vm.contentPattern.indexOf("{t}"); + auto pos = txt.indexOf("{t}"); if(pos != -1) { - txt.replace(pos, 3, generateTxtFromDateItemModel(vm.dateViewModel, time)); + txt = txt.replace(pos, 3, generateTxtFromDateItemModel(vm.dateViewModel, time)); } - pos = vm.contentPattern.indexOf("{c}"); + pos = txt.indexOf("{c}"); if(pos != -1) { auto cntValue = vm.counterViewModel.counterType == COUNTER_TYPE_1 ? counterValues[0] : counterValues[1]; - auto valueStr = QString("%1").arg(cntValue, 10, QChar('0'));; + auto valueStr = QString("%1").arg(cntValue, 8, 10, QLatin1Char('0')); valueStr = valueStr.right(vm.counterViewModel.digitalNum); - txt.replace(pos, 3, valueStr); + txt = txt.replace(pos, 3, valueStr); } return txt; diff --git a/scene/ScheduleShiftsEditor.ui b/scene/ScheduleShiftsEditor.ui index f3b5dc8..2820f3c 100644 --- a/scene/ScheduleShiftsEditor.ui +++ b/scene/ScheduleShiftsEditor.ui @@ -10,6 +10,12 @@ 550 + + + 800 + 16777215 + + Form diff --git a/scene/piccodeitem.cpp b/scene/piccodeitem.cpp index 550b0cf..ec9140e 100644 --- a/scene/piccodeitem.cpp +++ b/scene/piccodeitem.cpp @@ -1,6 +1,7 @@ #include "piccodeitem.h" #include "ItemCommon.h" #include +#include "LogInfo.h" PicCodeItem::PicCodeItem(QGraphicsItem *parent, QGraphicsScene *scene, const SourceType type) :PicTextItem(parent, scene, type), @@ -55,7 +56,9 @@ bool PicCodeItem::updateVariants(const QVector counters) return false; } m_currCounterValues = counters; - return updateVariants(); + auto b = updateVariants(); + + return b; } QImage PicCodeItem::itemImage() diff --git a/scene/pictextitem.cpp b/scene/pictextitem.cpp index 68ae30a..2e03cff 100644 --- a/scene/pictextitem.cpp +++ b/scene/pictextitem.cpp @@ -265,6 +265,13 @@ void PicTextItem::setAttrs(const QXmlStreamAttributes &attrs) setCustomFont(fontFamilyRef.toString()); } + qDebug() << "Text item properties: \r\n" + << "\t direction: " << direction() + << "\t boldMultiple: " << boldMultiple() + << "\t colorReversal: " << colorReversal() + << "\t letterSpace: " << letterSpace() + << "\t fontFamily: " << font().family(); + setCustomAttrs(attrs); } @@ -427,9 +434,17 @@ void PicTextItem::letterSpaceChanged() QImage PicTextItem::strToImage(const QString &str) { + if(str.isEmpty()) + return QImage(); + QPainter painter; QFontMetrics fm(font()); QImage img(fm.horizontalAdvance(str), fm.height(), QImage::Format_ARGB32); + qDebug() << "strToImage: letterSpace: " << letterSpace(); + + if(letterSpace() == 2) { + qDebug() << "Break point"; + } QRgb txtColor = colorReversal() ? 0xffffffff : 0xff000000; QRgb bgColor = colorReversal() ? 0xff000000 : 0x00000000; diff --git a/setnumdlg.cpp b/setnumdlg.cpp index 568f213..6410555 100644 --- a/setnumdlg.cpp +++ b/setnumdlg.cpp @@ -26,23 +26,16 @@ int SetNumDlg::getNum() return num; } -bool SetNumDlg::getIsSetCur() -{ - return isSetCur; -} - -int SetNumDlg::getCurNum() -{ - return curNum; -} - void SetNumDlg::on_btn_confirm_clicked() { num = ui->sb_num->value(); isSet = ui->cb_setNum->isChecked(); - curNum = ui->sb_curNum->value(); - isSetCur = ui->cb_setCurNum->isChecked(); this->hide(); emit sig_setNum(); } + +void SetNumDlg::on_btn_clearProductCnt_clicked() +{ + emit sig_clearCnt(); +} diff --git a/setnumdlg.h b/setnumdlg.h index d8a171d..5343600 100644 --- a/setnumdlg.h +++ b/setnumdlg.h @@ -19,25 +19,21 @@ public: int getNum(); - bool getIsSetCur(); - - int getCurNum(); - private slots: void on_btn_confirm_clicked(); + void on_btn_clearProductCnt_clicked(); + private: Ui::SetNumDlg *ui; // 是否采用预设值 bool isSet = false; unsigned int num = 0; - // 是否采用当前值 - bool isSetCur =false; - unsigned int curNum = 0; - signals: void sig_setNum(); + + void sig_clearCnt(); }; #endif // SETNUMDLG_H diff --git a/setnumdlg.ui b/setnumdlg.ui index 79d632f..d95eb7e 100644 --- a/setnumdlg.ui +++ b/setnumdlg.ui @@ -16,8 +16,8 @@ - 180 - 40 + 160 + 50 120 50 @@ -54,8 +54,8 @@ - 300 - 210 + 290 + 50 100 50 @@ -83,55 +83,17 @@ 预设值: - + 20 - 150 - 120 - 50 - - - - - 120 - 50 - - - - 99999999 - - - - - - 20 - 110 - 71 - 31 + 160 + 111 + 61 - 当前值: - - - - - - 180 - 150 - 120 - 50 - - - - - 100 - 50 - - - - 采用当前值 + 清空产品计数 diff --git a/systemsetting.ui b/systemsetting.ui index 1837e14..d403533 100644 --- a/systemsetting.ui +++ b/systemsetting.ui @@ -409,43 +409,6 @@ - - - - - 0 - 0 - - - - - 0 - 37 - - - - - 16777215 - 37 - - - - - 文本模式 - - - - - 点阵模式 - - - - - 场景模式 - - - - @@ -529,16 +492,6 @@ - - - - 信息编辑模式: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -833,8 +786,14 @@ - + + + + 0 + 0 + + 0 @@ -875,6 +834,9 @@ 喷嘴逆清洗 + + false + @@ -900,6 +862,9 @@ 重置高压 + + false + diff --git a/testprintwidget.cpp b/testprintwidget.cpp index 976a8a6..a18be64 100644 --- a/testprintwidget.cpp +++ b/testprintwidget.cpp @@ -29,10 +29,6 @@ TestPrintWidget::TestPrintWidget(QWidget* parent) // 加载UI文件 ui.setupUi(this); - if (sysPara == nullptr) { - sysPara = SysPara::ins(); - } - // 关联成员变量到UI控件 // m_TextEdit = ui.m_TextEdit; m_LineEdit = ui.m_LineEdit; @@ -230,6 +226,14 @@ TestPrintWidget::TestPrintWidget(QWidget* parent) // ui.btnList->hide(); } +void TestPrintWidget::bindSysPara(SysPara *sysPara) +{ + this->sysPara = sysPara; + + // 它需要这个 + m_barcodeEditor.bindSysPara(sysPara); +} + TestPrintWidget::~TestPrintWidget() { if(m_pSavePicScene) @@ -931,7 +935,7 @@ void TestPrintWidget::onSceneAccepted(PicTextItem *pTextItem){ // //fmt.setFontWordSpacing(sysPara->para.textEditCharSpace); // fmt.setFontLetterSpacing(sysPara->para.textEditCharSpace); qDebug() << sysPara->para.textEditCharSpace; // mergeFormatOnWordOrSelection(fmt); - pTextItem->setLetterSpace(sysPara->para.textEditCharSpace); + // pTextItem->setLetterSpace(sysPara->para.textEditCharSpace); sysPara->saveParaToFile(); } diff --git a/testprintwidget.h b/testprintwidget.h index efde28c..40758c8 100644 --- a/testprintwidget.h +++ b/testprintwidget.h @@ -56,6 +56,7 @@ public: void createItemImage(); void getShowSelectItemText(); + void bindSysPara(SysPara *sysPara); void on_openfileButton_pressed();