2026年7月16日 缓存

This commit is contained in:
2026-07-16 08:28:55 +08:00
parent 31726535b0
commit 570f359339
35 changed files with 945 additions and 1275 deletions
+11
View File
@@ -204,6 +204,14 @@ void CounterVarSet::applyUIPara(){
sysPara->devOp->writeFpgaCalandar(0);
// unsigned int flags = 0;
// if(sysPara->status.cnt1CurrentValueInitDoneFlag)
// flags = 1 << 2;
// if(sysPara->status.cnt2CurrentValueInitDoneFlag)
// flags |= 1 << 3;
// sysPara->devOp->clearProductCnt(flags);
}
}
@@ -228,6 +236,9 @@ void CounterVarSet::updateSysParaToUI(){
ui->eleCNT2IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x20)?1:0);
// ui->radCNT2ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x20)?0:1);
ui->checkBoxResetCnt1CurrValue->setChecked(false);
ui->checkBoxResetCnt2CurrValue->setChecked(false);
}
}
+9 -9
View File
@@ -2562,8 +2562,8 @@ int DevOp::writeFpgaPrintPara(bool ignoreWarn){
}
}
else if(sysPara->status.build_dat.builTime == 73){
writeDacValue2Fpga_No73();
if(sysPara->status.currVoltageVersion != sysPara->status.lastVoltageVersion){
writeDacValue2Fpga_No73();
sysPara->status.lastVoltageVersion = sysPara->status.currVoltageVersion;
}
}
@@ -3226,11 +3226,11 @@ void DevOp::writeFpgaCalandar(bool Enable){
step = 1;
step = step < 0?(100000000 + step):step;
sysPara->para.calandar_and_dat.cnt2Step = QString::number(step).toUInt(0,16);
// 与vx5相反,调换过值位置,比如0:4改为4:0
sysPara->para.calandar_and_dat.cntCurrValueInitEnable =
(sysPara->status.cnt3CurrentValueInitDoneFlag?0:4)+
(sysPara->status.cnt2CurrentValueInitDoneFlag?0:2)
+ (sysPara->status.cnt1CurrentValueInitDoneFlag?0:1);
(sysPara->status.cnt3CurrentValueInitDoneFlag?4:0)+
(sysPara->status.cnt2CurrentValueInitDoneFlag?2:0)
+ (sysPara->status.cnt1CurrentValueInitDoneFlag?1:0);
fpgaWr(WRITE_CALENDAR_DAT_ADDR,(unsigned char *)&sysPara->para.calandar_and_dat,sizeof(sysPara->para.calandar_and_dat));
@@ -3248,9 +3248,9 @@ void DevOp::writeFpgaCalandar(bool Enable){
sysPara->para.Counter4.cnt4CurrValue= QString::number(sysPara->para.cnt4CurrValue).toUInt(0,16); //计数器4当前值用于隐藏功能
fpgaWr(WRITE_COUNTER4_ADDR,(unsigned char *)&sysPara->para.Counter4,sizeof(sysPara->para.Counter4));
sysPara->status.cnt3CurrentValueInitDoneFlag = true;
sysPara->status.cnt2CurrentValueInitDoneFlag = true;
sysPara->status.cnt1CurrentValueInitDoneFlag = true;
sysPara->status.cnt3CurrentValueInitDoneFlag = false;
sysPara->status.cnt2CurrentValueInitDoneFlag = false;
sysPara->status.cnt1CurrentValueInitDoneFlag = false;
}
unsigned char dataOfvariNum[1];
unsigned char dataOfreg_var_print_ctrl[8][8];
@@ -3644,7 +3644,7 @@ void DevOp::writeSyncAndDelayPrintCount(bool enb, uint32_t maxCount)
buffer[3] = (maxCount >> 16) & 0xFF;
buffer[4] = (maxCount >> 24) & 0xFF;
fpgaWr(MAX_REPEAT_COUNT_DELAY_SYNC, &buffer, sizeof(buffer));
fpgaWr(MAX_REPEAT_COUNT_DELAY_SYNC, buffer, sizeof(buffer));
}
void DevOp::resendSTM32Date(int cmd, int addr, unsigned char *dat, int len, int type)
+2 -1
View File
@@ -32,7 +32,8 @@ DialogSaveFile::DialogSaveFile(QWidget *parent) :
}
void DialogSaveFile::refreshListView(int mode){
void DialogSaveFile::refreshListView(int mode)
{
QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR;
QDir dir(dirPath);
+79 -22
View File
@@ -5,9 +5,10 @@
#include <QSpinBox>
#include <QSpinBox>
#include <QDebug>
#include <QKeyEvent>
DigitalInput::DigitalInput(MyInputMethod *myInputMethod,QWidget *parent) :
QWidget(parent,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool|Qt::WindowDoesNotAcceptFocus|Qt::BypassWindowManagerHint)),
QWidget(parent,(Qt::FramelessWindowHint )),
ui(new Ui::DigitalInput)
{
ui->setupUi(this);
@@ -31,6 +32,14 @@ DigitalInput::DigitalInput(MyInputMethod *myInputMethod,QWidget *parent) :
connect(ui->enterBtn, &QPushButton::clicked, this, &DigitalInput::onEnterPressed);
connect(ui->clrBtn, &QPushButton::clicked, this, &DigitalInput::onClrPressed);
// 所有键盘按钮不接收焦点,避免点击按钮时 traceEdit 丢失焦点
QList<QPushButton*> btns = findChildren<QPushButton*>();
for (QPushButton* btn : btns) {
btn->setFocusPolicy(Qt::NoFocus);
}
ui->traceEdit->setFocusPolicy(Qt::StrongFocus);
}
DigitalInput::~DigitalInput()
@@ -41,21 +50,52 @@ DigitalInput::~DigitalInput()
void DigitalInput::onCharPressed(){
QPushButton * button = qobject_cast<QPushButton *>(sender());
QString text = button->text();
myInputMethod->sendString (text);
QString ch = button->text();
if (!m_currSpinBox) {
ui->traceEdit->insert(ch);
return;
}
int cursorPos = ui->traceEdit->cursorPosition();
QString currentText = ui->traceEdit->text();
QString newText = currentText.left(cursorPos) + ch + currentText.mid(cursorPos);
if (newText.isEmpty()) {
ui->traceEdit->insert(ch);
return;
}
bool ok = false;
int value = newText.toInt(&ok);
if (!ok) {
ui->traceEdit->insert(ch);
return;
}
int max = m_currSpinBox->maximum();
if (value <= max) {
ui->traceEdit->insert(ch);
}
}
void DigitalInput::onKeyBackspacePressed(){
if(m_currSpinBox && QString::number(m_currSpinBox->value()).size() == 1) {
ui->traceEdit->clear();
// if(m_currSpinBox && QString::number(m_currSpinBox->value()).size() == 1) {
// ui->traceEdit->clear();
// }
// #ifndef Q_OS_WIN32
// //QWSServer::sendKeyEvent(0,Qt::Key_Backspace,Qt::NoModifier,true,false); //锟斤拷系统锟斤拷锟酵硷拷锟斤拷锟铰硷拷
// MyInputMethod::sendEvent(Qt::Key_Backspace,Qt::NoModifier);
// #endif
int cursorPos = ui->traceEdit->cursorPosition();
if (cursorPos > 0) {
QString text = ui->traceEdit->text();
text.remove(cursorPos - 1, 1);
ui->traceEdit->setText(text);
ui->traceEdit->setCursorPosition(cursorPos - 1);
}
#ifndef Q_OS_WIN32
//QWSServer::sendKeyEvent(0,Qt::Key_Backspace,Qt::NoModifier,true,false); //锟斤拷系统锟斤拷锟酵硷拷锟斤拷锟铰硷拷
MyInputMethod::sendEvent(Qt::Key_Backspace,Qt::NoModifier);
#endif
}
void DigitalInput::onKeySelectAllPressed(){
@@ -85,16 +125,19 @@ void DigitalInput::onKeyDownPressed(){
void DigitalInput::onEnterPressed()
{
if(m_currSpinBox) {
m_currSpinBox->clearFocus();
}
hide();
}
void DigitalInput::onClrPressed()
{
if(m_currSpinBox) {
m_currSpinBox->setValue(std::min(m_currSpinBox->maximum(), std::max(m_currSpinBox->minimum(), 0)));
}
// if(m_currSpinBox) {
// m_currSpinBox->setValue(std::min(m_currSpinBox->maximum(), std::max(m_currSpinBox->minimum(), 0)));
// ui->traceEdit->setText(m_currSpinBox->value());
// // ui->traceEdit->setFocus();
// }
ui->traceEdit->clear();
ui->traceEdit->setFocus();
}
void DigitalInput::showEvent(QShowEvent *event)
@@ -104,15 +147,29 @@ void DigitalInput::showEvent(QShowEvent *event)
QSpinBox* box = dynamic_cast<QSpinBox*>(focusWidget);
if(!box) {
qWarning() << "focusWidget is not QSpinBox";
m_currSpinBox = nullptr;
return;
}
if(m_currSpinBox) {
disconnect(m_currSpinBox, QOverload<const QString&>::of(&QSpinBox::valueChanged), ui->traceEdit, &QLineEdit::setText);
}
m_currSpinBox = box;
ui->traceEdit->setText(box->text());
connect(box, QOverload<const QString&>::of(&QSpinBox::valueChanged), ui->traceEdit, &QLineEdit::setText);
// focusWidget->clearFocus();
ui->traceEdit->setFocus();
// connect(box, QOverload<const QString&>::of(&QSpinBox::valueChanged), ui->traceEdit, &QLineEdit::setText);
qDebug() << "The traceEdit has connected to the QSpinBox: " << box->objectName();
}
void DigitalInput::hideEvent(QHideEvent * event)
{
QWidget::hideEvent(event);
if(m_currSpinBox) {
int value = ui->traceEdit->text().toInt();
int min = m_currSpinBox->minimum();
int max = m_currSpinBox->maximum();
value = qBound(min, value, max);
m_currSpinBox->setValue(value);
m_currSpinBox->clearFocus();
}
}
+1
View File
@@ -29,6 +29,7 @@ private slots:
protected:
virtual void showEvent(QShowEvent* event) override;
void hideEvent(QHideEvent* event) override;
private:
Ui::DigitalInput *ui;
+26
View File
@@ -0,0 +1,26 @@
#include "DlgCanvasHeightEditor.h"
#include "ui_DlgCanvasHeightEditor.h"
DlgCanvasHeightEditor::DlgCanvasHeightEditor(QWidget *parent) :
QDialog(parent),
ui(new Ui::DlgCanvasHeightEditor)
{
ui->setupUi(this);
}
DlgCanvasHeightEditor::~DlgCanvasHeightEditor()
{
delete ui;
}
void DlgCanvasHeightEditor::setCanvsHeight(unsigned h)
{
ui->sbCanvasHeight->setValue(h);
}
unsigned DlgCanvasHeightEditor::canvasHeight() const
{
return ui->sbCanvasHeight->value();
}
+26
View File
@@ -0,0 +1,26 @@
#ifndef DLGCANVASHEIGHTEDITOR_H
#define DLGCANVASHEIGHTEDITOR_H
#include <QDialog>
namespace Ui {
class DlgCanvasHeightEditor;
}
class DlgCanvasHeightEditor : public QDialog
{
Q_OBJECT
public:
explicit DlgCanvasHeightEditor(QWidget *parent = nullptr);
~DlgCanvasHeightEditor();
void setCanvsHeight(unsigned h);
unsigned canvasHeight() const;
private:
Ui::DlgCanvasHeightEditor *ui;
};
#endif // DLGCANVASHEIGHTEDITOR_H
+172
View File
@@ -0,0 +1,172 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgCanvasHeightEditor</class>
<widget class="QDialog" name="DlgCanvasHeightEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>340</width>
<height>226</height>
</rect>
</property>
<property name="windowTitle">
<string>窗口点阵设置</string>
</property>
<property name="styleSheet">
<string notr="true">QPushButton#closeBtn, QPushButton#checkBtn{
background-color: #E6F7FF;
border: 1px solid #87CEEB;
border-radius: 4px;
font-size: 24px;
color: #228B22;
}
QPushButton#closeBtn:hover,QPushButton#checkBtn:hover{
background-color: #D1E9FF;
}
QPushButton#closeBtn:pressed,QPushButton#checkBtn:pressed{
background-color: #BAE7FF;
}
QPushButton {
background-color: #5396C1;
color: #ffffff;
border: 1px solid #000000;
border-radius: 3px;
font-size: 18px;
font-weight:500;
width: 180px;
height: 90px;
}
QPushButton:hover {
background-color: #5396C1;
}
QPushButton:disabled {
background-color: #7C828E;
color: #606060;
border-color: #808080;
}
</string>
</property>
<widget class="QPushButton" name="closeBtn">
<property name="geometry">
<rect>
<x>220</x>
<y>170</y>
<width>100</width>
<height>40</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>40</height>
</size>
</property>
<property name="text">
<string>✕</string>
</property>
<property name="fixedSize" stdset="0">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
</widget>
<widget class="QPushButton" name="checkBtn">
<property name="geometry">
<rect>
<x>100</x>
<y>170</y>
<width>101</width>
<height>40</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>40</height>
</size>
</property>
<property name="text">
<string>✓</string>
</property>
</widget>
<widget class="QSpinBox" name="sbCanvasHeight">
<property name="geometry">
<rect>
<x>30</x>
<y>70</y>
<width>221</width>
<height>31</height>
</rect>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="minimum">
<number>24</number>
</property>
<property name="maximum">
<number>32</number>
</property>
<property name="value">
<number>32</number>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<y>30</y>
<width>211</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>点阵高度</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>checkBtn</sender>
<signal>clicked()</signal>
<receiver>DlgCanvasHeightEditor</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>141</x>
<y>196</y>
</hint>
<hint type="destinationlabel">
<x>141</x>
<y>281</y>
</hint>
</hints>
</connection>
<connection>
<sender>closeBtn</sender>
<signal>clicked()</signal>
<receiver>DlgCanvasHeightEditor</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>275</x>
<y>189</y>
</hint>
<hint type="destinationlabel">
<x>297</x>
<y>304</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+106 -32
View File
@@ -113,6 +113,29 @@ void InkJetPrinter::init()
// TestPrintWidget::sendButtonClickedSignal(16) 转由 openDatetimeEditor 处理
connect(m_TestPrintWidget, &TestPrintWidget::sig_showEditDateTime, this, &InkJetPrinter::openDatetimeEditor);
connect(m_TestPrintWidget, &TestPrintWidget::sig_updatePrintContent, this, &InkJetPrinter::slt_updatePrintContent);
#ifndef FPGA_TEST
// 调入文件喷印时,主动重启打印
connect(m_TestPrintWidget, &TestPrintWidget::sig_stopPrint, m_MainWidget, [this](){
auto isPrinting = sysPara->status.isPrinting;
if(isPrinting) {
m_MainWidget->on_m_StopBtn_clicked();
QTimer::singleShot(500, [this](){
m_PrintSetting->applyPrintSettingsToSysPara(false);
m_MainWidget->on_m_StartBtn_clicked();
LogInfo::setRunStatusText("Restarting the print because the work file was switched.");
});
}
else {
QTimer::singleShot(300, [this](){
m_PrintSetting->applyPrintSettingsToSysPara(false);
});
}
});
#endif
// 班时元素与编辑 连接
connect(m_TestPrintWidget, &TestPrintWidget::sig_showScheduleShiftsEditor, this, &InkJetPrinter::showScheduleShiftsEditor);
@@ -985,7 +1008,8 @@ void InkJetPrinter::timerHandler(void){
}
// byons: 时间类型图元更新 @2026年4月11日
if (m_MainWidget->dateTimeItemsDotUpdate()) {
auto updateArea = m_MainWidget->variableItemsUpdate();
if (!updateArea.isNull()) {
// // 统计追踪更新频率
// static QElapsedTimer bnsTimer;
// static int toogleCount = 0;
@@ -997,7 +1021,7 @@ void InkJetPrinter::timerHandler(void){
// }
if(sysPara->status.isPrinting) {
m_MainWidget->SendPrintDataToFpga(0, true);
m_MainWidget->SendPrintDataToFpga(0, updateArea.left(), updateArea.width());
}
if(m_StackedWidget->currentWidget() == m_MainWidget) {
@@ -1013,11 +1037,14 @@ void InkJetPrinter::timerHandler(void){
if(gearPumpRunFlag || sysPara->para.gearPumpEnable == 0)
{
if(!sysPara->status.selfCheckDone && sysPara->status.isPrinting){
sysPara->status.selfCheckDone = true;
// sysPara->status.selfCheckDone = true;
m_MainWidget->updatePrintDisplayLabel();
// sysPara->status.flagOfAbnormalStatus = true;
qDebug()<<"打印过程中死机了!!!";
m_MainWidget->on_m_StopBtn_clicked();
}
if(!sysPara->status.selfCheckDone)
{
/*开机自检*/
@@ -1075,19 +1102,20 @@ void InkJetPrinter::timerHandler(void){
// 自检结束发送打印设置
qInfo() << "Self check done and send print para to FPGA";
sysPara->devOp->setHighVoltageAmplitudetoSTM32();
sysPara->devOp->writeFpgaCalandar(0);
sysPara->devOp->writeFpgaPrintPara(true);
// sysPara->devOp->setHighVoltageAmplitudetoSTM32();
// sysPara->devOp->writeFpgaCalandar(0);
// sysPara->devOp->writeFpgaPrintPara(true);
#ifdef __RFID_CARD
// 刷卡判定
if(sysPara->RFIDPara.inkCardTimeOut
|| sysPara->RFIDPara.solventCardTimeOut
|| sysPara->RFIDPara.needMaintenance) {
m_MainWidget->setReclaimOpenBtnStatus(false);
LogInfo::setRunStatusText(tr("Need maintenance."));
}
#endif
// 自检完成后,关闭高电压,不知道为什么,有时候开机自检都有高压
sysPara->devOp->highVoltageCtrl(0);
// 自检完成后,写入一遍打印设置和内容,不然好像直接开始打印不行
if(m_PrintSetting)
m_PrintSetting->applyPrintSettingsToSysPara(false);
m_MainWidget->SendPrintDataToFpga(0);
m_MainWidget->on_m_StopBtn_clicked();
if(sysPara->para.Reciclar)
test_flag = 1;
@@ -1172,7 +1200,8 @@ void InkJetPrinter::timerHandler(void){
#endif
if(pulse_300ms){
sysPara->devOp->readCalandarDat(); //务必读一下此数据
sysPara->devOp->readCalandarDat(); //务必读一下此数据
if(sysPara->status.RandomNum>0)
sysPara->devOp->Read_RanddomFromFpga();
#ifdef COUNTER1_BY_GROUP /* 分段计米 */
@@ -1291,6 +1320,7 @@ void InkJetPrinter::timerHandler(void){
// warningHandler(3);
// }
// LogInfo::setRunStatusText(tr("处理警告:%1").arg(QDateTime::currentDateTime()));
handleWarnInk(); // 处理墨水警告
handleWarnSolvent(); // 处理溶剂警告
#endif
@@ -1495,6 +1525,7 @@ void InkJetPrinter::getTestPrintWidgetButtonClickedSlot(int index)
m_StackedWidget->setCurrentWidget(m_MainWidget);
MySleep(200);
m_MainWidget->onPreviewScene();
m_MainWidget->SendPrintDataToFpga(0);
break;
}
@@ -1852,6 +1883,13 @@ void InkJetPrinter::saveFPGACalandarAndDat(unsigned char *data){
for(int i=0;i<len;i++){
target[i]=data[7+i];
}
QString hexStr = QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue, 16);
bool ok;
sysPara->para.cnt1CurrValue = hexStr.toUInt(&ok, 10);
hexStr = QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue, 16);
sysPara->para.cnt2CurrValue = hexStr.toUInt(&ok, 10);
}
void InkJetPrinter::saveFPGACnt3CurrValue(unsigned char *data){
@@ -2454,7 +2492,6 @@ void InkJetPrinter::autoControlHeater(){
* 控制回收槽
*
* */
void InkJetPrinter::detectAndcontrolReclaimTank(){
sysPara->status.currReclaimTankPos =10*sysPara->status.curr_reclaimTankTime;
sysPara->status.reclaimTankBlockedAppending =0;
@@ -2471,6 +2508,7 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
sysPara->devOp->controlReclaimTankOpen(false);
}
m_MainWidget->stopFlashReclaimOpenBtn();
}
else if(sysPara->status.reclaimTankstatus == 5 )//7 故障,6 关完成,5开完成,4 保持, 3 停止, 2 关, 1 开,0-无操作
{
@@ -2480,7 +2518,10 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
m_MainWidget->setRunStatus(tr("回收槽到头"));
m_MainWidget->setReclaimStatus(true, 100);
m_MainWidget->enablePrintButton(true); //仅仅在此时能使能打印按钮
sysPara->devOp->highVoltageCtrl(1);
// sysPara->devOp->highVoltageCtrl(1);
m_MainWidget->stopFlashReclaimOpenBtn();
// emit reclaimTankOpenDone();
/*回收槽开关时间校正*/
sysPara->para.reclaimTankTime =( sysPara->status.currReclaimTankPos>120 )? sysPara->status.currReclaimTankPos/10-1:12;
@@ -2494,13 +2535,21 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
else if(sysPara->status.reclaimTankstatus == 0x11 )//7 故障,6 关完成,5开完成,4 保持, 3 停止, 2 关, 1 开,0-无操作
{
sysPara->devOp->controlReclaimTankOpen(false); //卡住,关闭
m_MainWidget->stopFlashReclaimOpenBtn();
// ui->tabMainWindow->setRunStatus(tr("回收槽卡住或者回收槽开关时间设置错误"));
}
else if(sysPara->status.reclaimTankstatus == 1 || sysPara->status.reclaimTankstatus == 2)//7 故障,6 关完成,5开完成,4 保持, 3 停止, 2 关, 1 开,0-无操作
{
auto recliamTime = (sysPara->para.reclaimTankTime != 0 ? sysPara->para.reclaimTankTime : 15.0f) * 10.0f;
int rate = qBound(0, 100, int((sysPara->status.currReclaimTankPos / recliamTime) * 100));
m_MainWidget->setReclaimStatus(sysPara->status.reclaimTankstatus == 1, rate);
// 不知道为什么会有rate为0,且 sysPara->status.reclaimTankstatus == 2 ,也就是 关的状态。 回收槽位置在0处,而状态却是 关 ,很奇怪
if(sysPara->status.reclaimTankstatus != 2 && rate != 0) {
m_MainWidget->setReclaimStatus(sysPara->status.reclaimTankstatus == 1, rate);
}
m_MainWidget->setReclaimOpenBtnStatus(sysPara->status.reclaimTankstatus == 2);
m_MainWidget->setReclaimCloseBtnStatus(sysPara->status.reclaimTankstatus == 1);
sysPara->status.reclaimBlockedCnt = 0;
}
@@ -2509,14 +2558,13 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
if(sysPara->devOp->isReclaimTankCloseEnable())
sysPara->devOp->controlReclaimTankClose(false); //到头,关闭
m_MainWidget->setReclaimStatus(false, 0);
m_MainWidget->stopFlashReclaimOpenBtn();
//sysPara->status.currReclaimTankPos = 0; //将回收槽的时间置为零
// emit reclaimTankCloseDone();
sysPara->status.lastRecycleWarn = 0;
sysPara->status.HVFaultCloseEn=0;
sysPara->status.reclainCloseAppending=false;
sysPara->status.canRunAirPushing = true; //下次开回收槽就执行排气程序
LogInfo::setRunStatusText("reclaimTankCloseDone currReclaimTankPos:"+QString::number(sysPara->status.currReclaimTankPos));
}
else if(sysPara->status.reclaimTankstatus == 0x12 )//7 故障,6 关完成,5开完成,4 保持, 3 停止, 2 关, 1 开,0-无操作
{
@@ -2524,6 +2572,12 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
LogInfo::setRunStatusText(tr("回收槽卡住或者回收槽开关时间设置错误"));
m_MainWidget->setRunStatus(tr("回收槽卡住或者回收槽开关时间设置错误"));
}
else if(sysPara->status.reclaimTankstatus == 4 )
{
m_MainWidget->setReclaimOpenBtnStatus(true);
m_MainWidget->setReclaimCloseBtnStatus(true);
LogInfo::setRunStatusText("Reclaim tank hold on "+QString::number(sysPara->status.currReclaimTankPos));
}
}
void InkJetPrinter::viscosity_timerHandler()
@@ -2562,7 +2616,7 @@ void InkJetPrinter::rebootApp()
sysPara->devOp->controlInkValve(false);
sysPara->devOp->controlInkValvePWM(false);
}
m_MainWidget->setRunStatus(tr("正在准备重启,请等待%1秒...............").arg(i));
m_MainWidget->setRunStatus(tr("正在准备重启,请等待%1秒......").arg(i));
MySleep(1000);
}
}
@@ -2595,7 +2649,7 @@ void InkJetPrinter::rebootApp()
{
if(i==9)
sysPara->devOp->controlReclaimTankOpen(false);
m_MainWidget->setRunStatus(tr("正在准备重启,请等待%1秒...............").arg(i));
m_MainWidget->setRunStatus(tr("正在准备重启,请等待%1秒......").arg(i));
MySleep(1000);
}
}
@@ -2621,7 +2675,7 @@ void InkJetPrinter::rebootApp()
sysPara->para.gearPumpValue = 0;
sysPara->devOp->WriteMoterPump();
}
m_MainWidget->setRunStatus(tr("正在准备重启,请等待%1秒...............").arg(i));
m_MainWidget->setRunStatus(tr("正在准备重启,请等待%1秒......").arg(i));
MySleep(1000);
}
}
@@ -2719,11 +2773,12 @@ void InkJetPrinter::warningHandler(int type){
if (!sysPara->RFIDPara.inkCardTimeOut)
inkTime = 48- dateTimeDiff/60/60;
}
if(sysPara->RFIDPara.inkCardTimeOut){
if(sysPara->RFIDPara.inkCardTimeOut && flagOfWarning){
if(++sysPara->status.showInkWarningNumber >= INTERVAL_AFTER48H){
warningShow(CARD_TYPE::INK,49);
sysPara->status.showInkWarningNumber = 0;//是否有必要保存?
sysPara->saveRFIDPara();
flagOfWarning = false;
return;
}
}
@@ -2736,18 +2791,21 @@ void InkJetPrinter::warningHandler(int type){
if (dateTimeDiff > 60*60*24*2) {
sysPara->RFIDPara.solventCardTimeOut = true;
}
if (!sysPara->RFIDPara.solventCardTimeOut)
solventTime = 48- dateTimeDiff/60/60;
solventTime = 48- dateTimeDiff / 60 / 60;
}
if(sysPara->RFIDPara.solventCardTimeOut){
if(sysPara->RFIDPara.solventCardTimeOut && flagOfWarning){
if(++sysPara->status.showSolventWarningNumber >= INTERVAL_AFTER48H){
warningShow(CARD_TYPE::SOLVENT,49);
sysPara->status.showSolventWarningNumber = 0;
sysPara->saveRFIDPara();
flagOfWarning = false;
return;
}
}
sysPara->saveRFIDPara();
}
/***********处理保养到期提示start******************/
@@ -2856,6 +2914,7 @@ int InkJetPrinter::updateWarningTime(int type){
// 读取文件内容
QTextStream in(&file);
QString starTime = in.readAll(); // 第一次提示的时间
starTime = starTime.trimmed();
// 关闭文件
file.close();
inkWarnTime = QDateTime::fromString(starTime,"yyyy-MM-dd HH::mm::ss");
@@ -2873,6 +2932,7 @@ int InkJetPrinter::updateWarningTime(int type){
// 读取文件内容
QTextStream in(&file);
QString starTime = in.readAll(); // 第一次提示的时间
starTime = starTime.trimmed();
// 关闭文件
file.close();
solventWarnTime = QDateTime::fromString(starTime,"yyyy-MM-dd HH::mm::ss");
@@ -2968,7 +3028,6 @@ void InkJetPrinter::handleWarnInk()
if(sysPara->status.inkWarningCnt >= DETECT_WARNING_TIME){
sysPara->para.flagOfInkWarning = true;
sysPara->RFIDPara.needInkCard = true;
manager_rfid->setInkCardFirstPrompt(true);
QString strCurDateTime = QDateTime::currentDateTime().toString("yyMMddhhmmss");
LogInfo::setRunStatusText("Ink warning.");
@@ -3007,7 +3066,7 @@ void InkJetPrinter::handleWarnInk()
QDateTime curDateTime = QDateTime::currentDateTime();
QByteArray curDateTimestr = curDateTime.toString("yyyy-MM-dd HH::mm::ss").toUtf8();
QFile file("/home/plg/inkRFIDTime.txt");
if(!file.open(QIODevice::WriteOnly)){
if(!file.open(QIODevice::WriteOnly | QIODevice::Truncate)){
qDebug()<<"Open inkRFIDTime Failure.";
LogInfo::setRunStatusText("Open inkRFIDTime Failure.");
}
@@ -3046,7 +3105,6 @@ void InkJetPrinter::handleWarnSolvent()
if(sysPara->status.solventWarningCnt >= DETECT_WARNING_TIME){
sysPara->para.flagOfSolventWarning = true;
sysPara->RFIDPara.needSolventCard = true;
manager_rfid->setSolventCardFirstPrompt(true);
QDateTime curDateTime = QDateTime::currentDateTime();
QString strCurDateTime = curDateTime.toString("yyMMddhhmmss");
@@ -3084,7 +3142,7 @@ void InkJetPrinter::handleWarnSolvent()
QDateTime curDateTime = QDateTime::currentDateTime();
QByteArray curDateTimestr = curDateTime.toString("yyyy-MM-dd HH::mm::ss").toUtf8();
QFile file("/home/plg/solventRFIDTime.txt");
if(!file.open(QIODevice::WriteOnly)){
if(!file.open(QIODevice::WriteOnly | QIODevice::Truncate)){
qDebug()<<"Open solventRFIDTime Failure.";
LogInfo::setRunStatusText("Open solventRFIDTime Failure.");
}
@@ -3113,8 +3171,24 @@ void InkJetPrinter::handleWarnSolvent()
void InkJetPrinter::slt_showMsg(QString msg)
{
static QList<QMessageBox*> msgPool;
QMessageBox * msgBox = new QMessageBox(QMessageBox::NoIcon, tr("提示"), msg, QMessageBox::StandardButton::Ok);
connect(msgBox, &QMessageBox::finished, msgBox, &QMessageBox::deleteLater);
msgPool.push_back(msgBox);
connect(msgBox, &QMessageBox::finished, [this, msgBox, &msgPool](){
auto idx = msgPool.lastIndexOf(msgBox);
if(idx != -1) {
msgPool.removeAt(idx);
}
msgBox->deleteLater();
});
msgBox->show();
if(msgPool.size() > 3) {
msgPool.takeFirst()->deleteLater();
}
LogInfo::setRunStatusText(msg);
}
+22 -1
View File
@@ -4,6 +4,7 @@
#include <QDebug>
#include "DlgRFIDConfig.h"
#include "runtimectrl.h"
#include "DlgCanvasHeightEditor.h"
MainInstruction::MainInstruction(QWidget *parent) :
QWidget(parent),
@@ -26,6 +27,7 @@ MainInstruction::MainInstruction(QWidget *parent) :
dlgInputAddr = new DlgInputAddr(parent);
dialogAuthorization = new DialogAuthorization(parent);
dlgRfidConfig = new DlgRFIDConfig(this);
dlgRfidConfig->setWindowTitle(tr("RFID Settings"));
connect(dlgRfidConfig, &DlgRFIDConfig::accepted, this, &MainInstruction::onRFIDAutoConfirmTimeoutChanged);
@@ -57,6 +59,17 @@ MainInstruction::MainInstruction(QWidget *parent) :
connect(&timeDia,SIGNAL(accepted()),this,SLOT(slt_timeSetting()));
ui->btn_network->hide();
dlgCanvasHeightEditor = new DlgCanvasHeightEditor(this);
dlgCanvasHeightEditor->setWindowModality(Qt::WindowModality::WindowModal);
connect(dlgCanvasHeightEditor, &QDialog::accepted, this, [this](){
if(!sysPara)
return;
sysPara->para.canvasHeight = dlgCanvasHeightEditor->canvasHeight();
LogInfo::setRunStatusText(QString("Canvas Height: %1").arg(sysPara->para.canvasHeight));
sysPara->saveParaToFile();
});
}
MainInstruction::~MainInstruction()
@@ -251,7 +264,7 @@ void MainInstruction::slt_timeSetting()
void MainInstruction::onRfidCfgBtnClicked()
{
dlgRfidConfig->setAutoConfirmTimeout(sysPara->para.rfidCountDown);
dlgRfidConfig->setWindowModality(Qt::WindowModal);
dlgRfidConfig->setWindowModality(Qt::WindowModality::WindowModal);
dlgRfidConfig->show();
}
@@ -262,6 +275,14 @@ void MainInstruction::onRFIDAutoConfirmTimeoutChanged()
sysPara->saveRFIDPara();
}
void MainInstruction::onCanvasCfgBtnClicked()
{
if(sysPara)
dlgCanvasHeightEditor->setCanvsHeight(sysPara->para.canvasHeight);
dlgCanvasHeightEditor->show();
}
void MainInstruction::applyStyleSheet()
{
QString styleSheet =
+4
View File
@@ -13,6 +13,7 @@
#include "TimeSettingDialog.h"
class DlgRFIDConfig;
class DlgCanvasHeightEditor;
namespace Ui {
class MainInstruction;
@@ -55,6 +56,8 @@ private slots:
void onRFIDAutoConfirmTimeoutChanged();
void onCanvasCfgBtnClicked();
private:
Ui::MainInstruction *ui;
SysPara* sysPara = nullptr;
@@ -65,6 +68,7 @@ private:
DialogMaintenanceTimeSetting *MTimeSetting;
DialogAuthorization *dialogAuthorization;
DlgRFIDConfig *dlgRfidConfig = nullptr;
DlgCanvasHeightEditor* dlgCanvasHeightEditor = nullptr;
// 时间设置
TimeSettingDialog timeDia;
+37 -7
View File
@@ -98,7 +98,7 @@
</rect>
</property>
<property name="currentIndex">
<number>1</number>
<number>2</number>
</property>
<widget class="QWidget" name="tabBasic">
<attribute name="title">
@@ -291,13 +291,26 @@
<string>其他设置</string>
</property>
</widget>
<widget class="QPushButton" name="canvaSizeCfgBtn">
<property name="geometry">
<rect>
<x>310</x>
<y>70</y>
<width>254</width>
<height>92</height>
</rect>
</property>
<property name="text">
<string>窗口点阵设置</string>
</property>
</widget>
</widget>
</widget>
<widget class="QPushButton" name="closeBtn">
<property name="geometry">
<rect>
<x>660</x>
<y>470</y>
<x>670</x>
<y>500</y>
<width>100</width>
<height>40</height>
</rect>
@@ -328,8 +341,8 @@
<slot>onGraphicsEditBtnClicked()</slot>
<hints>
<hint type="sourcelabel">
<x>230</x>
<y>196</y>
<x>232</x>
<y>195</y>
</hint>
<hint type="destinationlabel">
<x>-154</x>
@@ -344,8 +357,8 @@
<slot>onRfidCfgBtnClicked()</slot>
<hints>
<hint type="sourcelabel">
<x>137</x>
<y>94</y>
<x>139</x>
<y>115</y>
</hint>
<hint type="destinationlabel">
<x>-182</x>
@@ -353,9 +366,26 @@
</hint>
</hints>
</connection>
<connection>
<sender>canvaSizeCfgBtn</sender>
<signal>clicked()</signal>
<receiver>MainInstruction</receiver>
<slot>onCanvasCfgBtnClicked()</slot>
<hints>
<hint type="sourcelabel">
<x>491</x>
<y>139</y>
</hint>
<hint type="destinationlabel">
<x>956</x>
<y>250</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>onGraphicsEditBtnClicked()</slot>
<slot>onRfidCfgBtnClicked()</slot>
<slot>onCanvasCfgBtnClicked()</slot>
</slots>
</ui>
+115 -28
View File
@@ -217,7 +217,7 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
<x>0</x>
<y>0</y>
<width>780</width>
<height>169</height>
<height>177</height>
</rect>
</property>
</widget>
@@ -289,7 +289,7 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
<height>130</height>
</size>
</property>
<property name="maximumSize">
@@ -473,7 +473,7 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
<property name="minimumSize">
<size>
<width>200</width>
<height>150</height>
<height>140</height>
</size>
</property>
<property name="maximumSize">
@@ -591,13 +591,13 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
<widget class="QFrame" name="fra_state">
<property name="minimumSize">
<size>
<width>200</width>
<width>214</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<width>214</width>
<height>140</height>
</size>
</property>
@@ -629,6 +629,18 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lb_nozzleState">
<property name="minimumSize">
<size>
<width>214</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>214</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
@@ -642,6 +654,12 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
</item>
<item alignment="Qt::AlignRight">
<widget class="QWidget" name="rightPanel" native="true">
<property name="minimumSize">
<size>
<width>156</width>
<height>0</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0">
<property name="spacing">
<number>5</number>
@@ -649,6 +667,9 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
<property name="leftMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
@@ -657,11 +678,14 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="m_RightBtn">
<widget class="QToolButton" name="m_RightBtn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>95</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
@@ -671,10 +695,40 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
<string notr="true">QToolButton {
padding: 4px 16px;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
color: #333333; /* 深灰文字,与蓝色图标协调 */
/* 中性色背景,略带渐变制造立体感 */
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #eefaff,
stop: 1 #ceefff);
border: 1px solid #a1a1a1;
}
QToolButton:hover {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #F5F7FA,
stop: 1 #E8EBF0);
border-color: #B0B6BE;
}
QToolButton:pressed {
background-color: #D5D8DD;
border-color: #A8AEB6;
}
QToolButton:disabled {
color: #A0A5AB;
background-color: #BCBFC4;
border: 1px solid #BCBFC4;
}</string>
</property>
<property name="text">
<string/>
<string>喷嘴开启</string>
</property>
<property name="icon">
<iconset resource="image.qrc">
@@ -686,11 +740,8 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
<height>70</height>
</size>
</property>
<property name="fixedSize" stdset="0">
<size>
<width>70</width>
<height>70</height>
</size>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
</widget>
</item>
@@ -736,25 +787,64 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="m_LeftBtn">
<item alignment="Qt::AlignBottom">
<widget class="QToolButton" name="m_LeftBtn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>95</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>100</height>
<height>95</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
<string notr="true">QToolButton {
padding: 4px 16px;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
color: #333333; /* 深灰文字,与蓝色图标协调 */
/* 中性色背景,略带渐变制造立体感 */
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #eefaff,
stop: 1 #ceefff);
border: 1px solid #a1a1a1;
}
QToolButton:hover {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #F5F7FA,
stop: 1 #E8EBF0);
border-color: #B0B6BE;
}
QToolButton:pressed {
background-color: #D5D8DD;
border-color: #A8AEB6;
}
QToolButton:disabled {
color: #A0A5AB;
background-color: #BCBFC4;
border: 1px solid #BCBFC4;
}</string>
</property>
<property name="text">
<string/>
<string>喷嘴关闭</string>
</property>
<property name="icon">
<iconset resource="image.qrc">
@@ -766,15 +856,12 @@ QScrollBar::add-line:horizontal { bottom: 0px; }</string>
<height>70</height>
</size>
</property>
<property name="fixedSize" stdset="0">
<size>
<width>70</width>
<height>70</height>
</size>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignBottom">
<widget class="QLabel" name="lb_LeftBtn">
<property name="minimumSize">
<size>
+1 -1
View File
@@ -157,7 +157,7 @@ void MyInputMethod::updateHandler ( int type ){
break;
case 2://QWSInputMethod::FocusOut:
inputMethod->hide();
digitalInput->hide();
// digitalInput->hide();
inputMethod->onHiden();
break;
}
+11 -6
View File
@@ -223,7 +223,13 @@ void PrintSetting::TriggerupdateModelToUI()
#endif
ui->spinBoxEleEyeTriggerIntervalMs->setValue(m_model.triggerInterval);
ui->spinBoxOutputPulseDelayMs->setValue(m_model.outputPulseDelayMs);
ui->spinBoxEleEyeTriggerRepeatCnt->setValue(m_model.eleEyeRepeatCnt);
if(m_model.eleEyeRepeatCnt > INT32_MAX){
ui->cb_unlimited->setChecked(true);
}
else {
ui->spinBoxEleEyeTriggerRepeatCnt->setValue(m_model.eleEyeRepeatCnt);
}
ui->spinBoxSynTriggerPrintLen->setText(QString::number(m_model.triggerInterval));
ui->lineEditTriggerPulsePerMm->setText(QString::number((double)m_model.encoderPulsePerMm));
@@ -586,10 +592,10 @@ void PrintSetting::setEnableEleEyeSetting(bool flag){
ui->labelEleEyeTriggerIntervalMs->setEnabled(!(ui->radioButtonSynTriggerExternal->isChecked() && ui->eleEyeEdgetTriggerInner->isChecked()));
// ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(!(ui->radioButtonSynTriggerExternal->isChecked() && ui->eleEyeEdgetTriggerInner->isChecked()));
ui->spinBoxEleMaskTime->setEnabled(flag);
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(flag);
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(true);
ui->radioButtonEleEyeEdgetTrigger->setEnabled(flag);
ui->radioButtonEleEyeLevelTrigger->setEnabled(flag);
ui->cb_unlimited->setEnabled(flag);
ui->cb_unlimited->setEnabled(true);
ui->spinBoxEleEyeTriggerPrintDelay->setEnabled(flag);
if (!flag) ui->cb_unlimited->setChecked(false);
}
@@ -629,7 +635,7 @@ void PrintSetting::applyPrintSettingsToSysPara(bool showTip)
PrintSettingModel::applyToSysPara(m_model, sysPara);
if (sysPara->devOp) {
sysPara->devOp->writeFpgaPrintPara(false);
int res = sysPara->devOp->writeFpgaPrintPara(!showTip);
sysPara->devOp->writeSyncAndDelayPrintCount(
m_model.triggerMode == PRINT_TRIGGER_SYNCHRONIZER || m_model.triggerMode == PRINT_TRIGGER_TIME,
@@ -640,7 +646,7 @@ void PrintSetting::applyPrintSettingsToSysPara(bool showTip)
sysPara->devOp->writeFlightCompCtrl(ui->enbFlightCompCtrl->isChecked(),
ui->enbAccelDecelPredict->isChecked(), quint32(ui->flightCompWindowCycles->value()));
if(sysPara->devOp->writeFpgaPrintPara(true) != -1 && showTip) {
if(res != -1 && showTip) {
QMessageBox box(QMessageBox::Icon::Information, tr("提示"), tr("应用成功"), QMessageBox::Ok, nullptr);
auto btn = box.button(QMessageBox::Ok);
// btn->setFixedSize(80, 40);
@@ -900,7 +906,6 @@ QString PrintSettingModel::toString(const PrintSettingModel &model)
return str;
}
PrintSettingModel PrintSettingModel::defPrintSettingModel()
{
QFile file(DEF_PRINT_SETTINGS_PATH);
+1 -2
View File
@@ -130,7 +130,6 @@ public:
void setModel(const PrintSettingModel& model);
void setDefaultSettingMode(bool enable);
private slots:
void buttonClickedSlot();
@@ -184,4 +183,4 @@ signals:
};
#endif // PRINTSETTING_H
#endif // PRINTSETTING_H
+19 -3
View File
@@ -381,7 +381,7 @@
</size>
</property>
<property name="minimum">
<number>1</number>
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
@@ -428,10 +428,10 @@
</size>
</property>
<property name="minimum">
<number>1</number>
<number>0</number>
</property>
<property name="maximum">
<number>253</number>
<number>2147483647</number>
</property>
</widget>
</item>
@@ -1502,5 +1502,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>cb_unlimited</sender>
<signal>toggled(bool)</signal>
<receiver>spinBoxEleEyeTriggerRepeatCnt</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>634</x>
<y>191</y>
</hint>
<hint type="destinationlabel">
<x>451</x>
<y>191</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+6 -3
View File
@@ -180,7 +180,8 @@ HEADERS += Public.h \
Log/logglobal.h \
loginfoctrl.h \
runtimectrl.h \
dump.h
dump.h \
DlgCanvasHeightEditor.h
FORMS += \
@@ -229,7 +230,8 @@ FORMS += \
scene/CounterEditor.ui \
scene/DlgBarcodeFormat.ui \
scene/DlgQrcodeFormat.ui \
dlgQrCode.ui
dlgQrCode.ui \
DlgCanvasHeightEditor.ui
SOURCES +=\
mainwidget.cpp \
@@ -339,7 +341,8 @@ SOURCES +=\
Log/logger.cpp \
Log/logmessage.cpp \
loginfoctrl.cpp \
runtimectrl.cpp
runtimectrl.cpp \
DlgCanvasHeightEditor.cpp
+8
View File
@@ -106,6 +106,10 @@ void SysPara::loadParaFromFile(){
file.seek(0);
file.read((char *)&para,(long long int)sizeof(para));
file.close();
// 韩国要求 画布大小可以设定在24 到 32 之间
para.canvasHeight = qBound(unsigned(SCENE_MIN_HEIGHT), para.canvasHeight, unsigned(SCENE_MAX_HEIGHT));
if(para.gearPumpSpeedAlarm < 1000 || para.gearPumpSpeedAlarm > 2000)
para.gearPumpSpeedAlarm = 1500;
@@ -181,6 +185,8 @@ void SysPara::loadDefaultPara(){
para.mixValveisNewVersion = 1;//混和阀是否是新管路
para.gearPumpSpeedAlarm = 1500;
para.canvasHeight = 32;
}
void SysPara::saveParaToFile(){
@@ -1029,6 +1035,7 @@ void SysPara::saveRFIDPara()
out << RFIDPara.cardInk;
out << RFIDPara.cardSolvent;
out << para.rfidCountDown;
out << status.showInkWarningNumber << status.showSolventWarningNumber;
if(!file.flush()){
LogInfo::setRunStatusText("RFID Para save Failed 1");
@@ -1076,6 +1083,7 @@ bool SysPara::loadRFIDPara()
in >> RFIDPara.cardInk;
in >> RFIDPara.cardSolvent;
in >> para.rfidCountDown;
in >> status.showInkWarningNumber >> status.showSolventWarningNumber;
file.close();
return true;
+4
View File
@@ -80,6 +80,9 @@ typedef enum {
#define MAX_QVARI_NUM 4
#define MAX_CNT1_GROUPS_NUM 50
#define SCENE_MAX_HEIGHT 32
#define SCENE_MIN_HEIGHT 24
typedef struct {
unsigned int second:6;
unsigned int minute:6;
@@ -804,6 +807,7 @@ typedef struct {
bool flagOfInkWarning; //报错累计次数达标,报警标志设为true
bool flagOfSolventWarning; //报错累计次数达标,报警标志设为true
unsigned short rfidCountDown;
unsigned int canvasHeight; // 韩国需求中,要求可以设定打印区域的高度,默认为32。
/* */
// 1108Bytes
}sysPara_t;
+4 -1
View File
@@ -1348,10 +1348,13 @@ void SystemManage::programFPGAProcess(){
emit sigToCloseSerialFPGA();
emit sigToCloseSerialSTM32();
//关闭定时器
programFPGATimer->stop();
// programFPGATimer->stop();
programFPGADialog->init();
programFPGADialog->show();
}
programFPGATimer->stop();
}
void SystemManage::PowerOnSetTime(QString date){
+2 -2
View File
@@ -18,8 +18,8 @@ int convertFreq(int index){
// qDebug()<<"index="<<index;
switch(index){
case 0:return 64000;break; //64k,pwm波,占空比50%
case 1:return 76000;break; //76k
// case 2:return 83000;break; //83k
// case 1:return 76000;break; //76k
case 1:return 83000;break; //83k
case 2:return 96000;break; //96k
case 3:return 128000;break; //128k
case 4:return 145000;break; //145k
+2 -2
View File
@@ -6,8 +6,8 @@
*/
#define UP_PRINTER_MAJOR_VER 6
#define UP_PRINTER_MINOR_VER 7
#define UP_PRINTER_RIVISION_VER 2
#define SUB_VERSION "_KOR-T"
#define UP_PRINTER_RIVISION_VER 3
#define SUB_VERSION "_KOR"
#ifdef __RFID_OLD
#define SUB_RFID "_RO"
#else
+17 -1
View File
@@ -35,7 +35,7 @@
<enum>Qt::StrongFocus</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@@ -1509,5 +1509,21 @@ height: 25px;
</hint>
</hints>
</connection>
<connection>
<sender>checkBoxResetCnt1CurrValue</sender>
<signal>toggled(bool)</signal>
<receiver>spinBoxCnt1CurrValue</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>335</x>
<y>198</y>
</hint>
<hint type="destinationlabel">
<x>453</x>
<y>198</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+6
View File
@@ -271,6 +271,12 @@ void FileManageWidget::copyFiles(QListWidget *from, QListWidget *to)
for(auto item : items) {
auto srcPath = item->data(AbsPathRole).toString();
auto destFilePath = destPath + QFileInfo(srcPath).fileName();
QFileInfo destFile(destFilePath);
if(destFile.exists()) {
QFile::remove(destFilePath);
}
bool ret = QFile::copy(srcPath, destFilePath);
qInfo() << "Copy: " << srcPath << " -> " << destFilePath << ", result: " << ret;
}
+166 -1058
View File
File diff suppressed because it is too large Load Diff
+17 -12
View File
@@ -15,6 +15,7 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QToolButton>
#include <QTextEdit>
#include <QTime>
#include <QMessageBox>
@@ -40,7 +41,6 @@ public:
void bindTxTEdit(QTextEdit* textEdit);
void bindPicScene(PicScene* pPicScene);
void PreviewPressed();
void onPreviewScene();
// 260420 hlp:场景为空时,渲染空场景并刷新界面
void handleEmptySize();
@@ -51,19 +51,15 @@ public:
bool startPrintingFlag;
bool pushButtonFlag;
int searchQrVar();
int searchExpiryVar();//检索有效期变量
void ExpiryDotUpdate(char Mode);
// 单独更新时间类图元 byons@2026年4月11日
/**
* @brief 更新时间类图元到FPGA print 数据
* @return true 有时间元素更新,false 无时间元素更新
* @return 返回需要更新的区域
* @remark 判断返回值用于决定是否SendPrintDataToFpga
*/
bool dateTimeItemsDotUpdate();
QRect variableItemsUpdate();
/**
* @brief 向FPGA print 数据缓冲区写入image
@@ -85,6 +81,10 @@ public:
// 回收槽关闭按钮状态设置
void setReclaimCloseBtnStatus(bool enable);
void flashReclaimOpenBtn();
void stopFlashReclaimOpenBtn();
/**
* @brief 设置回收槽开关状态
* @param isOpen true:开;false:关
@@ -108,7 +108,7 @@ public:
QTimer *timerShowItem,*timerPowerOff;
void SendPrintDataToFpga(unsigned char alterMode, bool isUpdate = false);
void SendPrintDataToFpga(unsigned char alterMode, int startCols = -1, int size = -1);
void updatePrintDisplayLabel();
@@ -137,8 +137,8 @@ private:
QPushButton* m_StopBtn;
QPushButton* m_StartBtn;
QPushButton* m_ToolBtn;
QPushButton* m_RightBtn;
QPushButton* m_LeftBtn;
QToolButton* m_RightBtn;
QToolButton* m_LeftBtn;
PrintTextDisplay* m_PrintDisplay;
@@ -183,12 +183,15 @@ private:
void initSheet();
bool m_reclaimFlashState = false;
QTimer* m_reclaimOpenBtnFlashTimer = nullptr;
// 高亮切换
void changeHighLight(bool isStart);
private slots:
void airPushingProcess();
void buttonClickedSlot();
void ontextEdittextChanged();
void on_m_RightBtn_clicked();
@@ -200,6 +203,8 @@ private slots:
void slt_clearCnt();
void onReclaimOpenBtnFlashTimerTimeout();
signals:
void sendButtonClickedSignal(int index);
void setDisableAll();
@@ -212,4 +217,4 @@ signals:
void newFileAcquired();
};
#endif // MainWidget_H
#endif // MainWidget_H
+2 -1
View File
@@ -12,6 +12,7 @@
#define MYSAVEFILEDLG // 定义自己的保存文件对话框,解决系统对话框按键不弹起问题
#define LANINTERFACE_NAME "eth0"
// #define FPGA_TEST
//#define __RFID_OLD //旧的加密算法
#define __RFID_CARD //刷卡功能
//#define __RFID_IND //允许印度进行二次加密的宏
@@ -28,7 +29,7 @@
enum CRYS_FREQ{
CRYS_64K,
CRYS_76K,
CRYS_83K,
CRYS_96K,
CRYS_128K
};
+8 -5
View File
@@ -65,7 +65,7 @@ void RFIDManager::MySleep(unsigned int msec, int expSize)
// recResponse = comForRFID->read(8);
break;
}
QCoreApplication::processEvents(QEventLoop::AllEvents, 10);
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
}
}
@@ -1144,6 +1144,10 @@ bool RFIDManager::waitStatus()
sysPara->para.inkWarnTime = 0;
sysPara->para.flagOfInkWarning = false;
sysPara->saveParaToFile();
QDir dir("/home/plg");
dir.remove("inkRFIDTime.txt");
res = true;
}
} else if (status.addedSolvent && status.cardSolvent) {
@@ -1157,6 +1161,9 @@ bool RFIDManager::waitStatus()
sysPara->para.solventWarnDate = 0;
sysPara->para.solventWarnTime = 0;
sysPara->saveParaToFile();
QDir dir("/home/plg");
dir.remove("solventRFIDTime.txt");
}
res = true;
}
@@ -1241,10 +1248,6 @@ void RFIDManager::slt_intervalTimerHandle()
emit sig_showMsg(tr("请及时刷溶剂卡"));
status.firstPromptSolventCard = false;
}
// if(!sysPara->RFIDPara.cardInk) {
// QMessageBox::information(nullptr, tr("提示"), tr("请及时刷溶剂卡."));
// }
//不需要通知先后,成功即可
if (waitStatus()) {
+5
View File
@@ -59,6 +59,11 @@ BarcodeEditor::BarcodeEditor(QWidget *parent) :
connect(&m_barcodeFormatEditor, &DlgBarcodeFormat::accepted, this, &BarcodeEditor::onBarcodeFormatConfirmed);
connect(&m_qrcodeFormatEditor, &DlgQrcodeFormat::accepted, this, &BarcodeEditor::onQrcodeFormatConfirmed);
m_barcodeFormatEditor.setWindowModality(Qt::WindowModality::WindowModal);
m_qrcodeFormatEditor.setWindowModality(Qt::WindowModality::WindowModal);
m_barcodeFormatEditor.setWindowTitle(tr("BarCode Format"));
m_qrcodeFormatEditor.setWindowTitle(tr("Qrcode Format"));
}
BarcodeEditor::~BarcodeEditor()
+7 -5
View File
@@ -55,8 +55,8 @@ static QImage renderDataMatrix(const unsigned char *grid, int cols, int rows, in
return QImage();
}
int width = cols * moduleSize;
int height = rows * moduleSize;
int width = rows * moduleSize;
int height = cols * moduleSize;
QImage image(width, height, QImage::Format_ARGB32);
image.fill(background);
@@ -64,8 +64,8 @@ static QImage renderDataMatrix(const unsigned char *grid, int cols, int rows, in
for (int x = 0; x < cols; ++x) {
bool bit = (grid[y * cols + x] & 0x01) != 0;
QRgb color = bit ? foreground : background;
int px = x * moduleSize;
int py = y * moduleSize;
int px = y * moduleSize;
int py = (cols - 1 - x) * moduleSize;
for (int dy = 0; dy < moduleSize; ++dy) {
for (int dx = 0; dx < moduleSize; ++dx) {
image.setPixel(px + dx, py + dy, color);
@@ -573,6 +573,8 @@ QImage ItemUtils::txtToImage(const QString &txt, const QFont &font, const QColor
painter.drawText(img.rect(), txt);
painter.end();
return img;
// 按背景色裁剪,使输出图像紧贴文字像素的最小包围盒(详见函数注释)
return clipTxtImage(img, bgRgb);
}
}
+5 -63
View File
@@ -5,6 +5,7 @@
#include <QPainter>
//#include "moveinput.h"
#include <QStyleOptionGraphicsItem>
#include "ItemCommon.h"
//extern MoveInput* moveInput;
PicTextItem::PicTextItem(QGraphicsItem *parent, QGraphicsScene *scene, const SourceType t) :
@@ -38,54 +39,6 @@ QVariant PicTextItem::source()
return m_source;
}
QImage clipImage(QImage img, const QRgb bg)
{
QRect clipRect;
for(int x = 0; x < img.width(); ++x) {
for(int y = 0; y < img.height(); ++y) {
auto rgb = img.pixel(x, y);
if(rgb != bg) {
clipRect.setLeft(x);
goto top;
}
}
}
top:
for(int y = 0; y < img.height(); ++y) {
for(int x = 0; x < img.width(); ++x) {
if(img.pixel(x, y) != bg) {
clipRect.setTop(y);
goto right;
}
}
}
right:
for(int x = img.width() - 1; x >= 0; --x) {
for(int y = 0; y < img.height(); ++y) {
if(img.pixel(x, y) != bg) {
clipRect.setRight(x + 1);
goto bottom;
}
}
}
bottom:
for(int y = img.height() - 1; y >= 0; --y) {
for(int x = 0; x < img.width(); ++x) {
if(img.pixel(x, y) != bg) {
clipRect.setBottom(y + 1);
goto end;
}
}
}
end:
QRect originRect = img.rect();
return img.copy(clipRect);
}
QImage PicTextItem::applyImgeTranslation(QImage img)
{
auto scaledWidth = boldMultiple() * img.width();
@@ -212,7 +165,7 @@ QRectF PicTextItem::boundingRect() const
if(sourceType() == SourceType::UNKNOWN)
return QGraphicsTextItem::boundingRect();
const QRectF fr(0, 0, m_itemImage.width(), m_itemImage.height());
QRectF fr(0, 0, m_itemImage.width(), m_itemImage.height());
return fr;
}
@@ -437,21 +390,10 @@ QImage PicTextItem::strToImage(const QString &str)
if(str.isEmpty())
return QImage();
QPainter painter;
QFontMetrics fm(font());
QImage img(fm.horizontalAdvance(str), fm.height(), QImage::Format_ARGB32);
QColor txtColor = colorReversal() ? QColor(255, 255, 255) : QColor(0, 0, 0);
QColor bgColor = colorReversal() ? QColor(0, 0, 0) : QColor(0, 0, 0, 0);
QRgb txtColor = colorReversal() ? 0xffffffff : 0xff000000;
QRgb bgColor = colorReversal() ? 0xff000000 : 0x00000000;
img.fill(bgColor);
painter.begin(&img);
painter.setFont(font());
painter.setPen(txtColor);
painter.drawText(img.rect(), str);
painter.end();
return clipImage(img, bgColor);
return ItemUtils::txtToImage(str, font(), txtColor, bgColor);
}
/**
+1 -1
View File
@@ -194,7 +194,7 @@
</item>
<item>
<property name="text">
<string>76K</string>
<string>83K</string>
</property>
</item>
<item>
+40 -7
View File
@@ -69,16 +69,16 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
pPicScene = new PicScene(this);
//edit@12-09
pPicScene->setSceneRect(QRectF(0,0, 3999, 32));
pPicScene->setSceneRect(QRectF(0,0, 3999, SCENE_MAX_HEIGHT));
ui.graphicsView->setScene(pPicScene);
ui.graphicsView->centerOn(0,0);
// ui->senceEditOption->bindScene(pPicScene, ui->graphicsView, ui->textEdit);
this->pPicScene->setIsdrawBackground(true);
// 哪个天才写的?拿view和scene计算一下会死吗?
for(int i=0;i<3;i++){
on_enlargeButton_pressed();
}
// for(int i=0;i<3;i++){
// on_enlargeButton_pressed();
// }
connect(pPicScene,&PicScene::selectionChanged,this,[=]() {
getShowSelectItemText();
@@ -178,7 +178,7 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
if (ret == QMessageBox::Ok){
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)));
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)), Qt::DirectConnection);
dialogSaveFile->saveLastWork();
emit sig_updatePrintContent();
} else {
@@ -400,7 +400,7 @@ void TestPrintWidget::on_saveButton_pressed()
qDebug()<<"xml file null";
#ifdef MYSAVEFILEDLG
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)));
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)), Qt::DirectConnection);
dialogSaveFile->refreshListView(editMode);
dialogSaveFile->show();
dialogSaveFile->setEnterFileName("");
@@ -492,7 +492,7 @@ void TestPrintWidget::onSaveASFile(QString filename,bool Flag){// use for dialog
saveFile();
if(sysPara){
sysPara->sysFile =xmlfileName;
sysPara->sysFile = xmlfileName;
snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
}
//snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
@@ -609,6 +609,19 @@ void TestPrintWidget::onFileOpen(QString filePath,bool reviewFlag){
}
}
}
// 主动暂停打印
if(reviewFlag) {
emit sig_stopPrint();
// xmlfileName 会被 saveLastWork 更改,因此此处暂存变量, 在执行后恢复
qDebug() << "xmlfileName:" << xmlfileName;
auto filename = xmlfileName;
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)), Qt::DirectConnection);
dialogSaveFile->saveLastWork();
xmlfileName = filename;
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
}
emit sendButtonClickedSignal(20); //打开文件完成跳转到主窗口
}
@@ -1062,6 +1075,26 @@ bool TestPrintWidget::eventFilter(QObject *watched, QEvent *event) {
return QWidget::eventFilter(watched, event);
}
void TestPrintWidget::showEvent(QShowEvent *event)
{
QWidget::showEvent(event);
pPicScene->update();
auto sceneRect = pPicScene->sceneRect();
// qreal sceneHeight = boundingRect.height() > (qreal)(sysPara->para.canvasHeight) ? SCENE_MAX_HEIGHT : (qreal)(sysPara->para.canvasHeight);
qreal sceneHeight = qMin(qreal(SCENE_MAX_HEIGHT), (qreal)(sysPara->para.canvasHeight));
sceneRect.setHeight(sceneHeight);
pPicScene->setSceneRect(sceneRect);
// 以高度为基准 最大化显示场景到 视口
auto viewportHeight = pViewer->viewport()->height();
QTransform transform = pViewer->transform();
auto targetScale = viewportHeight / sceneRect.height();
double currentScale = transform.m11();
double relativeScale = targetScale / currentScale;
pViewer->scale(relativeScale, relativeScale);
}
void TestPrintWidget::onBtn3DClicked()
{
#if defined(ARCH_AARCH64)
+3 -2
View File
@@ -84,9 +84,7 @@ public:
bool addItemFlag;
// QString getReplateAfterStr(QString);
// QMap<int,QString> varReplaceItemMap;
QMap<int,ItemReplaceInfo> varReplaceItemMap;
public slots:
void on_enlargeButton_pressed();
void on_addButton_pressed(const SourceType type = SourceType::UNKNOWN);
@@ -112,6 +110,8 @@ protected:
// 重写事件过滤器
bool eventFilter(QObject *watched, QEvent *event) override;
void showEvent(QShowEvent* event) override;
private slots:
void onSceneFocusedItemPosChanged(QPoint p);
void onBtn3DClicked();
@@ -214,6 +214,7 @@ private:
void selectItemByDirection(bool forward);
signals:
void sig_stopPrint();
void sendButtonClickedSignal(int index);
void sendUpdateFontSignl(int);