2026年6月22日 :大量更新

This commit is contained in:
2026-06-22 08:51:10 +08:00
parent be39714c5e
commit 0fb69c2897
75 changed files with 1518 additions and 528 deletions
+8 -6
View File
@@ -11,10 +11,6 @@ CounterVarSet::CounterVarSet(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
ui->label_35->hide(); ui->label_35->hide();
ui->spinBoxdecimalpointnum->hide(); ui->spinBoxdecimalpointnum->hide();
ui->pushButtonVAR->hide(); ui->pushButtonVAR->hide();
@@ -38,6 +34,11 @@ void CounterVarSet::init()
connect(ui->closeBtn, &QPushButton::clicked, this, &CounterVarSet::buttonClickedSlot); connect(ui->closeBtn, &QPushButton::clicked, this, &CounterVarSet::buttonClickedSlot);
} }
void CounterVarSet::bindSysPara(SysPara *sysPara)
{
this->sysPara = sysPara;
}
void CounterVarSet::bindTxTEdit(QTextEdit* textEdit){ void CounterVarSet::bindTxTEdit(QTextEdit* textEdit){
m_textEdit = textEdit; m_textEdit = textEdit;
} }
@@ -178,14 +179,15 @@ void CounterVarSet::applyUIPara(){
sysPara->para.cnt1StartValue = ui->spinBoxCnt1StartValue->value(); sysPara->para.cnt1StartValue = ui->spinBoxCnt1StartValue->value();
sysPara->para.cnt1StepValue = ui->spinBoxCnt1StepValue->value(); sysPara->para.cnt1StepValue = ui->spinBoxCnt1StepValue->value();
sysPara->para.cnt1CurrValue = ui->spinBoxCnt1CurrValue->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.cnt2EndValue = ui->spinBoxCnt2EndValue->value();
sysPara->para.cnt2RepeateValue = ui->spinBoxCnt2RepeateCnt->value(); sysPara->para.cnt2RepeateValue = ui->spinBoxCnt2RepeateCnt->value();
sysPara->para.cnt2StartValue = ui->spinBoxCnt2StartValue->value(); sysPara->para.cnt2StartValue = ui->spinBoxCnt2StartValue->value();
sysPara->para.cnt2StepValue = ui->spinBoxCnt2StepValue->value(); sysPara->para.cnt2StepValue = ui->spinBoxCnt2StepValue->value();
sysPara->para.cnt2CurrValue = ui->spinBoxCnt2CurrValue->value(); sysPara->para.cnt2CurrValue = ui->spinBoxCnt2CurrValue->value();
sysPara->status.cnt2CurrentValueInitDoneFlag = !ui->checkBoxResetCnt2CurrValue->isChecked(); sysPara->status.cnt2CurrentValueInitDoneFlag = ui->checkBoxResetCnt2CurrValue->isChecked();
if(ui->eleCNT1IncEn->isChecked()) if(ui->eleCNT1IncEn->isChecked())
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x10); // CNT1 +1 sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x10); // CNT1 +1
+2
View File
@@ -24,6 +24,8 @@ public:
void getValue(int *varType,int *digitalWidth,unsigned char *splitMode); void getValue(int *varType,int *digitalWidth,unsigned char *splitMode);
void on_buttonInsertVari_pressed(); void on_buttonInsertVari_pressed();
void bindSysPara(SysPara *sysPara);
void bindTxTEdit(QTextEdit* textEdit); void bindTxTEdit(QTextEdit* textEdit);
QString getFamilyName(int); QString getFamilyName(int);
+4 -4
View File
@@ -14,10 +14,6 @@ DateVarSet::DateVarSet(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
digitWidth = 4; digitWidth = 4;
varTypeSet = 0; varTypeSet = 0;
@@ -132,6 +128,10 @@ void DateVarSet::initReplaceValue(){
} }
void DateVarSet::bindSysPara(SysPara *sysPara){
this->sysPara = sysPara;
}
void DateVarSet::buttonClickedSlot() void DateVarSet::buttonClickedSlot()
{ {
QPushButton* btn = qobject_cast<QPushButton*>(sender()); QPushButton* btn = qobject_cast<QPushButton*>(sender());
+1 -1
View File
@@ -32,7 +32,7 @@ public:
void bindSysPara(SysPara *sysPara); void bindSysPara(SysPara *sysPara);
void bindTxTEdit(QTextEdit* textEdit); void bindTxTEdit(QTextEdit* textEdit);
void on_buttonInsertVari_pressed(); void on_buttonInsertVari_pressed();
+4 -3
View File
@@ -2559,8 +2559,8 @@ int DevOp::writeFpgaPrintPara(bool ignoreWarn){
} }
} }
else if(sysPara->status.build_dat.builTime == 73){ else if(sysPara->status.build_dat.builTime == 73){
writeDacValue2Fpga_No73();
if(sysPara->status.currVoltageVersion != sysPara->status.lastVoltageVersion){ if(sysPara->status.currVoltageVersion != sysPara->status.lastVoltageVersion){
writeDacValue2Fpga_No73();
sysPara->status.lastVoltageVersion = sysPara->status.currVoltageVersion; sysPara->status.lastVoltageVersion = sysPara->status.currVoltageVersion;
} }
} }
@@ -2639,8 +2639,9 @@ int DevOp::writeFpgaPrintPara(bool ignoreWarn){
expected_voltage_DAC += highVoltageStep*(sysPara->para.HighVoltageAmplitude%10)/10; expected_voltage_DAC += highVoltageStep*(sysPara->para.HighVoltageAmplitude%10)/10;
if(!expected_voltage_DAC){ if(!expected_voltage_DAC){
sysPara->para.maxHighVoltageDAC = 0; //为零时,逻辑将忽略所有高压故障 sysPara->para.maxHighVoltageDAC = 0; //为零时,逻辑将忽略所有高压故障
if(!ignoreWarn) if(!ignoreWarn){
QMessageBox::warning(NULL,tr("警告"),tr("字高太小或是高压包数据未初始化,您当前错误将忽略所有高压错误")); QMessageBox::warning(nullptr, tr("警告"),tr("字高太小或是高压包数据未初始化,您当前错误将忽略所有高压错误"));
}
} }
else else
sysPara->para.maxHighVoltageDAC = expected_voltage_DAC + sysPara->para.highVoltageLevel; sysPara->para.maxHighVoltageDAC = expected_voltage_DAC + sysPara->para.highVoltageLevel;
+34 -14
View File
@@ -19,9 +19,6 @@ static unsigned int PulseCnt = 0; //时间间隔内的脉冲累计数
InkJetPrinter::InkJetPrinter(QWidget* parent) InkJetPrinter::InkJetPrinter(QWidget* parent)
: QWidget(parent) : QWidget(parent)
{ {
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
// 加载.ui文件生成的UI界面 // 加载.ui文件生成的UI界面
ui.setupUi(this); ui.setupUi(this);
@@ -158,6 +155,22 @@ void InkJetPrinter::init()
m_LogInfo->checkState(); 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) if(sysPara->para.gearPumpEnable)
pushButtonStartFlag = true; pushButtonStartFlag = true;
@@ -283,6 +296,7 @@ void InkJetPrinter::init()
void InkJetPrinter::slt_editCounter(CounterViewModel vm) void InkJetPrinter::slt_editCounter(CounterViewModel vm)
{ {
if (m_CounterVarSet) { if (m_CounterVarSet) {
m_CounterVarSet->updateSysParaToUI();
m_CounterVarSet->setCounterConfig(vm); m_CounterVarSet->setCounterConfig(vm);
m_StackedWidget->setCurrentWidget(m_CounterVarSet); m_StackedWidget->setCurrentWidget(m_CounterVarSet);
} }
@@ -699,20 +713,16 @@ void InkJetPrinter::timerHandler(void){
} }
if(pulse_1s && flagOfSerialThreadStratEn){ if(pulse_1s && flagOfSerialThreadStratEn){
#ifdef ARCH_AARCH64
if (!m_serialThreadFPGA->isRunning()) { if (!m_serialThreadFPGA->isRunning()) {
qDebug()<<"start FPGA tread"; qDebug()<<"start FPGA tread";
#ifdef ARCH_AARCH64
m_serialThreadFPGA->start(); m_serialThreadFPGA->start();
LogInfo::setRunStatusText(tr("FPGA tread start"));
#endif
} }
if (!m_serialThreadSTM32->isRunning()){ if (!m_serialThreadSTM32->isRunning()){
qDebug()<<"start STM32 tread"; qDebug()<<"start STM32 tread";
#ifdef ARCH_AARCH64
m_serialThreadSTM32->start(); m_serialThreadSTM32->start();
LogInfo::setRunStatusText(tr("STM32 tread start")); }
#endif #endif
}
flagOfSerialThreadStratEn = false; flagOfSerialThreadStratEn = false;
} }
@@ -815,7 +825,7 @@ void InkJetPrinter::timerHandler(void){
// } // }
if(sysPara->status.isPrinting) { if(sysPara->status.isPrinting) {
m_MainWidget->SendPrintDataToFpga(0); m_MainWidget->SendPrintDataToFpga(0, true);
} }
if(m_StackedWidget->currentWidget() == m_MainWidget) { if(m_StackedWidget->currentWidget() == m_MainWidget) {
@@ -873,6 +883,12 @@ void InkJetPrinter::timerHandler(void){
sysPara->devOp->mainInkCtrl(); sysPara->devOp->mainInkCtrl();
sysPara->status.canRunAirPushing = true; 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) if(sysPara->para.Reciclar)
test_flag = 1; test_flag = 1;
} }
@@ -945,7 +961,7 @@ void InkJetPrinter::timerHandler(void){
LogInfo::setRunStatusText(QString("jd.addr:%1").arg(addr)); LogInfo::setRunStatusText(QString("jd.addr:%1").arg(addr));
flag6 = false; flag6 = false;
if (manager_rfid) if (manager_rfid)
manager_rfid->initRFIDMoudle(addr); manager_rfid->initRFIDMoudle(addr, sysPara);
} }
if(pulse_300ms){ if(pulse_300ms){
@@ -1360,6 +1376,7 @@ void InkJetPrinter::getTestPrintWidgetButtonClickedSlot(int index)
case 9: case 9:
{ {
m_PrintSetting->updateSysParaToUI();
m_StackedWidget->setCurrentWidget(m_PrintSetting); m_StackedWidget->setCurrentWidget(m_PrintSetting);
break; break;
} }
@@ -1862,7 +1879,11 @@ void InkJetPrinter::closeSerialFPGA(){
} }
void InkJetPrinter::closeSerialSTM32(){ void InkJetPrinter::closeSerialSTM32(){
if(m_serialThreadSTM32->isRunning()){ if(m_serialThreadSTM32->isRunning()){
LogInfo::setRunStatusText("Closing STM32 serial port and exit thread...");
m_serialThreadSTM32->requestInterruption(); m_serialThreadSTM32->requestInterruption();
m_serialThreadSTM32->quit(); m_serialThreadSTM32->quit();
m_serialThreadSTM32->wait(); m_serialThreadSTM32->wait();
@@ -2327,7 +2348,7 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
if(sysPara->devOp->isReclaimTankOpenEnable()) if(sysPara->devOp->isReclaimTankOpenEnable())
sysPara->devOp->controlReclaimTankOpen(false); //到头,关闭 sysPara->devOp->controlReclaimTankOpen(false); //到头,关闭
sysPara->status.reclainTankReachEnd = true; sysPara->status.reclainTankReachEnd = true;
// m_MainWidget->setRunStatus(tr("回收槽到头")); m_MainWidget->setRunStatus(tr("回收槽到头"));
m_MainWidget->setReclaimStatus(true, 100); m_MainWidget->setReclaimStatus(true, 100);
m_MainWidget->enablePrintButton(true); //仅仅在此时能使能打印按钮 m_MainWidget->enablePrintButton(true); //仅仅在此时能使能打印按钮
sysPara->devOp->highVoltageCtrl(1); sysPara->devOp->highVoltageCtrl(1);
@@ -2750,7 +2771,6 @@ void InkJetPrinter::initRFIDManager()
this, &InkJetPrinter::slt_showMsg); this, &InkJetPrinter::slt_showMsg);
connect(manager_rfid,SIGNAL(sig_maintenanceShow()), connect(manager_rfid,SIGNAL(sig_maintenanceShow()),
m_MainInstruction,SLOT(maintenanceDialogShow())); m_MainInstruction,SLOT(maintenanceDialogShow()));
} }
} }
#endif #endif
+2
View File
@@ -15,6 +15,8 @@ ItemEditor::ItemEditor(QWidget *parent) :
gridLayout->setContentsMargins(0, 0, 0, 0); gridLayout->setContentsMargins(0, 0, 0, 0);
gridLayout->addWidget(m_generalSettings); gridLayout->addWidget(m_generalSettings);
ui->generalSettingsTab->setLayout(gridLayout); ui->generalSettingsTab->setLayout(gridLayout);
ui->okBtn->setMinimumSize(100, 40);
} }
ItemEditor::~ItemEditor() ItemEditor::~ItemEditor()
+25 -25
View File
@@ -35,23 +35,16 @@
<property name="rightMargin"> <property name="rightMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0" colspan="2"> <item row="1" column="0">
<widget class="QWidget" name="titlePanel" native="true"> <widget class="QTabWidget" name="tabWidget">
<property name="minimumSize"> <property name="currentIndex">
<size> <number>0</number>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color:#4E679F;</string>
</property> </property>
<widget class="QWidget" name="generalSettingsTab">
<attribute name="title">
<string>整体设置</string>
</attribute>
</widget>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="2" column="0" colspan="2">
@@ -146,16 +139,23 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="0" column="0" colspan="2">
<widget class="QTabWidget" name="tabWidget"> <widget class="QWidget" name="titlePanel" native="true">
<property name="currentIndex"> <property name="minimumSize">
<number>0</number> <size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color:#4E679F;</string>
</property> </property>
<widget class="QWidget" name="generalSettingsTab">
<attribute name="title">
<string>整体设置</string>
</attribute>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
+25 -16
View File
@@ -23,10 +23,6 @@ LogInfo::LogInfo(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
ui->textEditRunStatus->setReadOnly(true); ui->textEditRunStatus->setReadOnly(true);
ui->textEditRunStatus_2->setReadOnly(true); ui->textEditRunStatus_2->setReadOnly(true);
textEdit = ui->textEditRunStatus; textEdit = ui->textEditRunStatus;
@@ -62,6 +58,10 @@ LogInfo::LogInfo(QWidget *parent) :
ui->label_11->setText(tr("齿轮泵转速")); ui->label_11->setText(tr("齿轮泵转速"));
connect(ui->labelFaultResume,SIGNAL(pressed()),this,SIGNAL(faultTesumePress())); connect(ui->labelFaultResume,SIGNAL(pressed()),this,SIGNAL(faultTesumePress()));
timerCheckReclaimStatus = new QTimer(this);
connect(timerCheckReclaimStatus, &QTimer::timeout, this, &LogInfo::checkReclaimStatus);
timerCheckReclaimStatus->start(500);
} }
LogInfo::~LogInfo() LogInfo::~LogInfo()
@@ -514,6 +514,11 @@ void LogInfo::updateSysStatusToUI(const AlarmStatus& alarmStatus){
} }
void LogInfo::bindSysPara(SysPara *sysPara)
{
this->sysPara = sysPara;
}
void LogInfo::checkState() void LogInfo::checkState()
{ {
ui->tabWidget->setCurrentIndex(3); 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() void LogInfo::lockUI()
{ {
@@ -664,16 +685,4 @@ void LogInfo::showEvent(QShowEvent *event)
// 先执行父类事件 // 先执行父类事件
QWidget::showEvent(event); QWidget::showEvent(event);
// 更新UI和状态 // 更新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) );
}
}
} }
+7 -1
View File
@@ -58,6 +58,7 @@ public:
void init(); void init();
void applyStyleSheet(); // 应用样式表 void applyStyleSheet(); // 应用样式表
void bindSysPara(SysPara *sysPara);
void updateSysStatusToUI(const AlarmStatus& alarmStatus); void updateSysStatusToUI(const AlarmStatus& alarmStatus);
@@ -80,6 +81,9 @@ private slots:
void on_btn_clean_clicked(); void on_btn_clean_clicked();
void slt_cleanOver(bool flag); void slt_cleanOver(bool flag);
void checkReclaimStatus();
signals: signals:
void sendButtonClickedSignal(int); void sendButtonClickedSignal(int);
void faultTesumePress(); void faultTesumePress();
@@ -96,12 +100,14 @@ private:
static QString r_CurrentDate; static QString r_CurrentDate;
QTimer *timerLogdel; QTimer *timerLogdel;
QTimer *timerCheckReclaimStatus = nullptr;
LogInfoCtrl *ctrl_loginfo = nullptr; LogInfoCtrl *ctrl_loginfo = nullptr;
// 锁定全局控件,放出逆清洗 // 锁定全局控件,放出逆清洗
void lockUI(); void lockUI();
void unlockUI(); void unlockUI();
protected: protected:
SysPara *sysPara; SysPara *sysPara = nullptr;
void showEvent(QShowEvent *event) override; void showEvent(QShowEvent *event) override;
}; };
+4 -4
View File
@@ -11,10 +11,6 @@ MainInstruction::MainInstruction(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
m_graphicsEditor = new ZkEdit(); m_graphicsEditor = new ZkEdit();
// 连接几个特殊按钮,这些按钮将由外部处理 // 连接几个特殊按钮,这些按钮将由外部处理
@@ -68,6 +64,10 @@ MainInstruction::~MainInstruction()
delete m_graphicsEditor; delete m_graphicsEditor;
} }
void MainInstruction::bindSysPara(SysPara *sysPara){
this->sysPara = sysPara;
}
void MainInstruction::onGraphicsEditBtnClicked() void MainInstruction::onGraphicsEditBtnClicked()
{ {
// 在arm主机上以全屏模式显示,而在x86上无所谓 // 在arm主机上以全屏模式显示,而在x86上无所谓
+2
View File
@@ -27,6 +27,8 @@ public:
~MainInstruction(); ~MainInstruction();
void onSpecialButtonClicked(int btnID); void onSpecialButtonClicked(int btnID);
void bindSysPara(SysPara *SysPara);
DlgInputAddr *dlgInputAddr; DlgInputAddr *dlgInputAddr;
signals: signals:
+1 -1
View File
@@ -98,7 +98,7 @@
</rect> </rect>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tabBasic"> <widget class="QWidget" name="tabBasic">
<attribute name="title"> <attribute name="title">
+1 -1
View File
@@ -18,7 +18,7 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>800</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
+4 -3
View File
@@ -6,9 +6,6 @@ MemDisplayAndEdit::MemDisplayAndEdit(QWidget *parent) :
ui(new Ui::MemDisplayAndEdit) ui(new Ui::MemDisplayAndEdit)
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
for(int i = 0; i < MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL; i++){ for(int i = 0; i < MEM_GRID_MAX_ROW*MEM_GRID_MAX_COL; i++){
memLineEdit[i] = new QLineEdit(this); 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) void MemDisplayAndEdit::on_comboBoxBaseAddress_activated(const QString &str)
{ {
+2
View File
@@ -22,6 +22,8 @@ public:
void updateSysStatusToUI(void); void updateSysStatusToUI(void);
void bindSysPara(SysPara *SysPara);
private slots: private slots:
void on_comboBoxBaseAddress_activated(const QString &arg1); void on_comboBoxBaseAddress_activated(const QString &arg1);
+10 -6
View File
@@ -14,12 +14,6 @@ OtherInfo::OtherInfo(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
lockPhaseFlag = sysPara->para.phaseByHand != 0;
updateLockPhaseWidgets();
}
lockedPhase = 0; lockedPhase = 0;
ui->memDisplayAndEdit->setHidden(1); ui->memDisplayAndEdit->setHidden(1);
@@ -62,6 +56,16 @@ void OtherInfo::OtherupdateSysParaToUI(){
} }
#define PHASE_BY_HAND_DIV 8 //相位会在逻辑里面放大 #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() void OtherInfo::init()
{ {
// 应用样式表 // 应用样式表
+1
View File
@@ -24,6 +24,7 @@ public:
void phaseDetectResultRecord(); void phaseDetectResultRecord();
void OtherInfoLog(); void OtherInfoLog();
void bindSysPara(SysPara *sysPara);
void applyStyleSheet(); // 应用样式表 void applyStyleSheet(); // 应用样式表
void init(); void init();
private slots: private slots:
+4 -3
View File
@@ -14,9 +14,6 @@
PhaseGraphic::PhaseGraphic(QWidget *parent) : PhaseGraphic::PhaseGraphic(QWidget *parent) :
QWidget(parent){ QWidget(parent){
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
pen.setStyle(Qt::SolidLine); pen.setStyle(Qt::SolidLine);
pen.setWidth(2); pen.setWidth(2);
pen.setBrush(Qt::red); pen.setBrush(Qt::red);
@@ -98,6 +95,10 @@ void PhaseGraphic::paintEvent(QPaintEvent *){
} }
} }
void PhaseGraphic::bindSysPara(SysPara *sysPara)
{
this->sysPara = sysPara;
}
void PhaseGraphic::updateSysStatusToUI(){ void PhaseGraphic::updateSysStatusToUI(){
update(); update();
+2
View File
@@ -25,6 +25,8 @@ public:
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *);
void bindSysPara(SysPara *sysPara);
void updateSysStatusToUI(); void updateSysStatusToUI();
void setLockedPhase(bool enable,int val); void setLockedPhase(bool enable,int val);
+5 -3
View File
@@ -23,9 +23,6 @@
PrintTextDisplay::PrintTextDisplay(QWidget *parent): PrintTextDisplay::PrintTextDisplay(QWidget *parent):
QWidget(parent){ QWidget(parent){
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
setPalette(QPalette(Qt::white)); setPalette(QPalette(Qt::white));
setAutoFillBackground(true); setAutoFillBackground(true);
@@ -98,6 +95,11 @@ int PrintTextDisplay::currScaleRatio()
return this->scaleRatio; return this->scaleRatio;
} }
void PrintTextDisplay::bindSysPara(SysPara *sysPara)
{
this->sysPara = sysPara;
}
void PrintTextDisplay::paintEvent(QPaintEvent *event){ void PrintTextDisplay::paintEvent(QPaintEvent *event){
QRect updateRect = event->rect(); QRect updateRect = event->rect();
updateRect.setY(0); updateRect.setY(0);
+2
View File
@@ -37,6 +37,8 @@ public:
int currScaleRatio(); int currScaleRatio();
void bindSysPara(SysPara *sysPara);
void scroll_update(); void scroll_update();
private: private:
SysPara* sysPara = nullptr; SysPara* sysPara = nullptr;
+148 -97
View File
@@ -9,11 +9,6 @@ PrintSetting::PrintSetting(QWidget *parent) :
ui(new Ui::PrintSetting) ui(new Ui::PrintSetting)
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
m_checkBtn = ui->checkBtn; m_checkBtn = ui->checkBtn;
m_closeBtn = ui->closeBtn; m_closeBtn = ui->closeBtn;
@@ -27,8 +22,21 @@ PrintSetting::PrintSetting(QWidget *parent) :
ui->labelSynTriggerPrintLenRatio->setHidden(1); ui->labelSynTriggerPrintLenRatio->setHidden(1);
ui->spinBoxSynTriggerPrintLenRatio->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(); init();
@@ -50,6 +58,26 @@ void PrintSetting::init()
connect(m_closeBtn, &QPushButton::clicked, this, &PrintSetting::buttonClickedSlot); connect(m_closeBtn, &QPushButton::clicked, this, &PrintSetting::buttonClickedSlot);
connect(m_checkBtn,&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); extern void MySleep(unsigned int msec);
@@ -69,10 +97,17 @@ void PrintSetting::on_pushButtonApply_pressed(){
applyUIPara(); applyUIPara();
applyUITriggerPara(); 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(){ void PrintSetting::applyUIPara(){
@@ -80,7 +115,7 @@ void PrintSetting::applyUIPara(){
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; //延时触发 sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; //延时触发
sysPara->para.printDelayMs = 200; //重复间隔 sysPara->para.printDelayMs = 200; //重复间隔
sysPara->para.checkSpace = 0;//ui->checkSpace->isChecked(); sysPara->para.checkSpace = 0;//ui->checkSpace->isChecked();
ui->spinBoxColDelay->setEnabled(1); // ui->spinBoxColDelay->setEnabled(1);
sysPara->para.leftRightInverse = ui->checkBoxLeftRightInverse->isChecked(); sysPara->para.leftRightInverse = ui->checkBoxLeftRightInverse->isChecked();
sysPara->para.upDownInverse = ui->checkBoxUpDownInverse->isChecked(); sysPara->para.upDownInverse = ui->checkBoxUpDownInverse->isChecked();
sysPara->para.currSelectVolPara = ui->comboBox_selcetVolPara->currentIndex(); 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(){ void PrintSetting::updateSysParaToUI(){
if(sysPara){ if(sysPara){
ui->checkBoxLeftRightInverse->setChecked(sysPara->para.leftRightInverse); ui->checkBoxLeftRightInverse->setChecked(sysPara->para.leftRightInverse);
@@ -134,6 +174,10 @@ void PrintSetting::TriggerupdateSysParaToUI(){
sysPara->para.eleEyeEdgetTriggerExternal = 1; sysPara->para.eleEyeEdgetTriggerExternal = 1;
sysPara->para.synTriggerExternal = 1; sysPara->para.synTriggerExternal = 1;
} }
qDebug() << sysPara->para.eleEyeEdgetTriggerInner;
qDebug() << sysPara->para.eleEyeEdgetTriggerExternal;
ui->eleEyeEdgetTriggerInner->setChecked(sysPara->para.eleEyeEdgetTriggerInner); ui->eleEyeEdgetTriggerInner->setChecked(sysPara->para.eleEyeEdgetTriggerInner);
ui->eleEyeEdgetTriggerExternal->setChecked(sysPara->para.eleEyeEdgetTriggerExternal); ui->eleEyeEdgetTriggerExternal->setChecked(sysPara->para.eleEyeEdgetTriggerExternal);
ui->radioButtonSynTriggerInner->setChecked(sysPara->para.synTriggerInner); ui->radioButtonSynTriggerInner->setChecked(sysPara->para.synTriggerInner);
@@ -162,15 +206,15 @@ void PrintSetting::TriggerupdateSysParaToUI(){
ui->comboBoxEleEyeMakeClean->setCurrentIndex( sysPara->para.eleEyeClearCntInSynMode & 0x0f); ui->comboBoxEleEyeMakeClean->setCurrentIndex( sysPara->para.eleEyeClearCntInSynMode & 0x0f);
ui->checkBoxPulseOutputEnable->setChecked(sysPara->para.pulseOutputEnable); ui->checkBoxPulseOutputEnable->setChecked(sysPara->para.pulseOutputEnable);
ui->labelProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable); // ui->labelProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable);
ui->spinBoxProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable); // ui->spinBoxProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable);
ui->spinBoxProductCntPerOutputPulse->setValue(sysPara->para.productCntPerOutputPulse); 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(sysPara->para.pulseOutputEnable);
ui->spinBoxOutputPulseDelayMs->setEnabled(isPulseEenable); // ui->spinBoxOutputPulseDelayMs->setEnabled(isPulseEenable);
ui->spinBoxOuputPulseCol->setValue(sysPara->para.OuputPulseCol); ui->spinBoxOuputPulseCol->setValue(sysPara->para.OuputPulseCol);
ui->comboBoxSyncActType->setCurrentIndex (sysPara->para.synchronizorActType); ui->comboBoxSyncActType->setCurrentIndex (sysPara->para.synchronizorActType);
//ui->checkBoxAutoSpeedEN->setChecked (sysPara->para.autoSynSpeedEn ); //ui->checkBoxAutoSpeedEN->setChecked (sysPara->para.autoSynSpeedEn );
@@ -190,14 +234,12 @@ void PrintSetting::TriggerupdateSysParaToUI(){
} }
void PrintSetting::updateSysStatusToUI(){ void PrintSetting::updateSysStatusToUI(){
} }
void PrintSetting::on_pushButtonApplyPulseFix_clicked() void PrintSetting::on_pushButtonApplyPulseFix_clicked()
{ {
// pulseNumFix->bindSysPara(sysPara); pulseNumFix->bindSysPara(sysPara);
// pulseNumFix->hide(); pulseNumFix->hide();
pulseNumFix->show(); pulseNumFix->show();
} }
@@ -219,7 +261,7 @@ void PrintSetting::applyUITriggerPara(){
{ {
if( sysPara->para.synTriggerPrintLenMm < sysPara->para.eleEyeTriggerPrintDelay ) if( sysPara->para.synTriggerPrintLenMm < sysPara->para.eleEyeTriggerPrintDelay )
{ {
QMessageBox::information(this,tr("提示:参数不正确"),tr("要求:触发长度小于喷印间隔")); QMessageBox::information(nullptr,tr("提示:参数不正确"),tr("要求:触发长度小于喷印间隔"));
} }
} }
sysPara->para.eleEyeEdgetTriggerInner = ui->eleEyeEdgetTriggerInner->isChecked(); sysPara->para.eleEyeEdgetTriggerInner = ui->eleEyeEdgetTriggerInner->isChecked();
@@ -259,7 +301,7 @@ void PrintSetting::GetTriggerUIPara(){
sysPara->para.timeTriggerPrintMode = ui->comboBoxTimeTriggerMode->currentIndex(); sysPara->para.timeTriggerPrintMode = ui->comboBoxTimeTriggerMode->currentIndex();
sysPara->para.elecEyeTriggerInterval = ui->spinBoxEleEyeTriggerIntervalMs->value(); //电眼触发的重复间隔 sysPara->para.elecEyeTriggerInterval = ui->spinBoxEleEyeTriggerIntervalMs->value(); //电眼触发的重复间隔
int value = 0; int value = 0;
if (ui->cb_unlimited->isChecked()) value = 65535; if (ui->cb_unlimited->isChecked()) value = UINT_MAX / 2;
else value = ui->spinBoxEleEyeTriggerRepeatCnt->value(); else value = ui->spinBoxEleEyeTriggerRepeatCnt->value();
sysPara->para.photoElectricityRepeateNum = value; sysPara->para.photoElectricityRepeateNum = value;
@@ -297,11 +339,23 @@ void PrintSetting::GetTriggerUIPara(){
else else
sysPara->para.printTriggerMode = PRINT_TRIGGER_NONE; 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 (); // sysPara->para.eleEyeTriggerSynPrintEn = ui->checkEyeTriggerSynPrintEn->isChecked ();
if(ui->eleEyeEdgetTriggerExternal->isChecked() && ui->radioButtonSynTriggerExternal->isChecked()) //都选外部--电眼+同步触发 // sysPara->para.eleEyeTriggerSynPrintEn = ui->eleEyeEdgetTriggerExternal->isChecked() && ui->radioButtonSynTriggerExternal->isChecked();
sysPara->para.eleEyeTriggerSynPrintEn=true;
else
sysPara->para.eleEyeTriggerSynPrintEn=false;
sysPara->para.eleEyeTriggerPrintDelay = ui->spinBoxEleEyeTriggerPrintDelay->value(); sysPara->para.eleEyeTriggerPrintDelay = ui->spinBoxEleEyeTriggerPrintDelay->value();
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xf0) + ui->comboBoxEleEyeMakeClean->currentIndex(); //ui->checkBoxEleEyeMakeClean->isChecked(); 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) void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
{ {
ui->cb_unlimited->setEnabled(checked); // ui->cb_unlimited->setEnabled(checked);
if(sysPara) if(sysPara)
{ {
int triggerMode = sysPara->para.printTriggerMode; int triggerMode = sysPara->para.printTriggerMode;
if( checked) if( checked)
{ {
#ifndef NON_CABLE #ifndef NON_CABLE
ui->spinBoxSynTriggerPrintLen->setEnabled(1); // ui->spinBoxSynTriggerPrintLen->setEnabled(1);
#endif #endif
ui->labelSynTriggerPrintLen->setEnabled(1); // ui->labelSynTriggerPrintLen->setEnabled(1);
ui->lineEditTriggerPulsePerMm->setEnabled(1); // ui->lineEditTriggerPulsePerMm->setEnabled(1);
ui->labelTriggerPulsePerMm->setEnabled(1); // ui->labelTriggerPulsePerMm->setEnabled(1);
ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1);
ui->labelSynTriggerPrintLenRatio->setEnabled(1); // ui->labelSynTriggerPrintLenRatio->setEnabled(1);
ui->checkBoxEleEyeMakeClean->setEnabled(1); // ui->checkBoxEleEyeMakeClean->setEnabled(1);
ui->pushButtonApplyPulseFix->setEnabled(1); // ui->pushButtonApplyPulseFix->setEnabled(1);
ui->comboBoxSynPrintMode->setEnabled(1); // ui->comboBoxSynPrintMode->setEnabled(1);
ui->labelSynPrintMode->setEnabled(1); // ui->labelSynPrintMode->setEnabled(1);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0); // ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0);
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)")); ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)")); ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
ui->labelEleMaskTime->setText(tr("抑止距离(毫米)")); ui->labelEleMaskTime->setText(tr("抑止距离(毫米)"));
@@ -392,18 +446,18 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
else else
{ {
#ifndef NON_CABLE #ifndef NON_CABLE
ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
#endif #endif
ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1); // ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1);
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)")); ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)"));
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)")); ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)"));
ui->labelEleMaskTime->setText(tr("抑止距离(毫秒)")); ui->labelEleMaskTime->setText(tr("抑止距离(毫秒)"));
@@ -412,36 +466,36 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
} }
void PrintSetting::setTriggerUI(int triggerMode){ void PrintSetting::setTriggerUI(int triggerMode){
ui->sb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME); // ui->sb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
ui->lb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME); // ui->lb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
ui->radioButtonEleEyeEdgetTrigger->setChecked( triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE); ui->radioButtonEleEyeEdgetTrigger->setChecked( triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->radioButtonEleEyeLevelTrigger->setChecked(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL); 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->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->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->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->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->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->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->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->spinBoxEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
if(sysPara->para.eleEyeTriggerSynPrintEn && if(sysPara->para.eleEyeTriggerSynPrintEn &&
(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE) (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE)
) )
{ {
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0); // ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0);
ui->labelSynTriggerPrintLen->setEnabled(1); // ui->labelSynTriggerPrintLen->setEnabled(1);
ui->lineEditTriggerPulsePerMm->setEnabled(1); // ui->lineEditTriggerPulsePerMm->setEnabled(1);
ui->labelTriggerPulsePerMm->setEnabled(1); // ui->labelTriggerPulsePerMm->setEnabled(1);
ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1); // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1);
ui->labelSynTriggerPrintLenRatio->setEnabled(1); // ui->labelSynTriggerPrintLenRatio->setEnabled(1);
ui->checkBoxEleEyeMakeClean->setEnabled(1); // ui->checkBoxEleEyeMakeClean->setEnabled(1);
ui->pushButtonApplyPulseFix->setEnabled(1); // ui->pushButtonApplyPulseFix->setEnabled(1);
ui->comboBoxSynPrintMode->setEnabled(1); // ui->comboBoxSynPrintMode->setEnabled(1);
ui->labelSynPrintMode->setEnabled(1); // ui->labelSynPrintMode->setEnabled(1);
ui->labelEleMaskTime->setEnabled(1); // ui->labelEleMaskTime->setEnabled(1);
ui->spinBoxEleMaskTime->setEnabled(1); // ui->spinBoxEleMaskTime->setEnabled(1);
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)")); ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)")); ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
@@ -450,17 +504,17 @@ void PrintSetting::setTriggerUI(int triggerMode){
else else
{ {
#ifndef NON_CABLE #ifndef NON_CABLE
ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
#endif #endif
ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER); // ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
if(triggerMode == PRINT_TRIGGER_SYNCHRONIZER) if(triggerMode == PRINT_TRIGGER_SYNCHRONIZER)
{ {
@@ -494,11 +548,11 @@ void PrintSetting::setSynPrintMode(int mode){
ui->spinBoxSynTriggerPrintLenRatio->setValue(sysPara->para.synTriggerPrintLenRatio); 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() void PrintSetting::applyStyleSheet()
@@ -638,10 +692,12 @@ void PrintSetting::on_eleEyeEdgetTriggerInner_clicked()
setEnableEleEyeSetting(false); setEnableEleEyeSetting(false);
if (sysPara == NULL) return; if (sysPara == NULL) return;
if(ui->radioButtonSynTriggerInner->isChecked()){ if(ui->radioButtonSynTriggerInner->isChecked()){
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME;
}else }else
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER; sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
setTriggerUI(sysPara->para.printTriggerMode); setTriggerUI(sysPara->para.printTriggerMode);
sysPara->para.eleEyeTriggerSynPrintEn = false; sysPara->para.eleEyeTriggerSynPrintEn = false;
@@ -650,20 +706,14 @@ void PrintSetting::on_eleEyeEdgetTriggerInner_clicked()
void PrintSetting::setEnableEleEyeSetting(bool flag){ void PrintSetting::setEnableEleEyeSetting(bool flag){
ui->labelEleEyeTriggerIntervalMs->setEnabled(flag); ui->labelEleEyeTriggerIntervalMs->setEnabled(!(!flag && ui->radioButtonSynTriggerInner->isChecked()));
if (sysPara) {
ui->spinBoxEleEyeTriggerIntervalMs->
setEnabled(flag || sysPara->para.printTriggerMode == PRINT_TRIGGER_TIME);
}
ui->labelEleMaskTime->setEnabled(flag);
ui->spinBoxEleMaskTime->setEnabled(flag); ui->spinBoxEleMaskTime->setEnabled(flag);
ui->labelEleEyeTriggerRepeatCnt->setEnabled(flag);
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(flag); ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(flag);
ui->radioButtonEleEyeEdgetTrigger->setEnabled(flag); ui->radioButtonEleEyeEdgetTrigger->setEnabled(flag);
ui->radioButtonEleEyeLevelTrigger->setEnabled(flag); ui->radioButtonEleEyeLevelTrigger->setEnabled(flag);
ui->cb_unlimited->setEnabled(flag); ui->cb_unlimited->setEnabled(flag);
ui->sb_printingDelay->setEnabled(flag);
if (!flag) ui->cb_unlimited->setChecked(false); if (!flag) ui->cb_unlimited->setChecked(false);
} }
void PrintSetting::on_eleEyeEdgetTriggerExternal_clicked() void PrintSetting::on_eleEyeEdgetTriggerExternal_clicked()
@@ -677,13 +727,13 @@ void PrintSetting::on_eleEyeEdgetTriggerExternal_clicked()
void PrintSetting::setEnableSynTriggerSetting(bool flag){ void PrintSetting::setEnableSynTriggerSetting(bool flag){
ui->labelTriggerPulsePerMm->setEnabled(flag); // ui->labelTriggerPulsePerMm->setEnabled(flag);
ui->lineEditTriggerPulsePerMm->setEnabled(flag); ui->lineEditTriggerPulsePerMm->setEnabled(flag);
ui->pushButtonApplyPulseFix->setEnabled(flag); ui->pushButtonApplyPulseFix->setEnabled(flag);
ui->labelSynTriggerPrintLen->setEnabled(flag); // ui->labelSynTriggerPrintLen->setEnabled(flag);
ui->spinBoxSynTriggerPrintLen->setEnabled(flag); ui->spinBoxSynTriggerPrintLen->setEnabled(flag);
ui->comboBoxSyncActType->setEnabled(flag); ui->comboBoxSyncActType->setEnabled(flag);
ui->labelSynPrintMode->setEnabled(flag); // ui->labelSynPrintMode->setEnabled(flag);
ui->comboBoxSynPrintMode->setEnabled(flag); ui->comboBoxSynPrintMode->setEnabled(flag);
} }
@@ -700,7 +750,7 @@ void PrintSetting::on_radioButtonSynTriggerInner_clicked()
on_checkEyeTriggerSynPrintEn_clicked(false); on_checkEyeTriggerSynPrintEn_clicked(false);
} }
setEnableEleEyeSetting(!ui->eleEyeEdgetTriggerInner->isChecked());
} }
void PrintSetting::on_radioButtonSynTriggerExternal_clicked() void PrintSetting::on_radioButtonSynTriggerExternal_clicked()
@@ -714,6 +764,7 @@ void PrintSetting::on_radioButtonSynTriggerExternal_clicked()
on_checkEyeTriggerSynPrintEn_clicked(sysPara->para.eleEyeTriggerSynPrintEn); on_checkEyeTriggerSynPrintEn_clicked(sysPara->para.eleEyeTriggerSynPrintEn);
} }
setEnableSynTriggerSetting(true); setEnableSynTriggerSetting(true);
setEnableEleEyeSetting(!ui->eleEyeEdgetTriggerInner->isChecked());
} }
@@ -731,10 +782,10 @@ void PrintSetting::on_radioButtonEleEyeLevelTrigger_clicked()
void PrintSetting::on_checkBoxPulseOutputEnable_clicked(bool checked) void PrintSetting::on_checkBoxPulseOutputEnable_clicked(bool checked)
{ {
isPulseEenable = checked; isPulseEenable = checked;
ui->spinBoxOutputPulseDelayMs->setEnabled(checked); // ui->spinBoxOutputPulseDelayMs->setEnabled(checked);
} }
void PrintSetting::on_cb_unlimited_clicked(bool checked) void PrintSetting::on_cb_unlimited_clicked(bool checked)
{ {
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(!checked); // ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(!checked);
} }
+1
View File
@@ -23,6 +23,7 @@ public:
void updateSysParaToUI(); //重载 void updateSysParaToUI(); //重载
void applyUIPara(); //重载 void applyUIPara(); //重载
void bindSysPara(SysPara *sysPara);
void updateSysStatusToUI(); void updateSysStatusToUI();
void applyUITriggerPara(); void applyUITriggerPara();
+6
View File
@@ -902,6 +902,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>37</height>
</size>
</property>
<property name="prefix"> <property name="prefix">
<string/> <string/>
</property> </property>
+5 -3
View File
@@ -8,9 +8,6 @@ PulseNumFix::PulseNumFix(QWidget *parent) :
ui(new Ui::PulseNumFix) ui(new Ui::PulseNumFix)
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
this->setWindowTitle(tr("脉冲数修正")); this->setWindowTitle(tr("脉冲数修正"));
setUIEnableStatus(); setUIEnableStatus();
@@ -31,6 +28,11 @@ PulseNumFix::~PulseNumFix()
delete ui; delete ui;
} }
void PulseNumFix::bindSysPara(SysPara *sysPara)
{
this->sysPara = sysPara;
}
void PulseNumFix::setUIEnableStatus(){ void PulseNumFix::setUIEnableStatus(){
ui->lineEditRate->setEnabled(ui->radioButtonAccordingRate->isChecked()); ui->lineEditRate->setEnabled(ui->radioButtonAccordingRate->isChecked());
ui->labelRate->setEnabled(ui->radioButtonAccordingRate->isChecked()); ui->labelRate->setEnabled(ui->radioButtonAccordingRate->isChecked());
+2
View File
@@ -14,6 +14,8 @@ class PulseNumFix : public QDialog
public: public:
explicit PulseNumFix(QWidget *parent = 0); explicit PulseNumFix(QWidget *parent = 0);
~PulseNumFix(); ~PulseNumFix();
void bindSysPara(SysPara *sysPara);
Q_SIGNALS: Q_SIGNALS:
void pulseNuxFixDone(float); void pulseNuxFixDone(float);
+7 -5
View File
@@ -27,10 +27,6 @@ QBarCode::QBarCode(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
bcOK=false; bcOK=false;
connect(ui->BarCodeGenerate,SIGNAL(pressed()),this,SLOT(ImgSave())); connect(ui->BarCodeGenerate,SIGNAL(pressed()),this,SLOT(ImgSave()));
connect(ui->pushBarPreview,SIGNAL(pressed()),this,SLOT(onEnCodeBar())); 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; AutoCount1=bcOption->var1En | bcOption->var2En;
+1
View File
@@ -35,6 +35,7 @@ class QBarCode : public QDialog
public: public:
explicit QBarCode(QWidget *parent = 0); explicit QBarCode(QWidget *parent = 0);
~QBarCode(); ~QBarCode();
void bindSysPara(SysPara *sysPara);
//unsigned char pointMap[40*1000]; //unsigned char pointMap[40*1000];
QString pictureName;//当前显示的图片 QString pictureName;//当前显示的图片
+53 -61
View File
@@ -8,6 +8,8 @@
#include <QElapsedTimer> #include <QElapsedTimer>
#include <QEventLoop> #include <QEventLoop>
#include <QCoreApplication> #include <QCoreApplication>
#include <QTime>
#define MAX_LEN1 1024 #define MAX_LEN1 1024
#define MAX_LEN2 224 #define MAX_LEN2 224
@@ -31,8 +33,8 @@ Serial::Serial(const QString comport)
} }
Serial::~Serial(){ Serial::~Serial(){
if(serial) if (serial) serial->close();
serial->close();
} }
int baudRateValue = 0; int baudRateValue = 0;
@@ -153,11 +155,11 @@ void Serial::readData(){
if(!isCommunication) return; if(!isCommunication) return;
if(!timerRead->isActive() && !flagOfUpgradeSTM32) if(!timerRead->isActive() && !flagOfUpgradeSTM32)
timerRead->start(50); timerRead->start(50);
QByteArray recData = serial->readAll(); QByteArray recDat = serial->readAll();
if(com == "/dev/ttyAS5") if(com == "/dev/ttyAS5")
readFPGAData(recData); readFPGAData(recDat);
else if(com == "/dev/ttyAS2") else if(com == "/dev/ttyAS2")
readSTM32Data(recData); readSTM32Data(recDat);
} }
unsigned char dataFPGA_FE[12] = {0}; unsigned char dataFPGA_FE[12] = {0};
@@ -169,11 +171,9 @@ unsigned char dataFPGA_1B8[12] = {0};
void Serial::readFPGAData(QByteArray data) { void Serial::readFPGAData(QByteArray data) {
recData.append(data); recData.append(data);
if(recData.length() < curLen+10){ if(recData.length() < curLen+10){
return; return;
} }
if(timerRead->isActive()) if(timerRead->isActive())
timerRead->stop(); timerRead->stop();
@@ -189,30 +189,39 @@ void Serial::readFPGAData(QByteArray data) {
/***************出队列***************/ /***************出队列***************/
{ {
QMutexLocker locker(&Mutex); QMutexLocker locker(&Mutex);
if(recData[1]==0x01 || !set.contains(addr)){ if(recData[1]==0x01 || !set.contains(addr)){
if(queue.size() > 0) if(queue.size() > 0)
queue.dequeue(); queue.dequeue();
} }
} }
if(queue.size() > 1){ if(queue.size() > 0){
qDebug()<<"send FPGA queue data 0"; qDebug()<<"send FPGA queue data 0";
emit sendQueueData(0,0,NULL,0,0); emit sendQueueData(0,0,NULL,0,0);
} }
int headCode=recData[0]; int headCode=recData[0];
if(headCode != 0xAA){ if(headCode != 0xAA){
qDebug()<<"FPGA接收数据帧头错误:Frameheader"<<QString::number(headCode).toInt() << "addr:"<<hexData; qDebug()<<"FPGA接收数据帧头错误:Frameheader"<<QString::number(headCode).toInt() << "addr:"<<hexData;
recData.clear(); // 帧头错误,清空缓冲区防止持续累积
return ; return ;
} }
if(!calCRC16CodeIn(recData)){ if(!calCRC16CodeIn(recData)){
FPGACRCErrorCNt++; FPGACRCErrorCNt++;
QString hexString = QString(recData.mid(2, 3).toHex()); QString hexString = QString(recData.mid(2, 3).toHex());
qDebug()<<"FPGA CRC校验码错误:CRC"<<CRCRec<<"addr:"<<hexString<<hexData; qDebug()<<"FPGA CRC校验码错误:CRC"<<CRCRec<<"addr:"<<hexString<<hexData;
recData.clear(); // CRC错误,清空缓冲区防止持续累积
// CRC错误时也需要出队,否则队列会积压
{
QMutexLocker locker(&Mutex);
if(queue.size() > 0)
queue.dequeue();
}
return; return;
} }
if(recData[1] == 0x02 && set.contains(addr) && recData[7] != 0x00){ if(recData[1] == 0x02 && set.contains(addr) && recData[7] != 0x00){
qDebug()<<"FPGA写错误"; qDebug()<<"FPGA写错误";
recData.clear();
emit resendFPGAData(2,addr,NULL,1,0); emit resendFPGAData(2,addr,NULL,1,0);
return; return;
} }
@@ -236,8 +245,7 @@ void Serial::readFPGAData(QByteArray data) {
memcpy(dataFPGA_100,recData.constData(),74); memcpy(dataFPGA_100,recData.constData(),74);
emit getFPGAPhaseDetectHighTm(dataFPGA_100); emit getFPGAPhaseDetectHighTm(dataFPGA_100);
break; break;
case 0x180: case 0x180:{
{
//dataofFPGACalandarAndDat=reinterpret_cast<unsigned char*>(recData.data()); //dataofFPGACalandarAndDat=reinterpret_cast<unsigned char*>(recData.data());
memcpy(dataFPGA_180,recData.constData(),26); memcpy(dataFPGA_180,recData.constData(),26);
emit getFPGACalandarAndDat(dataFPGA_180); emit getFPGACalandarAndDat(dataFPGA_180);
@@ -266,8 +274,9 @@ void Serial::readFPGAData(QByteArray data) {
emit FPGABuildDat(fpgaBuildDat); emit FPGABuildDat(fpgaBuildDat);
break; break;
} }
}
} }
} recData.clear(); // 正常处理完毕,清空缓冲区
} }
@@ -300,16 +309,15 @@ void Serial::readSTM32Data(QByteArray data) {
{ {
QMutexLocker locker(&Mutex); QMutexLocker locker(&Mutex);
if(queue.size() > 0){ if(queue.size() > 0){
queue.dequeue(); queue.dequeue();
} }
} }
if(queue.size() > 2){ if(queue.size() > 0){
qDebug()<<"send STM32 queue data 0"; qDebug()<<"send STM32 queue data 0";
emit sendQueueData(0,0,NULL,0,0); emit sendQueueData(0,0,NULL,0,0);
} }
int addr = recData[2]; int addr = recData[2];
int headCode = recData[0]; int headCode = recData[0];
if(headCode != 0xBB){ if(headCode != 0xBB){
@@ -319,26 +327,29 @@ void Serial::readSTM32Data(QByteArray data) {
} }
if(recData[1] != 0xF0 && recData[1] != 0x01 && recData[1] != 0x02){ if(recData[1] != 0xF0 && recData[1] != 0x01 && recData[1] != 0x02){
qDebug()<<"STM32接收指令字节错误."<< "addr:"<<QString::number(addr).toInt(); qDebug()<<"STM32接收指令字节错误."<< "addr:"<<QString::number(addr).toInt();
recData.clear(); // 指令字节错误,清空缓冲区
return ; return ;
} }
if(!calCRC16CodeIn(recData)){ if(!calCRC16CodeIn(recData)){
STM32CRCErrorCNt++; STM32CRCErrorCNt++;
qDebug()<<"STM32 CRC校验码错误."<<"addr:"<<QString::number(addr).toInt(); qDebug()<<"STM32 CRC校验码错误."<<"addr:"<<QString::number(addr).toInt();
recData.clear(); // CRC错误,清空缓冲区防止持续累积
return; return;
} }
int dataLen = recData[3]; // 假设 recData[3] 是数据长度字段 int dataLen = recData[3]; // 假设 recData[3] 是数据长度字段
int tailIndex = dataLen + 6; int tailIndex = dataLen + 6;
if (tailIndex >= recData.size()) { if (tailIndex >= recData.size()) {
qDebug() << "STM32 帧尾索引越界,数据不完整"; qDebug() << "STM32 帧尾索引越界,数据不完整";
recData.clear(); // 数据不完整,清空缓冲区
return; return;
} }
if(recData[recData[3]+6] != 0x55){ if(recData[recData[3]+6] != 0x55){
qDebug()<<"STM32接收数据帧尾错误."<<"addr:"<<QString::number(addr).toInt(); qDebug()<<"STM32接收数据帧尾错误."<<"addr:"<<QString::number(addr).toInt();
recData.clear(); // 帧尾错误,清空缓冲区
return; return;
} }
if(recData[1]==0x01){ if(recData[1]==0x01){
switch(addr){ switch(addr){
case 0xFF: case 0xFF:
@@ -363,6 +374,7 @@ void Serial::readSTM32Data(QByteArray data) {
if(addr == 0xFE && recData[4] == 0x00) if(addr == 0xFE && recData[4] == 0x00)
emit powerOffReady(); emit powerOffReady();
} }
recData.clear(); // 正常处理完毕,清空缓冲区
} }
void Serial::sendSerialDataFromTimer(){ void Serial::sendSerialDataFromTimer(){
@@ -372,6 +384,7 @@ void Serial::sendSerialDataFromTimer(){
void Serial::readTimeOut(){ void Serial::readTimeOut(){
timerRead->stop(); timerRead->stop();
serial->clear(QSerialPort::Input); serial->clear(QSerialPort::Input);
recData.clear(); // 超时时清空接收缓冲区,防止残留数据污染下次接收
if(com == "/dev/ttyAS5") if(com == "/dev/ttyAS5")
qDebug()<<"Read FPGA Serial data Timeout"; qDebug()<<"Read FPGA Serial data Timeout";
else if(com == "/dev/ttyAS2") else if(com == "/dev/ttyAS2")
@@ -379,47 +392,26 @@ void Serial::readTimeOut(){
sendSerialData(0,0,NULL,0,0); 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){ 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){ if(flag){
int max = 0; // 积压保护:FPGA 响应跟不上时丢弃旧条目,防止内存无限增长
if(cmd == 0xD2) if(queueFPGA.size() > QUEUE_FPGA_MAX){
max = MAX_LEN1; qDebug()<<"queueFPGA 积压过多,清空旧数据,当前大小:"<<queueFPGA.size();
else queueFPGA.clear();
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<num;i++){
sendData.cmd = cmd;
sendData.addr = addr + i*max;
sendData.data = data + i*max;
sendData.len = max;
sendData.type = type;
queueFPGA.append(sendData);
}
sendData.cmd = cmd;
sendData.addr = addr + num*max;
sendData.data = data + num*max;
sendData.len = len - num*max;
sendData.type = type;
queueFPGA.append(sendData);
} }
queueFPGA.append(sendData);
} }
else{ else{
QMutexLocker locker(&Mutex); QMutexLocker locker(&Mutex);
sendData.cmd = cmd; if(queue.size() > QUEUE_STM32_MAX){
sendData.addr = addr; qDebug()<<"queue 积压过多,清空旧数据,当前大小:"<<queue.size();
sendData.data = data; queue.clear();
sendData.len = len; }
sendData.type = type;
queue.append(sendData); queue.append(sendData);
} }
} }
@@ -458,12 +450,11 @@ void Serial::sendSerialData(int cmd,int addr, unsigned char* data, int len,int t
if(!isCommunication) return; if(!isCommunication) return;
if(flagOfUpgradeSTM32) return; if(flagOfUpgradeSTM32) return;
bool flag=false; bool flag=false; //地址标志位
if(type == 1 && set.contains(addr)){ if(type == 1 && set.contains(addr)){
flag = true; flag = true;
enQueue(cmd,addr,data,len,type,1); enQueue(cmd,addr,data,len,type,1);
} }
else if(type != 0){ else if(type != 0){
enQueue(cmd,addr,data,len,type,0); enQueue(cmd,addr,data,len,type,0);
} }
@@ -495,10 +486,8 @@ void Serial::sendSerialData(int cmd,int addr, unsigned char* data, int len,int t
} }
else{ else{
getDataFromQueue(cmd,addr,data,len,type,flag); getDataFromQueue(cmd,addr,data,len,type,flag);
sendDataToFPGA(cmd,addr,data,len); sendDataToFPGA(cmd,addr,data,len);
} }
} }
@@ -547,7 +536,7 @@ void Serial::sendDataToSTM32(int cmd,int addr, unsigned char* data, int len)
serial->flush(); serial->flush();
serial->waitForBytesWritten(waitTime); serial->waitForBytesWritten(waitTime);
if (bytesWritten == -1) { if (bytesWritten == -1) {
// qDebug() << "STM32写入数据失败。read"; qDebug() << "STM32写入数据失败。read";
} else { } else {
// qDebug() << "STM32成功发送 " << bytesWritten << " 个字节的数据。read"; // qDebug() << "STM32成功发送 " << bytesWritten << " 个字节的数据。read";
flagOfReadFinished = false; flagOfReadFinished = false;
@@ -571,11 +560,11 @@ void Serial::sendDataToSTM32(int cmd,int addr, unsigned char* data, int len)
sendData.resize(len+7); sendData.resize(len+7);
serial->clear(QSerialPort::Input); serial->clear(QSerialPort::Input);
bytesWritten=serial->write(sendData,len+7); bytesWritten=serial->write(sendData,len+7);
serial->flush(); serial->flush();
serial->waitForBytesWritten(waitTime); serial->waitForBytesWritten(waitTime);
if (bytesWritten == -1) { if (bytesWritten == -1) {
// qDebug() << "STM32写入数据失败。"; qDebug() << "STM32写入数据失败。";
} else { } else {
flagOfReadFinished = false; flagOfReadFinished = false;
recData.clear(); recData.clear();
@@ -696,6 +685,9 @@ void Serial::sendDataToFPGA(int cmd,int addr, unsigned char* data, int len){
serial->clear(QSerialPort::Input); serial->clear(QSerialPort::Input);
bytesWritten=serial->write(sendData,len+10); bytesWritten=serial->write(sendData,len+10);
if(addr == 0xB170)
qDebug() << "Counter2 sectional group: " << sendData.toHex(' ');
serial->flush(); serial->flush();
if(cmd == 0xD2) if(cmd == 0xD2)
serial->waitForBytesWritten(12); serial->waitForBytesWritten(12);
+1
View File
@@ -130,6 +130,7 @@ private:
bool waitForAck(int); bool waitForAck(int);
unsigned char checkSumForUpgrade(unsigned char *data,int len); unsigned char checkSumForUpgrade(unsigned char *data,int len);
bool sendDataToUART2(QByteArray,int); bool sendDataToUART2(QByteArray,int);
}; };
#endif // SERIAL_H #endif // SERIAL_H
+16 -25
View File
@@ -78,15 +78,6 @@ SysPara::SysPara(void):
#endif #endif
} }
SysPara *SysPara::ins()
{
static SysPara* ins = nullptr;
if (ins == nullptr) {
ins = new SysPara();
}
return ins;
}
void SysPara::loadParaFromFile(){ void SysPara::loadParaFromFile(){
QFile file(PARA_FILE_PATH); QFile file(PARA_FILE_PATH);
QFile DeviceCodefile(DeviceCode_FILE_PATH); QFile DeviceCodefile(DeviceCode_FILE_PATH);
@@ -168,7 +159,7 @@ void SysPara::loadDefaultPara(){
para.synPulseNumPerMm = 8;// 同步器参数 脉冲/毫米 para.synPulseNumPerMm = 8;// 同步器参数 脉冲/毫米
para.OuputPulseCol = 0;//桂林客户,精准控制输出脉冲的位置,精确到打印的列数 para.OuputPulseCol = 0;//桂林客户,精准控制输出脉冲的位置,精确到打印的列数
para.gearPumpEnable = 1; para.gearPumpEnable = 1;
para.flagOfReclaimPumEnable = false; para.flagOfReclaimPumEnable = true;
para.oscillatorVoltage = 30;//晶振电压 para.oscillatorVoltage = 30;//晶振电压
para.highVoltageLevel = 100;//高压包容差 para.highVoltageLevel = 100;//高压包容差
@@ -202,27 +193,27 @@ void SysPara::saveParaToFile(){
// qDebug()<<"saveParaToFile:"<<sysFile<<"LO:"<<para.lastOpenedFileName; // qDebug()<<"saveParaToFile:"<<sysFile<<"LO:"<<para.lastOpenedFileName;
if(!file.open(QIODevice::ReadWrite)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 if(!file.open(QIODevice::ReadWrite)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看
// QMessageBox::warning(0,QString("警告"),QString("无法打开配置文件 ") + PARA_FILE_PATH, QMessageBox::warning(0,QString("警告"),QString("无法打开配置文件 ") + PARA_FILE_PATH,
// QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok ); QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok );
} }
else { else {
if(file.isOpen()){ if(file.isOpen()){
file.seek(0); file.seek(0);
file.write((char *)&para,(long long int)sizeof(para)); file.write((char *)&para,(long long int)sizeof(para));
fsync(file.handle()); fsync(file.handle());
file.close(); file.close();
if(!DeviceCodefile.open(QIODevice::WriteOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 if(!DeviceCodefile.open(QIODevice::WriteOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看
//QMessageBox::warning(0,"警告",QString("无法打开文件:mac.bin") ); //QMessageBox::warning(0,"警告",QString("无法打开文件:mac.bin") );
} }
else { else {
DeviceCodefile.seek(0); DeviceCodefile.seek(0);
//file.write((char *)&jd.addr,(long long int)sizeof(jd)); //file.write((char *)&jd.addr,(long long int)sizeof(jd));
DeviceCodefile.write((char *)&para.Json_device_code,(qint64)sizeof(para.Json_device_code)); DeviceCodefile.write((char *)&para.Json_device_code,(qint64)sizeof(para.Json_device_code));
fsync(DeviceCodefile.handle()); fsync(DeviceCodefile.handle());
DeviceCodefile.close(); DeviceCodefile.close();
} }
} }
if(sysFile!="") if(sysFile!="")
{ {
@@ -498,7 +489,7 @@ void SysPara::loadPrintParaFromFile(QString fileName){
para.timeTriggerPrintDelayMs = print.timeTriggerPrintDelayMs ; para.timeTriggerPrintDelayMs = print.timeTriggerPrintDelayMs ;
para.timeTriggerPrintMode = print.timeTriggerPrintMode ; para.timeTriggerPrintMode = print.timeTriggerPrintMode ;
para.upDownInverse = print.upDownInverse ; para.upDownInverse = print.upDownInverse ;
z
para.varLen = print.varLen; para.varLen = print.varLen;
print.varLen1 = para.varLen1; print.varLen1 = para.varLen1;
para.varLenEn = print.varLenEn?1:0; para.varLenEn = print.varLenEn?1:0;
+3 -4
View File
@@ -595,7 +595,7 @@ typedef struct {
unsigned short outputPulseDelayMs; unsigned short outputPulseDelayMs;
unsigned short septalPostion; //设置的隔膜位置 unsigned short septalPostion; //设置的隔膜位置
unsigned short blinkLightPeriod; //频闪灯周期,以墨点为单位 unsigned short blinkLightPeriod; //频闪灯周期,以墨点为单位
unsigned short eleEyeTriggerPrintDelay; // 0x38 unsigned short eleEyeTriggerPrintDelay; // 0x38 电眼 + 同步器模式下,电眼触发后,同步打印延迟时间,单位:毫秒
unsigned char extClearAllCntEnable; //通过外部(同步器或电眼)清零 0x3a unsigned char extClearAllCntEnable; //通过外部(同步器或电眼)清零 0x3a
unsigned char FullColFixDacVal; // 0x3b unsigned char FullColFixDacVal; // 0x3b
// 0x3C 0x3D 3E 3F USEING // 0x3C 0x3D 3E 3F USEING
@@ -1299,10 +1299,9 @@ typedef struct {
class SysPara{ class SysPara{
//Q_OBJECT //Q_OBJECT
private:
SysPara(void);
public : public :
static SysPara* ins(); SysPara(void);
QString sysFile; QString sysFile;
printPara_t print; printPara_t print;
printPara_t printPre; printPara_t printPre;
+21 -20
View File
@@ -30,10 +30,6 @@ SystemManage::SystemManage(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
timeDia.hide(); timeDia.hide();
setPumpValveBottonEnable(false); setPumpValveBottonEnable(false);
ui->pushButtonCompressPump->setEnabled(false); ui->pushButtonCompressPump->setEnabled(false);
@@ -344,14 +340,14 @@ void SystemManage::on_pushButtonControlByHand_pressed()
void SystemManage::on_pushButtonReclaimTankOpen_pressed() void SystemManage::on_pushButtonReclaimTankOpen_pressed()
{ {
if(sysPara){ if(sysPara){
if(!sysPara->para.isCheckMagnet) // if(!sysPara->para.isCheckMagnet)
{ // {
if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ // if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){
QMessageBox::warning(this, tr("警告"), // QMessageBox::warning(this, tr("警告"),
tr("请先移开喷头盖!")); // tr("请先移开喷头盖!"));
return ; // return ;
} // }
} // }
sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable()); sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable());
ui->labelReclaimTankOpen->setText(sysPara->devOp->isReclaimTankOpenEnable()?tr("启动"):tr("停止")); ui->labelReclaimTankOpen->setText(sysPara->devOp->isReclaimTankOpenEnable()?tr("启动"):tr("停止"));
sysPara->devOp->highVoltageCtrl(0); sysPara->devOp->highVoltageCtrl(0);
@@ -365,14 +361,14 @@ void SystemManage::on_pushButtonReclaimTankOpen_pressed()
void SystemManage::on_pushButtonReclaimTankClose_pressed() void SystemManage::on_pushButtonReclaimTankClose_pressed()
{ {
if(sysPara){ if(sysPara){
if(!sysPara->para.isCheckMagnet) // if(!sysPara->para.isCheckMagnet)
{ // {
if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){ // if(!(sysPara->status.statWarn & WARN_STATUS_HDINT)){
QMessageBox::warning(this, tr("警告"), // QMessageBox::warning(this, tr("警告"),
tr("请先移开喷头盖!")); // tr("请先移开喷头盖!"));
return ; // return ;
} // }
} // }
sysPara->devOp->controlReclaimTankClose(!sysPara->devOp->isReclaimTankCloseEnable()); sysPara->devOp->controlReclaimTankClose(!sysPara->devOp->isReclaimTankCloseEnable());
ui->labelReclaimTankClose->setText(sysPara->devOp->isReclaimTankCloseEnable()?tr("启动"):tr("停止")); ui->labelReclaimTankClose->setText(sysPara->devOp->isReclaimTankCloseEnable()?tr("启动"):tr("停止"));
sysPara->devOp->highVoltageCtrl(0); 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() void SystemManage::on_pushButton_EnvConf_clicked()
{ {
// 检查源文件 // 检查源文件
+2
View File
@@ -29,6 +29,8 @@ public:
void setPumpValveBottonEnable(bool enable); void setPumpValveBottonEnable(bool enable);
void PowerOnSetTime(QString); void PowerOnSetTime(QString);
void bindSysPara(SysPara *sysPara);
void loadKeyBoardType(); void loadKeyBoardType();
int hasSingleStm32Bin(const QString &dirPath = "/udisk"); int hasSingleStm32Bin(const QString &dirPath = "/udisk");
QString fileName; QString fileName;
+23 -16
View File
@@ -36,10 +36,6 @@ SystemSetting::SystemSetting(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
progressBar.setGeometry(200,200,300,40); //将其放在最中间 progressBar.setGeometry(200,200,300,40); //将其放在最中间
progressBar.hide(); progressBar.hide();
timer = new QTimer(); timer = new QTimer();
@@ -59,9 +55,6 @@ SystemSetting::SystemSetting(QWidget *parent) :
} }
init(); init();
ui->label->hide();
ui->comboBoxEditMode->hide();
} }
SystemSetting::~SystemSetting() SystemSetting::~SystemSetting()
@@ -92,6 +85,7 @@ void SystemSetting::buttonClickedSlot()
}else if(btn == ui->checkBtn){ }else if(btn == ui->checkBtn){
emit sendButtonClickedSignal(2); emit sendButtonClickedSignal(2);
applyUIPara(); applyUIPara();
sysPara->saveParaToFile();
// SystemSettingLog(); // SystemSettingLog();
int freq = sysPara->para.oscillatorFreqFix+ convertFreq(sysPara->para.oscillatoFreq); int freq = sysPara->para.oscillatorFreqFix+ convertFreq(sysPara->para.oscillatoFreq);
@@ -139,7 +133,6 @@ void SystemSetting::SystemSettingLog(){
qDebug()<<QString("SystemSetting 回收槽开关时间: %1").arg(ui->spinBoxReclaimTankTime->value()); qDebug()<<QString("SystemSetting 回收槽开关时间: %1").arg(ui->spinBoxReclaimTankTime->value());
qDebug()<<QString("SystemSetting 隔膜位置: %1").arg(ui->spinBoxSeptalPostion->value()); qDebug()<<QString("SystemSetting 隔膜位置: %1").arg(ui->spinBoxSeptalPostion->value());
qDebug()<<QString("SystemSetting 隔膜位置偏移:: %1").arg(ui->comboBoxDiaphramOffset->currentIndex()); qDebug()<<QString("SystemSetting 隔膜位置偏移:: %1").arg(ui->comboBoxDiaphramOffset->currentIndex());
qDebug()<<QString("SystemSetting 信息编辑模式: %1").arg(ui->comboBoxEditMode->currentIndex());
qDebug()<<QString("SystemSetting 压力:: %1").arg(ui->spinBoxPressure->value()); qDebug()<<QString("SystemSetting 压力:: %1").arg(ui->spinBoxPressure->value());
qDebug()<<QString("SystemSetting 粘度: %1").arg(ui->spinBoxVIscosity->value()); qDebug()<<QString("SystemSetting 粘度: %1").arg(ui->spinBoxVIscosity->value());
qDebug()<<QString("SystemSetting 喷头温度: %1").arg(ui->spinBoxTemperature->value()); qDebug()<<QString("SystemSetting 喷头温度: %1").arg(ui->spinBoxTemperature->value());
@@ -171,7 +164,6 @@ void SystemSetting::updateSysParaToUI(){
if(sysPara->para.EditMode>SCENE) if(sysPara->para.EditMode>SCENE)
sysPara->para.EditMode=TXTFILE; 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.viscosityAdjust = ui->ViscosityAdujstSelect->currentIndex();
sysPara->para.oscillatoFreq = ui->comboBoxOscillatorFreq->currentIndex(); sysPara->para.oscillatoFreq = ui->comboBoxOscillatorFreq->currentIndex();
sysPara->para.oscillatorFreqFix = ui->spinBoxOscillatorFreqFix->value(); sysPara->para.oscillatorFreqFix = ui->spinBoxOscillatorFreqFix->value();
sysPara->para.EditMode = ui->comboBoxEditMode->currentIndex();
sysPara->para.diameter = ui->comboBoxDiameter->currentIndex();// qDebug()<<"EditMode1"<<sysPara->para.EditMode; sysPara->para.diameter = ui->comboBoxDiameter->currentIndex();// qDebug()<<"EditMode1"<<sysPara->para.EditMode;
int freq = sysPara->para.oscillatorFreqFix+ convertFreq(sysPara->para.oscillatoFreq); int freq = sysPara->para.oscillatorFreqFix+ convertFreq(sysPara->para.oscillatoFreq);
@@ -244,14 +235,23 @@ void SystemSetting::updateSysStatusToUI(){
{ {
setSpinBoxPressureMaxValue(5000); setSpinBoxPressureMaxValue(5000);
} }
// 逆清洗使能判定
static bool CleanUPEn=1,preCleanUP=0;
if(!sysPara->para.isCheckMagnet) 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 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(sysPara->status.currReclaimTankPos<55 && sysPara->status.currReclaimTankPos>44 && enCleanUpAppendFlag==2)
{ {
if(timer2->isActive()) timer2->stop(); 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() void SystemSetting::on_pushButtonCleanUP_pressed()
{ {
if(sysPara){ if(sysPara){
@@ -452,10 +457,12 @@ void SystemSetting::ondialogAuthorizationAccepted()
QMessageBox::Ok | QMessageBox::Cancel); QMessageBox::Ok | QMessageBox::Cancel);
if (ret == QMessageBox::Ok){ if (ret == QMessageBox::Ok){
if((sysPara->status.statWarn & WARN_STATUS_HDINT)){
QMessageBox::information(this,tr("错误"),tr("喷头盖未关,请先关喷头盖!")); // 暂时不检测喷头盖 byons@2026年6月21日
return ; // if((sysPara->status.statWarn & WARN_STATUS_HDINT)){
} // QMessageBox::information(this,tr("错误"),tr("喷头盖未关,请先关喷头盖!"));
// return ;
// }
lastHighVoltageOpen = sysPara->devOp->isHighVoltageOpen(); lastHighVoltageOpen = sysPara->devOp->isHighVoltageOpen();
sysPara->status.detectHighVoltageAppending = true; sysPara->status.detectHighVoltageAppending = true;
+1
View File
@@ -24,6 +24,7 @@ public:
void updateSysParaToUI(); //重载 void updateSysParaToUI(); //重载
void applyUIPara(); //重载 void applyUIPara(); //重载
void updateSysStatusToUI(); //重载 void updateSysStatusToUI(); //重载
void bindSysPara(SysPara *sysPara);
QProgressBar progressBar; QProgressBar progressBar;
void updateReclaimTime(int time); void updateReclaimTime(int time);
void updateViscosityAdjust(int offset); void updateViscosityAdjust(int offset);
+6
View File
@@ -10,6 +10,12 @@
<height>549</height> <height>549</height>
</rect> </rect>
</property> </property>
<property name="maximumSize">
<size>
<width>800</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Testprint</string> <string>Testprint</string>
</property> </property>
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
Binary file not shown.
Binary file not shown.
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
+16
View File
@@ -0,0 +1,16 @@
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
-4
View File
@@ -49,10 +49,6 @@ dlgQrCode::dlgQrCode(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
qrOption = new qrOption_t; qrOption = new qrOption_t;
//ui->labQRImage->setText(""); //ui->labQRImage->setText("");
ui->labName->setText(""); ui->labName->setText("");
+6 -4
View File
@@ -12,9 +12,6 @@ DlgMutiLanguage::DlgMutiLanguage(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
// ui->listWidget->hide(); // ui->listWidget->hide();
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(SetNewLanguage())); connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(SetNewLanguage()));
LangIndex=INPUT_METHOD_TYPE_CHINESE; LangIndex=INPUT_METHOD_TYPE_CHINESE;
@@ -67,7 +64,12 @@ int DlgMutiLanguage::getCurrentLanguage(){
// } // }
return LangIndex; return LangIndex;
} }
void DlgMutiLanguage::SetNewLanguage(){ void DlgMutiLanguage::bindSysPara(SysPara *sysPara)
{
this->sysPara = sysPara;
}
void DlgMutiLanguage::SetNewLanguage()
{
LangIndex = INPUT_METHOD_TYPE_CHINESE; LangIndex = INPUT_METHOD_TYPE_CHINESE;
+3
View File
@@ -19,6 +19,9 @@ public:
void setCurrentLanguage(); void setCurrentLanguage();
int getCurrentLanguage(); int getCurrentLanguage();
void bindSysPara(SysPara * sysPara);
int LangIndex; int LangIndex;
public slots: public slots:
void SetNewLanguage(); void SetNewLanguage();
+5 -4
View File
@@ -12,10 +12,6 @@ FontSetWidget::FontSetWidget(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
lineSpaceEdit = ui->lineSpaceEdit; lineSpaceEdit = ui->lineSpaceEdit;
lineSpaceMinusBtn = ui->lineSpaceMinusBtn; lineSpaceMinusBtn = ui->lineSpaceMinusBtn;
lineSpacePlusBtn = ui->lineSpacePlusBtn; lineSpacePlusBtn = ui->lineSpacePlusBtn;
@@ -68,6 +64,11 @@ void FontSetWidget::bindTxTEdit(QTextEdit* textEdit){
m_textEdit = textEdit; m_textEdit = textEdit;
} }
void FontSetWidget::bindSysPara(SysPara *sysPara)
{
this->sysPara = sysPara;
}
void FontSetWidget::on_buttonSelectFont_pressed(){ void FontSetWidget::on_buttonSelectFont_pressed(){
// int fontSize; // int fontSize;
+2
View File
@@ -26,6 +26,8 @@ public:
void bindTxTEdit(QTextEdit* textEdit); void bindTxTEdit(QTextEdit* textEdit);
void bindSysPara(SysPara *sysPara);
int getValueFont(); int getValueFont();
void setValueFont(int value); void setValueFont(int value);
QFont font; QFont font;
+245 -2
View File
@@ -12,7 +12,7 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>800</width>
<height>550</height> <height>550</height>
</size> </size>
</property> </property>
@@ -43,7 +43,7 @@
</size> </size>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@@ -671,6 +671,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -700,6 +709,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -729,6 +747,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -781,6 +808,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -810,6 +846,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -839,6 +884,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -894,6 +948,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -923,6 +986,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -952,6 +1024,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1004,6 +1085,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1033,6 +1123,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1062,6 +1161,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1114,6 +1222,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1143,6 +1260,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1172,6 +1298,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1224,6 +1359,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1253,6 +1397,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1282,6 +1435,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1334,6 +1496,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1363,6 +1534,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1392,6 +1572,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1444,6 +1633,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1473,6 +1671,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1502,6 +1709,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
@@ -1554,6 +1770,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1583,6 +1808,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="WindowText"> <colorrole role="WindowText">
@@ -1612,6 +1846,15 @@
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
<colorrole role="PlaceholderText">
<brush brushstyle="NoBrush">
<color alpha="128">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
+57 -27
View File
@@ -43,10 +43,6 @@ MainWidget::MainWidget(QWidget* parent)
// 加载UI文件 // 加载UI文件
ui.setupUi(this); ui.setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
// 关联成员变量到UI控件 // 关联成员变量到UI控件
m_EditBtn = ui.m_EditBtn; m_EditBtn = ui.m_EditBtn;
m_AddBtn = ui.m_AddBtn; m_AddBtn = ui.m_AddBtn;
@@ -125,6 +121,7 @@ void MainWidget::init()
m_setNumDlg = new SetNumDlg(this); m_setNumDlg = new SetNumDlg(this);
} }
connect(m_setNumDlg, &SetNumDlg::sig_setNum, this, &MainWidget::slt_setNum); connect(m_setNumDlg, &SetNumDlg::sig_setNum, this, &MainWidget::slt_setNum);
connect(m_setNumDlg, &SetNumDlg::sig_clearCnt, this, &MainWidget::slt_clearCnt);
} }
void MainWidget::buttonClickedSlot() void MainWidget::buttonClickedSlot()
@@ -174,6 +171,21 @@ void MainWidget::bindPicScene(PicScene* pPicScene){
this->pPicScene = 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) void MainWidget::_on_pushButtonPowerOff_pressed(bool notice)
{ {
if(!sysPara) if(!sysPara)
@@ -1063,7 +1075,7 @@ void MainWidget::generateCharRamData()
else else
width = (p_var->digitalNum)?(10*(p_var->width/p_var->digitalNum)):12; width = (p_var->digitalNum)?(10*(p_var->width/p_var->digitalNum)):12;
int width2 = width;//+(sysPara->status.addSpace?width:0); int width2 = width;//+(sysPara->status.addSpace?width:0);
int height = Public::derivePixelSizeFromHeight(p_var->height); int height = p_var->height;
textEdit.clear(); textEdit.clear();
int DPI = textEdit.logicalDpiX(); int DPI = textEdit.logicalDpiX();
@@ -1422,7 +1434,8 @@ bool MainWidget::dateTimeItemsDotUpdate()
if(!codeItem) if(!codeItem)
continue; continue;
QVector<int> counterValus{sysPara->para.cnt1CurrValue, sysPara->para.cnt2CurrValue}; QVector<int> 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); auto b = codeItem->updateVariants(counterValus);
isUpdate |= b; isUpdate |= b;
if(!b) if(!b)
@@ -1435,14 +1448,14 @@ bool MainWidget::dateTimeItemsDotUpdate()
continue; continue;
} }
auto sceneRect = pPicScene->sceneRect(); auto sceneRect = pPicScene->sceneRect().toRect();
auto boundingRect = pPicScene->itemsBoundingRect(); auto boundingRect = pPicScene->itemsBoundingRect().toRect();
QRectF itemRect(item->pos() - boundingRect.topLeft(), img.size()); QRect itemRect(item->pos().x() - boundingRect.x(), item->pos().y() - boundingRect.y(), img.width(), img.height());
totalOfDatetimeNumber++; totalOfDatetimeNumber++;
// 裁剪item位置, 确保item位于场景内 // 裁剪item位置, 确保item位于场景内
// 如果item超出了场景范围,则裁剪img并更新itemRect,只显示场景内的部分 // 如果item超出了场景范围,则裁剪img并更新itemRect,只显示场景内的部分
QRectF intersectRect = itemRect.intersected(sceneRect); QRect intersectRect = itemRect.intersected(sceneRect);
if(!intersectRect.isEmpty() && intersectRect != itemRect) { 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)); // ui.labelTotalProductCnt->setText(QString::number( sysPara->para.totalProductCnt+sysPara->status.totalProductCnt));
// 20260410 总数栏改为预设数值栏 // 20260410 总数栏改为预设数值栏
if (m_setNumDlg->getIsSet() && m_setNumDlg->getNum() > 0 && 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(); on_m_StopBtn_clicked();
} }
} }
@@ -1573,8 +1588,8 @@ void MainWidget::on_m_StartBtn_clicked()
print_len_min = stroke * size.width(); print_len_min = stroke * size.width();
if(print_len_min > sysPara->para.synTriggerPrintLenMm && !sysPara->para.charWidthSetEnable) if(print_len_min > sysPara->para.synTriggerPrintLenMm && !sysPara->para.charWidthSetEnable)
{ {
// QMessageBox::information(this,tr("错误"),tr("喷印间隔过短,应高于%1!").arg(print_len_min)); QMessageBox::information(this,tr("错误"),tr("喷印间隔过短,应高于%1!").arg(print_len_min));
// return; return;
} }
} }
/******2020/2/29 end*****/ /******2020/2/29 end*****/
@@ -1656,10 +1671,13 @@ void MainWidget::on_m_StartBtn_clicked()
printintFlag = true; printintFlag = true;
} }
startPrintingFlag = true;sysPara->status.isPrinting=true; startPrintingFlag = true;
sysPara->status.isPrinting=true;
// 高亮切换 // 高亮切换
changeHighLight(true); changeHighLight(true);
LogInfo::setRunStatusText("Start print...");
} }
} }
@@ -1703,17 +1721,23 @@ void MainWidget::on_m_StopBtn_clicked()
} }
// 高亮切换 // 高亮切换
changeHighLight(false); changeHighLight(false);
LogInfo::setRunStatusText("Stop print...");
} }
} }
unsigned char blankDat1[BLANK_COL_NUM*MAX_PRINT_ROW_BYTE_NUM]={0}; 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 ; if(!sysPara) return ;
// fileChange=false; // 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));//...所加的空白偏移地址 sysPara->devOp->fpgaWr(0,blankDat1,sizeof(blankDat1));//...所加的空白偏移地址
// 交替打印处理 // 交替打印处理
@@ -2092,11 +2116,12 @@ void MainWidget::slt_setNum()
ui.labelTotalProductCnt->hide(); ui.labelTotalProductCnt->hide();
ui.lb_counter->hide(); ui.lb_counter->hide();
} }
}
// 当前值 void MainWidget::slt_clearCnt()
if (m_setNumDlg->getIsSetCur()) { {
unsigned int curNum = m_setNumDlg->getCurNum(); if (sysPara) {
ui.labelProductCnt->setText(QString::number(curNum)); sysPara->devOp->clearProductCnt(1);//当前产品计数器立即清零
} }
} }
@@ -2321,12 +2346,10 @@ void MainWidget::updateSysStatusToUI(){ //100ms
if(sysPara->RFIDPara.inkCardTimeOut || sysPara->RFIDPara.solventCardTimeOut || sysPara->RFIDPara.needMaintenance) if(sysPara->RFIDPara.inkCardTimeOut || sysPara->RFIDPara.solventCardTimeOut || sysPara->RFIDPara.needMaintenance)
m_RightBtn->setEnabled(false); m_RightBtn->setEnabled(false);
else if(sysPara->status.selfCheckDone == 1) // else if(sysPara->status.selfCheckDone == 1)
{ // {
m_RightBtn->setEnabled(true); // m_RightBtn->setEnabled(true);
} // }
} }
} }
@@ -3164,6 +3187,13 @@ void MainWidget::onPreviewScene()
/*-------------------------------切换到显示窗口-----------------------------------*/ /*-------------------------------切换到显示窗口-----------------------------------*/
qDebug() << "currPrintCol: " << sysPara->status.currPrintCol; 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; auto rows = sysPara->para.AlterMode?sysPara->status.currAlterPrintRow : sysPara->status.currPrintRow;
rows = std::max(rows, (m_PrintDisplay->parentWidget()->height() / m_PrintDisplay->currScaleRatio())); rows = std::max(rows, (m_PrintDisplay->parentWidget()->height() / m_PrintDisplay->currScaleRatio()));
auto cols = sysPara->status.currPrintCol; auto cols = sysPara->status.currPrintCol;
+5 -1
View File
@@ -36,6 +36,8 @@ public:
MainWidget(QWidget* parent = nullptr); MainWidget(QWidget* parent = nullptr);
~MainWidget(); ~MainWidget();
void bindSysPara(SysPara *SysPara);
void bindTxTEdit(QTextEdit* textEdit); void bindTxTEdit(QTextEdit* textEdit);
void bindPicScene(PicScene* pPicScene); void bindPicScene(PicScene* pPicScene);
void PreviewPressed(); void PreviewPressed();
@@ -100,7 +102,7 @@ public:
QTimer *timerShowItem,*timerPowerOff; QTimer *timerShowItem,*timerPowerOff;
void SendPrintDataToFpga(unsigned char); void SendPrintDataToFpga(unsigned char alterMode, bool isUpdate = false);
void updatePrintDisplayLabel(); void updatePrintDisplayLabel();
@@ -179,6 +181,8 @@ private slots:
void slt_setNum(); void slt_setNum();
void slt_clearCnt();
signals: signals:
void sendButtonClickedSignal(int index); void sendButtonClickedSignal(int index);
void setDisableAll(); void setDisableAll();
+32 -30
View File
@@ -7,6 +7,7 @@
#include <QDebug> #include <QDebug>
#include <QMessageBox> #include <QMessageBox>
#include "runtimectrl.h" #include "runtimectrl.h"
#include "SysPara.h"
//#define HLPDEBUG //#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; setICReaderModeFlag = true;
setRFIDReaderWorkMode(); setRFIDReaderWorkMode();
setRFIDReaderKey(addr,1); setRFIDReaderKey(addr,1);
@@ -368,10 +370,10 @@ void RFIDManager::handleCheck(unsigned int addr)
|| strRevdata.left(3) == "100") || strRevdata.left(3) == "100")
{ {
if(strRevdata.at(3) == 'A') { if(strRevdata.at(3) == 'A') {
if(!SysPara::ins()->RFIDPara.needInkCard && false){ if(!sysPara->RFIDPara.needInkCard && false){
emit sig_showMsg(tr("不需要刷墨水卡!")); 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("请先添加墨水再刷墨水卡!")); emit sig_showMsg(tr("请先添加墨水再刷墨水卡!"));
} }
else else
@@ -381,24 +383,24 @@ void RFIDManager::handleCheck(unsigned int addr)
LogInfo::setRunStatusText("The user has canceled the operation about marking the ink card."); LogInfo::setRunStatusText("The user has canceled the operation about marking the ink card.");
} }
else if(RFIDmarkCardUsedAsync(0) == 1){ else if(RFIDmarkCardUsedAsync(0) == 1){
SysPara::ins()->RFIDPara.needInkCard = false; sysPara->RFIDPara.needInkCard = false;
SysPara::ins()->RFIDPara.inkCardTimeOut = false; sysPara->RFIDPara.inkCardTimeOut = false;
SysPara::ins()->saveRFIDPara(); sysPara->saveRFIDPara();
emit sig_showMsg(tr("刷墨水卡成功!")); emit sig_showMsg(tr("刷墨水卡成功!"));
SysPara::ins()->para.inkWarnDate = 0; sysPara->para.inkWarnDate = 0;
SysPara::ins()->para.inkWarnTime = 0; sysPara->para.inkWarnTime = 0;
SysPara::ins()->saveParaToFile(); sysPara->saveParaToFile();
} }
} }
} }
else if(strRevdata.at(3) == 'B') 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("不需要刷溶剂卡!")); 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("请先添加溶剂再刷溶剂卡!")); emit sig_showMsg(tr("请先添加溶剂再刷溶剂卡!"));
} }
else else
@@ -408,14 +410,14 @@ void RFIDManager::handleCheck(unsigned int addr)
LogInfo::setRunStatusText("The user has canceled the operation about marking the solvent card."); LogInfo::setRunStatusText("The user has canceled the operation about marking the solvent card.");
} }
else if(RFIDmarkCardUsedAsync(1) == 1) { else if(RFIDmarkCardUsedAsync(1) == 1) {
SysPara::ins()->RFIDPara.needSolventCard = false; sysPara->RFIDPara.needSolventCard = false;
SysPara::ins()->RFIDPara.solventCardTimeOut = false; sysPara->RFIDPara.solventCardTimeOut = false;
SysPara::ins()->saveRFIDPara(); sysPara->saveRFIDPara();
emit sig_showMsg(tr("刷溶剂卡成功!")); emit sig_showMsg(tr("刷溶剂卡成功!"));
SysPara::ins()->para.flagOfSolventWarning = false; sysPara->para.flagOfSolventWarning = false;
SysPara::ins()->para.solventWarnDate = 0; sysPara->para.solventWarnDate = 0;
SysPara::ins()->para.solventWarnTime = 0; sysPara->para.solventWarnTime = 0;
SysPara::ins()->saveParaToFile(); sysPara->saveParaToFile();
} }
} }
@@ -429,16 +431,16 @@ void RFIDManager::handleCheck(unsigned int addr)
emit sig_maintenanceShow(); emit sig_maintenanceShow();
SysPara::ins()->RFIDPara.needMaintenance = false; sysPara->RFIDPara.needMaintenance = false;
SysPara::ins()->status.needMaintenanceRemind = false; sysPara->status.needMaintenanceRemind = false;
QDate curDate = QDate::currentDate(); QDate curDate = QDate::currentDate();
SysPara::ins()->RFIDPara.maintenanceDate = curDate.toString("yyMMdd").toInt(); sysPara->RFIDPara.maintenanceDate = curDate.toString("yyMMdd").toInt();
QDate mtEndDate = curDate.addMonths(SysPara::ins()->RFIDPara.maintenanceInterval); QDate mtEndDate = curDate.addMonths(sysPara->RFIDPara.maintenanceInterval);
SysPara::ins()->RFIDPara.maintenanceEndDate = mtEndDate.toString("yyMMdd").toInt(); sysPara->RFIDPara.maintenanceEndDate = mtEndDate.toString("yyMMdd").toInt();
SysPara::ins()->RFIDPara.runTime = 0; sysPara->RFIDPara.runTime = 0;
RunTimeCtrl::instance()->updatePara(&SysPara::ins()->RFIDPara); RunTimeCtrl::instance()->updatePara(&sysPara->RFIDPara);
SysPara::ins()->saveRFIDPara(); sysPara->saveRFIDPara();
emit sig_showMsg(tr("刷保养卡成功!")); emit sig_showMsg(tr("刷保养卡成功!"));
} }
else { else {
@@ -898,7 +900,7 @@ bool RFIDManager::cardTouchConfirm(QString msgTxt, QString variableMsgTxt)
QMessageBox box(QMessageBox::Warning, tr("警告"), QMessageBox box(QMessageBox::Warning, tr("警告"),
msgTxt, QMessageBox::Ok | QMessageBox::Cancel); msgTxt, QMessageBox::Ok | QMessageBox::Cancel);
int rfidCountDown = SysPara::ins()->para.rfidCountDown; int rfidCountDown = sysPara->para.rfidCountDown;
QTimer msgTimer; QTimer msgTimer;
QString boxTxt = variableMsgTxt; QString boxTxt = variableMsgTxt;
connect(&msgTimer, &QTimer::timeout, [this, &box, &rfidCountDown, boxTxt]() { 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) { if(sysPara->para.rfidCountDown > 0) {
box.setText(boxTxt.arg(SysPara::ins()->para.rfidCountDown)); box.setText(boxTxt.arg(sysPara->para.rfidCountDown));
msgTimer.start(1000); msgTimer.start(1000);
} }
+4 -1
View File
@@ -7,6 +7,8 @@
#include <QTimer> #include <QTimer>
#include <QMutex> #include <QMutex>
class SysPara;
typedef unsigned char UCHAR; typedef unsigned char UCHAR;
class RFIDManager : public QObject class RFIDManager : public QObject
{ {
@@ -23,7 +25,7 @@ public:
// InkJetPrinter定时器timerHandler触发,检查刷卡状态 // InkJetPrinter定时器timerHandler触发,检查刷卡状态
// 初始化刷卡模块 // 初始化刷卡模块
void initRFIDMoudle(unsigned int addr); void initRFIDMoudle(unsigned int addr, SysPara *sysPara);
// 300ms检查处理 // 300ms检查处理
void handleCheck(unsigned int addr); void handleCheck(unsigned int addr);
@@ -58,6 +60,7 @@ private:
QString strRevdata; QString strRevdata;
bool setICReaderModeFlag; bool setICReaderModeFlag;
uint checkCardIntervalTime; uint checkCardIntervalTime;
SysPara* sysPara = nullptr;
QTimer* RFIDTimer = nullptr; QTimer* RFIDTimer = nullptr;
void initTimer(); void initTimer();
+2 -7
View File
@@ -44,11 +44,6 @@ BarcodeEditor::BarcodeEditor(QWidget *parent) :
ui(new Ui::BarcodeEditor) ui(new Ui::BarcodeEditor)
{ {
ui->setupUi(this); ui->setupUi(this);
if (m_sysPara == nullptr) {
m_sysPara = SysPara::ins();
}
applyStyleSheet(); applyStyleSheet();
m_dateFormatEditor = new DateFormatEditor(); m_dateFormatEditor = new DateFormatEditor();
@@ -264,7 +259,7 @@ void BarcodeEditor::applyCounterConfigToSysPara()
m_sysPara->para.cnt1RepeateValue = cnt.counter1.repeatValue; m_sysPara->para.cnt1RepeateValue = cnt.counter1.repeatValue;
m_sysPara->para.cnt1StepValue = cnt.counter1.stepValue; m_sysPara->para.cnt1StepValue = cnt.counter1.stepValue;
m_sysPara->para.cnt1CurrValue = cnt.counter1.currValue; 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) if(cnt.counter1.eleEyeIncEn)
m_sysPara->para.eleEyeClearCntInSynMode = (m_sysPara->para.eleEyeClearCntInSynMode | 0x10); // CNT1 +1 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.cnt2RepeateValue = cnt.counter2.repeatValue;
m_sysPara->para.cnt2StepValue = cnt.counter2.stepValue; m_sysPara->para.cnt2StepValue = cnt.counter2.stepValue;
m_sysPara->para.cnt2CurrValue = cnt.counter2.currValue; 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) if(cnt.counter2.eleEyeIncEn)
m_sysPara->para.eleEyeClearCntInSynMode = (m_sysPara->para.eleEyeClearCntInSynMode | 0x20); // CNT2 +1 m_sysPara->para.eleEyeClearCntInSynMode = (m_sysPara->para.eleEyeClearCntInSynMode | 0x20); // CNT2 +1
+5 -5
View File
@@ -419,17 +419,17 @@ QString ItemUtils::generateTxtFromDateItemModel(const DateItemModel &model, cons
QString ItemUtils::generateTxtFromBarcodeViewModel(const BarcodeViewModel &vm, const std::array<int, 2> counterValues, const QDateTime &time) QString ItemUtils::generateTxtFromBarcodeViewModel(const BarcodeViewModel &vm, const std::array<int, 2> counterValues, const QDateTime &time)
{ {
QString txt = vm.contentPattern; QString txt = vm.contentPattern;
auto pos = vm.contentPattern.indexOf("{t}"); auto pos = txt.indexOf("{t}");
if(pos != -1) { 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) { if(pos != -1) {
auto cntValue = vm.counterViewModel.counterType == COUNTER_TYPE_1 ? counterValues[0] : counterValues[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); valueStr = valueStr.right(vm.counterViewModel.digitalNum);
txt.replace(pos, 3, valueStr); txt = txt.replace(pos, 3, valueStr);
} }
return txt; return txt;
+6
View File
@@ -10,6 +10,12 @@
<height>550</height> <height>550</height>
</rect> </rect>
</property> </property>
<property name="maximumSize">
<size>
<width>800</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
+4 -1
View File
@@ -1,6 +1,7 @@
#include "piccodeitem.h" #include "piccodeitem.h"
#include "ItemCommon.h" #include "ItemCommon.h"
#include <QDebug> #include <QDebug>
#include "LogInfo.h"
PicCodeItem::PicCodeItem(QGraphicsItem *parent, QGraphicsScene *scene, const SourceType type) PicCodeItem::PicCodeItem(QGraphicsItem *parent, QGraphicsScene *scene, const SourceType type)
:PicTextItem(parent, scene, type), :PicTextItem(parent, scene, type),
@@ -55,7 +56,9 @@ bool PicCodeItem::updateVariants(const QVector<int> counters)
return false; return false;
} }
m_currCounterValues = counters; m_currCounterValues = counters;
return updateVariants(); auto b = updateVariants();
return b;
} }
QImage PicCodeItem::itemImage() QImage PicCodeItem::itemImage()
+15
View File
@@ -265,6 +265,13 @@ void PicTextItem::setAttrs(const QXmlStreamAttributes &attrs)
setCustomFont(fontFamilyRef.toString()); 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); setCustomAttrs(attrs);
} }
@@ -427,9 +434,17 @@ void PicTextItem::letterSpaceChanged()
QImage PicTextItem::strToImage(const QString &str) QImage PicTextItem::strToImage(const QString &str)
{ {
if(str.isEmpty())
return QImage();
QPainter painter; QPainter painter;
QFontMetrics fm(font()); QFontMetrics fm(font());
QImage img(fm.horizontalAdvance(str), fm.height(), QImage::Format_ARGB32); 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 txtColor = colorReversal() ? 0xffffffff : 0xff000000;
QRgb bgColor = colorReversal() ? 0xff000000 : 0x00000000; QRgb bgColor = colorReversal() ? 0xff000000 : 0x00000000;
+5 -12
View File
@@ -26,23 +26,16 @@ int SetNumDlg::getNum()
return num; return num;
} }
bool SetNumDlg::getIsSetCur()
{
return isSetCur;
}
int SetNumDlg::getCurNum()
{
return curNum;
}
void SetNumDlg::on_btn_confirm_clicked() void SetNumDlg::on_btn_confirm_clicked()
{ {
num = ui->sb_num->value(); num = ui->sb_num->value();
isSet = ui->cb_setNum->isChecked(); isSet = ui->cb_setNum->isChecked();
curNum = ui->sb_curNum->value();
isSetCur = ui->cb_setCurNum->isChecked();
this->hide(); this->hide();
emit sig_setNum(); emit sig_setNum();
} }
void SetNumDlg::on_btn_clearProductCnt_clicked()
{
emit sig_clearCnt();
}
+4 -8
View File
@@ -19,25 +19,21 @@ public:
int getNum(); int getNum();
bool getIsSetCur();
int getCurNum();
private slots: private slots:
void on_btn_confirm_clicked(); void on_btn_confirm_clicked();
void on_btn_clearProductCnt_clicked();
private: private:
Ui::SetNumDlg *ui; Ui::SetNumDlg *ui;
// 是否采用预设值 // 是否采用预设值
bool isSet = false; bool isSet = false;
unsigned int num = 0; unsigned int num = 0;
// 是否采用当前值
bool isSetCur =false;
unsigned int curNum = 0;
signals: signals:
void sig_setNum(); void sig_setNum();
void sig_clearCnt();
}; };
#endif // SETNUMDLG_H #endif // SETNUMDLG_H
+9 -47
View File
@@ -16,8 +16,8 @@
<widget class="QCheckBox" name="cb_setNum"> <widget class="QCheckBox" name="cb_setNum">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>160</x>
<y>40</y> <y>50</y>
<width>120</width> <width>120</width>
<height>50</height> <height>50</height>
</rect> </rect>
@@ -54,8 +54,8 @@
<widget class="QPushButton" name="btn_confirm"> <widget class="QPushButton" name="btn_confirm">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>300</x> <x>290</x>
<y>210</y> <y>50</y>
<width>100</width> <width>100</width>
<height>50</height> <height>50</height>
</rect> </rect>
@@ -83,55 +83,17 @@
<string>预设值:</string> <string>预设值:</string>
</property> </property>
</widget> </widget>
<widget class="QSpinBox" name="sb_curNum"> <widget class="QPushButton" name="btn_clearProductCnt">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>20</x>
<y>150</y> <y>160</y>
<width>120</width> <width>111</width>
<height>50</height> <height>61</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>50</height>
</size>
</property>
<property name="maximum">
<number>99999999</number>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>20</x>
<y>110</y>
<width>71</width>
<height>31</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>当前值:</string> <string>清空产品计数</string>
</property>
</widget>
<widget class="QCheckBox" name="cb_setCurNum">
<property name="geometry">
<rect>
<x>180</x>
<y>150</y>
<width>120</width>
<height>50</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>采用当前值</string>
</property> </property>
</widget> </widget>
</widget> </widget>
+13 -48
View File
@@ -409,43 +409,6 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="9" column="2">
<widget class="QComboBox" name="comboBoxEditMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>37</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>37</height>
</size>
</property>
<item>
<property name="text">
<string>文本模式</string>
</property>
</item>
<item>
<property name="text">
<string>点阵模式</string>
</property>
</item>
<item>
<property name="text">
<string>场景模式</string>
</property>
</item>
</widget>
</item>
<item row="2" column="3"> <item row="2" column="3">
<widget class="QLabel" name="labelHighVoltageValue"> <widget class="QLabel" name="labelHighVoltageValue">
<property name="text"> <property name="text">
@@ -529,16 +492,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1">
<widget class="QLabel" name="label">
<property name="text">
<string> 信息编辑模式:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="6"> <item row="3" column="6">
<widget class="QLabel" name="labelTemperature"> <widget class="QLabel" name="labelTemperature">
<property name="text"> <property name="text">
@@ -833,8 +786,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="2"> <item row="9" column="2">
<widget class="QCheckBox" name="enableReclaimAlgorithm"> <widget class="QCheckBox" name="enableReclaimAlgorithm">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@@ -875,6 +834,9 @@
<property name="text"> <property name="text">
<string>喷嘴逆清洗</string> <string>喷嘴逆清洗</string>
</property> </property>
<property name="checkable">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
@@ -900,6 +862,9 @@
<property name="text"> <property name="text">
<string>重置高压</string> <string>重置高压</string>
</property> </property>
<property name="checkable">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
+9 -5
View File
@@ -29,10 +29,6 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
// 加载UI文件 // 加载UI文件
ui.setupUi(this); ui.setupUi(this);
if (sysPara == nullptr) {
sysPara = SysPara::ins();
}
// 关联成员变量到UI控件 // 关联成员变量到UI控件
// m_TextEdit = ui.m_TextEdit; // m_TextEdit = ui.m_TextEdit;
m_LineEdit = ui.m_LineEdit; m_LineEdit = ui.m_LineEdit;
@@ -230,6 +226,14 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
// ui.btnList->hide(); // ui.btnList->hide();
} }
void TestPrintWidget::bindSysPara(SysPara *sysPara)
{
this->sysPara = sysPara;
// 它需要这个
m_barcodeEditor.bindSysPara(sysPara);
}
TestPrintWidget::~TestPrintWidget() TestPrintWidget::~TestPrintWidget()
{ {
if(m_pSavePicScene) if(m_pSavePicScene)
@@ -931,7 +935,7 @@ void TestPrintWidget::onSceneAccepted(PicTextItem *pTextItem){
// //fmt.setFontWordSpacing(sysPara->para.textEditCharSpace); // //fmt.setFontWordSpacing(sysPara->para.textEditCharSpace);
// fmt.setFontLetterSpacing(sysPara->para.textEditCharSpace); qDebug() << sysPara->para.textEditCharSpace; // fmt.setFontLetterSpacing(sysPara->para.textEditCharSpace); qDebug() << sysPara->para.textEditCharSpace;
// mergeFormatOnWordOrSelection(fmt); // mergeFormatOnWordOrSelection(fmt);
pTextItem->setLetterSpace(sysPara->para.textEditCharSpace); // pTextItem->setLetterSpace(sysPara->para.textEditCharSpace);
sysPara->saveParaToFile(); sysPara->saveParaToFile();
} }
+1
View File
@@ -56,6 +56,7 @@ public:
void createItemImage(); void createItemImage();
void getShowSelectItemText(); void getShowSelectItemText();
void bindSysPara(SysPara *sysPara);
void on_openfileButton_pressed(); void on_openfileButton_pressed();