hlp:更新翻译、喷嘴到底后等至少3秒检查相检、状态机统一打印和回收槽状态、修复数字键盘输入bug
This commit is contained in:
@@ -70,3 +70,4 @@ QtUI.r668
|
|||||||
800X600_New_SystemProject-_NewInterface.zip
|
800X600_New_SystemProject-_NewInterface.zip
|
||||||
bnsTest.png
|
bnsTest.png
|
||||||
printSceneView.png
|
printSceneView.png
|
||||||
|
docs/
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
#ifndef _CUSTOM_DOUBLE_SPIN_BOX_H_
|
||||||
|
#define _CUSTOM_DOUBLE_SPIN_BOX_H_
|
||||||
|
|
||||||
|
#include <QDoubleSpinBox>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class CustomDoubleSpinBox : public QDoubleSpinBox {
|
||||||
|
public:
|
||||||
|
explicit CustomDoubleSpinBox(QWidget *parent = nullptr) : QDoubleSpinBox(parent) {
|
||||||
|
// 设置一个较大的最大位数,让用户有足够的输入精度
|
||||||
|
setDecimals(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// 重写此方法,自定义数值如何显示在输入框中
|
||||||
|
QString textFromValue(double value) const override {
|
||||||
|
// 使用 'g' 格式可以自动去掉末尾不必要的零
|
||||||
|
// 或者使用 QString::number 配合手动处理
|
||||||
|
return QString::number(value, 'g', decimals());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CUSTOM_DOUBLE_SPIN_BOX_H_
|
||||||
+66
-19
@@ -3,7 +3,9 @@
|
|||||||
#include "MyInputMethod.h"
|
#include "MyInputMethod.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
#include <QDoubleSpinBox>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
@@ -52,8 +54,7 @@ DigitalInput::~DigitalInput()
|
|||||||
void DigitalInput::onCharPressed(){
|
void DigitalInput::onCharPressed(){
|
||||||
QPushButton * button = qobject_cast<QPushButton *>(sender());
|
QPushButton * button = qobject_cast<QPushButton *>(sender());
|
||||||
QString ch = button->text();
|
QString ch = button->text();
|
||||||
|
if (!m_currSpinBox && !m_currDoubleSpinBox) {
|
||||||
if (!m_currSpinBox) {
|
|
||||||
ui->traceEdit->insert(ch);
|
ui->traceEdit->insert(ch);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -67,10 +68,45 @@ void DigitalInput::onCharPressed(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(m_currDoubleSpinBox) {
|
||||||
|
// 用正则表达式判定 newText是否是一个浮点数或部分浮点输入。
|
||||||
|
// 允许的示例: 0.2251, 15.335, 15, -924.02, 5. (末尾点为临时状态), .5
|
||||||
|
// 也允许单独的正负号作为正在输入中的状态: "-" 或 "+"
|
||||||
|
QString simulated = newText;
|
||||||
|
|
||||||
|
// Allow single sign while typing
|
||||||
|
if (simulated == "-" || simulated == "+") {
|
||||||
|
ui->traceEdit->insert(ch);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Regular expression: optional sign, then either digits with optional dot+digits, or dot+digits, or digits+dot (partial)
|
||||||
|
// 不限制小数位数;最终的最小/最大以及精度由 hideEvent 写回时决定
|
||||||
|
QRegularExpression re("^[+-]?((\\d+(\\.\\d*)?)|(\\.\\d*))$");
|
||||||
|
QRegularExpressionMatch match = re.match(simulated);
|
||||||
|
if (!match.hasMatch()) {
|
||||||
|
// not a valid float format (even partial) -> reject
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// acceptable -> insert
|
||||||
|
ui->traceEdit->insert(ch);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ch == "." && m_currSpinBox) {
|
||||||
|
// SpinBox不能输入 .
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ch == "-" && m_currSpinBox->minimum() < 0 && currentText.isEmpty()) {
|
||||||
|
ui->traceEdit->insert(ch);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
int value = newText.toInt(&ok);
|
int value = newText.toInt(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
ui->traceEdit->insert(ch);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,15 +117,6 @@ void DigitalInput::onCharPressed(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DigitalInput::onKeyBackspacePressed(){
|
void DigitalInput::onKeyBackspacePressed(){
|
||||||
|
|
||||||
// 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();
|
int cursorPos = ui->traceEdit->cursorPosition();
|
||||||
if (cursorPos > 0) {
|
if (cursorPos > 0) {
|
||||||
QString text = ui->traceEdit->text();
|
QString text = ui->traceEdit->text();
|
||||||
@@ -131,12 +158,6 @@ void DigitalInput::onEnterPressed()
|
|||||||
|
|
||||||
void DigitalInput::onClrPressed()
|
void DigitalInput::onClrPressed()
|
||||||
{
|
{
|
||||||
// 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->clear();
|
||||||
ui->traceEdit->setFocus();
|
ui->traceEdit->setFocus();
|
||||||
}
|
}
|
||||||
@@ -147,14 +168,28 @@ void DigitalInput::showEvent(QShowEvent *event)
|
|||||||
raise();
|
raise();
|
||||||
|
|
||||||
auto focusWidget = qApp->focusWidget();
|
auto focusWidget = qApp->focusWidget();
|
||||||
|
|
||||||
|
QDoubleSpinBox* dbox = dynamic_cast<QDoubleSpinBox*>(focusWidget);
|
||||||
|
if (dbox) {
|
||||||
|
m_currDoubleSpinBox = dbox;
|
||||||
|
m_currSpinBox = nullptr;
|
||||||
|
// Show value without padding trailing zeros (avoid decimals() padding)
|
||||||
|
ui->traceEdit->setText(QString::number(dbox->value(), 'g', 15));
|
||||||
|
ui->traceEdit->setFocus();
|
||||||
|
qDebug() << "The traceEdit has connected to the QDoubleSpinBox: " << dbox->objectName();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QSpinBox* box = dynamic_cast<QSpinBox*>(focusWidget);
|
QSpinBox* box = dynamic_cast<QSpinBox*>(focusWidget);
|
||||||
if(!box) {
|
if(!box) {
|
||||||
qWarning() << "focusWidget is not QSpinBox";
|
qWarning() << "focusWidget is not QSpinBox or QDoubleSpinBox";
|
||||||
m_currSpinBox = nullptr;
|
m_currSpinBox = nullptr;
|
||||||
|
m_currDoubleSpinBox = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currSpinBox = box;
|
m_currSpinBox = box;
|
||||||
|
m_currDoubleSpinBox = nullptr;
|
||||||
ui->traceEdit->setText(box->text());
|
ui->traceEdit->setText(box->text());
|
||||||
// focusWidget->clearFocus();
|
// focusWidget->clearFocus();
|
||||||
ui->traceEdit->setFocus();
|
ui->traceEdit->setFocus();
|
||||||
@@ -167,6 +202,18 @@ void DigitalInput::hideEvent(QHideEvent * event)
|
|||||||
{
|
{
|
||||||
QWidget::hideEvent(event);
|
QWidget::hideEvent(event);
|
||||||
|
|
||||||
|
if (m_currDoubleSpinBox) {
|
||||||
|
bool ok = false;
|
||||||
|
double value = ui->traceEdit->text().toDouble(&ok);
|
||||||
|
if (!ok) value = m_currDoubleSpinBox->value();
|
||||||
|
double min = m_currDoubleSpinBox->minimum();
|
||||||
|
double max = m_currDoubleSpinBox->maximum();
|
||||||
|
value = qBound(min, value, max);
|
||||||
|
m_currDoubleSpinBox->setValue(value);
|
||||||
|
m_currDoubleSpinBox->clearFocus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(m_currSpinBox) {
|
if(m_currSpinBox) {
|
||||||
int value = ui->traceEdit->text().toInt();
|
int value = ui->traceEdit->text().toInt();
|
||||||
int min = m_currSpinBox->minimum();
|
int min = m_currSpinBox->minimum();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
#include <QDoubleSpinBox>
|
||||||
|
|
||||||
class MyInputMethod;
|
class MyInputMethod;
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@@ -36,6 +37,7 @@ private:
|
|||||||
|
|
||||||
MyInputMethod *myInputMethod;
|
MyInputMethod *myInputMethod;
|
||||||
QSpinBox* m_currSpinBox = nullptr;
|
QSpinBox* m_currSpinBox = nullptr;
|
||||||
|
QDoubleSpinBox* m_currDoubleSpinBox = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIGITALINPUT_H
|
#endif // DIGITALINPUT_H
|
||||||
|
|||||||
+10
-4
@@ -1806,7 +1806,13 @@ void InkJetPrinter::initStateManager()
|
|||||||
this, &InkJetPrinter::slt_enableCloseTank, Qt::DirectConnection);
|
this, &InkJetPrinter::slt_enableCloseTank, Qt::DirectConnection);
|
||||||
// 更新回收槽状态
|
// 更新回收槽状态
|
||||||
connect(m_stateManager, &PrinterStateManager::sig_updateReclaimStatus,
|
connect(m_stateManager, &PrinterStateManager::sig_updateReclaimStatus,
|
||||||
this, [=](){m_MainWidget->updateReclaimStatus();});
|
this, [=](){m_MainWidget->updateReclaimText();});
|
||||||
|
// 不能进入准备状态,关回收槽
|
||||||
|
connect(m_stateManager, &PrinterStateManager::sig_closeTank,
|
||||||
|
this, [=](){m_MainWidget->on_m_LeftBtn_clicked();});
|
||||||
|
// 信息
|
||||||
|
connect(m_stateManager, &PrinterStateManager::sig_infoMsg,
|
||||||
|
this, [=](QString msg){m_MainWidget->setRunStatus(msg);});
|
||||||
|
|
||||||
// ============ 开机时重置状态 ============
|
// ============ 开机时重置状态 ============
|
||||||
m_stateManager->initFromSysPara();
|
m_stateManager->initFromSysPara();
|
||||||
@@ -2555,7 +2561,7 @@ void InkJetPrinter::autoControlViscosityPumpForSelfCheck(int selfCheckCnt)
|
|||||||
if(!sysPara->devOp->isViscosityPumpOpen()) {
|
if(!sysPara->devOp->isViscosityPumpOpen()) {
|
||||||
sysPara->devOp->controlViscosityPump(true);
|
sysPara->devOp->controlViscosityPump(true);
|
||||||
qDebug() << "Start test viscosity pump.";
|
qDebug() << "Start test viscosity pump.";
|
||||||
LogInfo::setRunStatusText("Start test viscosity pump.");
|
// LogInfo::setRunStatusText("Start test viscosity pump.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2563,7 +2569,7 @@ void InkJetPrinter::autoControlViscosityPumpForSelfCheck(int selfCheckCnt)
|
|||||||
if(sysPara->devOp->isViscosityPumpOpen()) {
|
if(sysPara->devOp->isViscosityPumpOpen()) {
|
||||||
sysPara->devOp->controlViscosityPump(false);
|
sysPara->devOp->controlViscosityPump(false);
|
||||||
qDebug() << "Stop test viscosity pump.";
|
qDebug() << "Stop test viscosity pump.";
|
||||||
LogInfo::setRunStatusText("Stop test viscosity pump.");
|
// LogInfo::setRunStatusText("Stop test viscosity pump.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2913,7 +2919,7 @@ bool InkJetPrinter::loadWorkFileAndPreparePrint(const QString &filename)
|
|||||||
|
|
||||||
PrintSettingModel::applyToSysPara(model, sysPara);
|
PrintSettingModel::applyToSysPara(model, sysPara);
|
||||||
|
|
||||||
ret = m_MainWidget->generatePrintContent(scene);
|
ret = m_MainWidget->generatePrintContent(scene, model);
|
||||||
if(!ret) {
|
if(!ret) {
|
||||||
LogInfo::setRunStatusText(QString("Failed to generate print content from work file: %1").arg(filename));
|
LogInfo::setRunStatusText(QString("Failed to generate print content from work file: %1").arg(filename));
|
||||||
delete scene;
|
delete scene;
|
||||||
|
|||||||
+1
-1
@@ -124,7 +124,7 @@ void MyInputMethod::updateHandler ( int type ){
|
|||||||
switch(type){
|
switch(type){
|
||||||
case 0:break;
|
case 0:break;
|
||||||
case 1:
|
case 1:
|
||||||
if(widget && (dynamic_cast<QSpinBox *>(widget))){
|
if(widget && (dynamic_cast<QSpinBox *>(widget) || dynamic_cast<QDoubleSpinBox *>(widget))){
|
||||||
if(digitalInput->isHidden()){
|
if(digitalInput->isHidden()){
|
||||||
QWidget *hostWindow = widget->window();
|
QWidget *hostWindow = widget->window();
|
||||||
QRect rec = QApplication::desktop()->screenGeometry();
|
QRect rec = QApplication::desktop()->screenGeometry();
|
||||||
|
|||||||
@@ -0,0 +1,111 @@
|
|||||||
|
#include "PressureMonitor.h"
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
PressureMonitor::PressureMonitor()
|
||||||
|
: m_tickCounter(0)
|
||||||
|
, m_sampleCount(0)
|
||||||
|
, m_bufIdx(0)
|
||||||
|
, m_totalTickCount(0)
|
||||||
|
, m_timeout(false)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < BUF_SIZE; i++) {
|
||||||
|
m_buf[i] = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PressureMonitor::tick(float realtimePressure, float calibratedPressure)
|
||||||
|
{
|
||||||
|
m_totalTickCount++;
|
||||||
|
|
||||||
|
if (m_totalTickCount >= TIMEOUT_TICKS) {
|
||||||
|
m_timeout = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_tickCounter != 0) {
|
||||||
|
m_tickCounter = (m_tickCounter + 1) % SAMPLE_INTERVAL_TICKS;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_tickCounter = (m_tickCounter + 1) % SAMPLE_INTERVAL_TICKS;
|
||||||
|
|
||||||
|
if (calibratedPressure <= 0.0f) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_buf[m_bufIdx] = realtimePressure;
|
||||||
|
m_bufIdx = (m_bufIdx + 1) % BUF_SIZE;
|
||||||
|
m_sampleCount++;
|
||||||
|
|
||||||
|
if (m_sampleCount < BUF_SIZE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float rangeMin = calibratedPressure - 10.0f;
|
||||||
|
float rangeMax = calibratedPressure + 10.0f;
|
||||||
|
|
||||||
|
if (!checkFirst4InRange(rangeMin, rangeMax)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float avg = computeTrimmedMean();
|
||||||
|
return (avg >= rangeMin && avg <= rangeMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PressureMonitor::reset()
|
||||||
|
{
|
||||||
|
m_tickCounter = 0;
|
||||||
|
m_sampleCount = 0;
|
||||||
|
m_bufIdx = 0;
|
||||||
|
m_totalTickCount = 0;
|
||||||
|
m_timeout = false;
|
||||||
|
for (int i = 0; i < BUF_SIZE; i++) {
|
||||||
|
m_buf[i] = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PressureMonitor::isCurrentlyInRange() const
|
||||||
|
{
|
||||||
|
return (m_sampleCount >= BUF_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
int PressureMonitor::stableTickCount() const
|
||||||
|
{
|
||||||
|
return m_sampleCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PressureMonitor::wasTimeout() const
|
||||||
|
{
|
||||||
|
return m_timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float* PressureMonitor::buffer() const
|
||||||
|
{
|
||||||
|
return m_buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PressureMonitor::checkFirst4InRange(float rangeMin, float rangeMax) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
float val = m_buf[(m_bufIdx + i) % BUF_SIZE];
|
||||||
|
if (val < rangeMin || val > rangeMax) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
float PressureMonitor::computeTrimmedMean() const
|
||||||
|
{
|
||||||
|
float minVal = m_buf[0];
|
||||||
|
float maxVal = m_buf[0];
|
||||||
|
float sum = 0.0f;
|
||||||
|
|
||||||
|
for (int i = 0; i < BUF_SIZE; i++) {
|
||||||
|
float val = m_buf[i];
|
||||||
|
sum += val;
|
||||||
|
if (val < minVal) minVal = val;
|
||||||
|
if (val > maxVal) maxVal = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (sum - minVal - maxVal) / (float)(BUF_SIZE - 2);
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#ifndef PRESSUREMONITOR_H
|
||||||
|
#define PRESSUREMONITOR_H
|
||||||
|
|
||||||
|
class PressureMonitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PressureMonitor();
|
||||||
|
|
||||||
|
// 每个100ms tick 调用一次(外部调用频率不变)
|
||||||
|
// realtimePressure: 实时压力 (sysPara->status.PRESSURE)
|
||||||
|
// calibratedPressure: 标定压力 (sysPara->para.pressure)
|
||||||
|
//
|
||||||
|
// 内部逻辑:每500ms采样一次,维护最近12个采样的环形缓冲区。
|
||||||
|
// 缓冲区满12个后,先检查最旧的4个采样是否各自在标定值 ±10 范围内,
|
||||||
|
// 满足后去掉全部12个中的最大值和最小值取平均,判断均值是否在 ±10 内。
|
||||||
|
// 每次新采样入队、最旧采样出队后立即重新判定。
|
||||||
|
// 返回 true 表示:
|
||||||
|
// 1) 前4入界且去极值均值在 ±10 范围内,或
|
||||||
|
// 2) 超过 2 分钟仍未稳定,兜底超时结束
|
||||||
|
bool tick(float realtimePressure, float calibratedPressure);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
bool isCurrentlyInRange() const;
|
||||||
|
int stableTickCount() const;
|
||||||
|
bool wasTimeout() const;
|
||||||
|
|
||||||
|
// 返回环形缓冲区(12个压力值)
|
||||||
|
const float* buffer() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
float computeTrimmedMean() const;
|
||||||
|
bool checkFirst4InRange(float rangeMin, float rangeMax) const;
|
||||||
|
|
||||||
|
static const int SAMPLE_INTERVAL_TICKS = 5; // 500ms / 100ms
|
||||||
|
static const int BUF_SIZE = 12; // 缓冲区大小
|
||||||
|
static const int TIMEOUT_TICKS = 1200; // 2分钟 / 100ms
|
||||||
|
|
||||||
|
int m_tickCounter; // 100ms tick 计数,==0 时采样
|
||||||
|
int m_sampleCount; // 已采集样本总数
|
||||||
|
int m_bufIdx; // 环形缓冲区下一次写入位置
|
||||||
|
float m_buf[12]; // 环形缓冲区
|
||||||
|
int m_totalTickCount; // 超时用总 tick 计数
|
||||||
|
bool m_timeout; // 是否已超时
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PRESSUREMONITOR_H
|
||||||
+32
-45
@@ -89,6 +89,14 @@ void PrintSetting::init()
|
|||||||
if(b)
|
if(b)
|
||||||
on_radioButtonSynTriggerExternal_clicked();
|
on_radioButtonSynTriggerExternal_clicked();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(ui->dsb_diameter, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, [this](double v){
|
||||||
|
updateTriggerPPM();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->dsb_pulsePerCycle, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, [this](double v){
|
||||||
|
updateTriggerPPM();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void MySleep(unsigned int msec);
|
extern void MySleep(unsigned int msec);
|
||||||
@@ -124,8 +132,13 @@ void PrintSetting::updateModelFromUI(){
|
|||||||
m_model.eleEyeTriggerPrintDelay = ui->spinBoxEleEyeTriggerPrintDelay->value();
|
m_model.eleEyeTriggerPrintDelay = ui->spinBoxEleEyeTriggerPrintDelay->value();
|
||||||
m_model.timeTriggerPrintMode = 0;
|
m_model.timeTriggerPrintMode = 0;
|
||||||
m_model.triggerInterval = ui->spinBoxEleEyeTriggerIntervalMs->value();
|
m_model.triggerInterval = ui->spinBoxEleEyeTriggerIntervalMs->value();
|
||||||
|
|
||||||
|
updateTriggerPPM();
|
||||||
m_model.encoderPulsePerMm = ui->lineEditTriggerPulsePerMm->text().toFloat();
|
m_model.encoderPulsePerMm = ui->lineEditTriggerPulsePerMm->text().toFloat();
|
||||||
|
|
||||||
|
m_model.encoderDiameter = ui->dsb_diameter->value();
|
||||||
|
m_model.encoderPulsePerCycle = ui->dsb_pulsePerCycle->value();
|
||||||
|
|
||||||
if(ui->eleEyeEdgetTriggerExternal->isChecked() && ui->radioButtonSynTriggerExternal->isChecked()) {
|
if(ui->eleEyeEdgetTriggerExternal->isChecked() && ui->radioButtonSynTriggerExternal->isChecked()) {
|
||||||
m_model.triggerMode = ui->radioButtonEleEyeEdgetTrigger->isChecked() ? PRINT_TRIGGER_ELEC_EYE_EDGE : PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL;
|
m_model.triggerMode = ui->radioButtonEleEyeEdgetTrigger->isChecked() ? PRINT_TRIGGER_ELEC_EYE_EDGE : PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL;
|
||||||
}
|
}
|
||||||
@@ -215,7 +228,16 @@ void PrintSetting::TriggerupdateModelToUI()
|
|||||||
ui->spinBoxEleEyeTriggerRepeatCnt->setValue(m_model.eleEyeRepeatCnt);
|
ui->spinBoxEleEyeTriggerRepeatCnt->setValue(m_model.eleEyeRepeatCnt);
|
||||||
|
|
||||||
ui->spinBoxSynTriggerPrintLen->setText(QString::number(m_model.triggerInterval));
|
ui->spinBoxSynTriggerPrintLen->setText(QString::number(m_model.triggerInterval));
|
||||||
ui->lineEditTriggerPulsePerMm->setText(QString::number((double)m_model.encoderPulsePerMm));
|
|
||||||
|
auto b = ui->dsb_diameter->blockSignals(true);
|
||||||
|
ui->dsb_diameter->setValue(m_model.encoderDiameter);
|
||||||
|
ui->dsb_diameter->blockSignals(b);
|
||||||
|
|
||||||
|
b = ui->dsb_pulsePerCycle->blockSignals(true);
|
||||||
|
ui->dsb_pulsePerCycle->setValue(m_model.encoderPulsePerCycle);
|
||||||
|
ui->dsb_pulsePerCycle->blockSignals(b);
|
||||||
|
|
||||||
|
updateTriggerPPM();
|
||||||
|
|
||||||
ui->comboBoxEleEyeMakeClean->setCurrentIndex(0);
|
ui->comboBoxEleEyeMakeClean->setCurrentIndex(0);
|
||||||
|
|
||||||
@@ -241,10 +263,10 @@ void PrintSetting::TriggerupdateModelToUI()
|
|||||||
void PrintSetting::updateSysStatusToUI(){
|
void PrintSetting::updateSysStatusToUI(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintSetting::on_pushButtonApplyPulseFix_clicked()
|
void PrintSetting::updateTriggerPPM()
|
||||||
{
|
{
|
||||||
float circle = ui->lineEditDiameter->text().toFloat() * 3.1415926;
|
double circle = ui->dsb_diameter->value() * 3.1415926;
|
||||||
float pulseNum = ui->lineEditPulsePerCycle->text().toFloat();
|
double pulseNum = ui->dsb_pulsePerCycle->value();
|
||||||
if(circle != 0){
|
if(circle != 0){
|
||||||
auto pulseNumPerMM = 4*pulseNum/circle; //电路和Fpga做了4倍频处理,这里乘以4是为了匹配4倍频的处理进行正确的显示
|
auto pulseNumPerMM = 4*pulseNum/circle; //电路和Fpga做了4倍频处理,这里乘以4是为了匹配4倍频的处理进行正确的显示
|
||||||
m_model.encoderPulsePerMm = pulseNumPerMM;
|
m_model.encoderPulsePerMm = pulseNumPerMM;
|
||||||
@@ -252,15 +274,6 @@ void PrintSetting::on_pushButtonApplyPulseFix_clicked()
|
|||||||
ui->lineEditTriggerPulsePerMm->setText(QString::number(pulseNumPerMM));
|
ui->lineEditTriggerPulsePerMm->setText(QString::number(pulseNumPerMM));
|
||||||
ui->lineEditTriggerPulsePerMm->blockSignals(b);
|
ui->lineEditTriggerPulsePerMm->blockSignals(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(!sysPara)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pulseNumFix->bindSysPara(sysPara);
|
|
||||||
pulseNumFix->hide();
|
|
||||||
pulseNumFix->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintSetting::onPulseNumFixDone(float value){
|
void PrintSetting::onPulseNumFixDone(float value){
|
||||||
@@ -304,16 +317,6 @@ void PrintSetting::on_radioButtonEleEyeLevelTrigger_pressed()
|
|||||||
void PrintSetting::on_radioButtonSynTrigger_pressed()
|
void PrintSetting::on_radioButtonSynTrigger_pressed()
|
||||||
{
|
{
|
||||||
setTriggerUI(PRINT_TRIGGER_SYNCHRONIZER);
|
setTriggerUI(PRINT_TRIGGER_SYNCHRONIZER);
|
||||||
//edit@11-19
|
|
||||||
// const unsigned short &FpgaVer=sysPara->status.build_dat.builTime;
|
|
||||||
// //72版本禁用字符宽度
|
|
||||||
// if(72 == FpgaVer){
|
|
||||||
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
|
|
||||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(0);
|
|
||||||
// }else if (67 == FpgaVer)
|
|
||||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1);
|
|
||||||
// emit synDisableFontWidth(true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
||||||
@@ -327,16 +330,6 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
|||||||
#ifndef NON_CABLE
|
#ifndef NON_CABLE
|
||||||
// ui->spinBoxSynTriggerPrintLen->setEnabled(1);
|
// ui->spinBoxSynTriggerPrintLen->setEnabled(1);
|
||||||
#endif
|
#endif
|
||||||
// ui->labelSynTriggerPrintLen->setEnabled(1);
|
|
||||||
// ui->lineEditTriggerPulsePerMm->setEnabled(1);
|
|
||||||
// ui->labelTriggerPulsePerMm->setEnabled(1);
|
|
||||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1);
|
|
||||||
// ui->labelSynTriggerPrintLenRatio->setEnabled(1);
|
|
||||||
// ui->checkBoxEleEyeMakeClean->setEnabled(1);
|
|
||||||
// ui->pushButtonApplyPulseFix->setEnabled(1);
|
|
||||||
// ui->comboBoxSynPrintMode->setEnabled(1);
|
|
||||||
// ui->labelSynPrintMode->setEnabled(1);
|
|
||||||
// ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0);
|
|
||||||
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
|
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
|
||||||
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
|
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
|
||||||
ui->labelEleMaskTime->setText(tr("抑止距离(毫米)"));
|
ui->labelEleMaskTime->setText(tr("抑止距离(毫米)"));
|
||||||
@@ -351,16 +344,6 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
|||||||
#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->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
|
||||||
// ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
|
||||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
|
||||||
// ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
|
||||||
// ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
|
||||||
// ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
|
||||||
// ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
|
||||||
// ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
|
||||||
// ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1);
|
|
||||||
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)"));
|
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)"));
|
||||||
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)"));
|
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)"));
|
||||||
ui->labelEleMaskTime->setText(tr("抑止距离(毫秒)"));
|
ui->labelEleMaskTime->setText(tr("抑止距离(毫秒)"));
|
||||||
@@ -602,8 +585,8 @@ 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(false);
|
||||||
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);
|
||||||
@@ -732,6 +715,8 @@ void PrintSettingModel::loadFromXml(PrintSettingModel& model, const QXmlStreamAt
|
|||||||
model.unlimitedRepeat = attrs.value("unlimitedRepeat").toInt() != 0;
|
model.unlimitedRepeat = attrs.value("unlimitedRepeat").toInt() != 0;
|
||||||
model.triggerMode = attrs.value("triggerMode").toUInt();
|
model.triggerMode = attrs.value("triggerMode").toUInt();
|
||||||
model.encoderPulsePerMm = attrs.value("encoderPulsePerMm").toFloat();
|
model.encoderPulsePerMm = attrs.value("encoderPulsePerMm").toFloat();
|
||||||
|
model.encoderDiameter = attrs.value("encoderDiameter").toDouble();
|
||||||
|
model.encoderPulsePerCycle = attrs.value("encoderPulsePerCycle").toDouble();
|
||||||
model.printColDelay = attrs.value("printColDelay").toUInt();
|
model.printColDelay = attrs.value("printColDelay").toUInt();
|
||||||
model.volParaIndex = (unsigned short)attrs.value("volParaIndex").toUInt();
|
model.volParaIndex = (unsigned short)attrs.value("volParaIndex").toUInt();
|
||||||
model.eleEyeTriggerPrintDelay = (unsigned short)attrs.value("eleEyeTriggerPrintDelay").toUInt();
|
model.eleEyeTriggerPrintDelay = (unsigned short)attrs.value("eleEyeTriggerPrintDelay").toUInt();
|
||||||
@@ -773,6 +758,8 @@ void PrintSettingModel::saveToXml(const PrintSettingModel& model, QXmlStreamWrit
|
|||||||
writer.writeAttribute("unlimitedRepeat", QString::number(model.unlimitedRepeat));
|
writer.writeAttribute("unlimitedRepeat", QString::number(model.unlimitedRepeat));
|
||||||
writer.writeAttribute("triggerMode", QString::number(model.triggerMode));
|
writer.writeAttribute("triggerMode", QString::number(model.triggerMode));
|
||||||
writer.writeAttribute("encoderPulsePerMm", QString::number((double)model.encoderPulsePerMm));
|
writer.writeAttribute("encoderPulsePerMm", QString::number((double)model.encoderPulsePerMm));
|
||||||
|
writer.writeAttribute("encoderPulsePerCycle", QString::number(model.encoderPulsePerCycle));
|
||||||
|
writer.writeAttribute("encoderDiameter", QString::number(model.encoderDiameter));
|
||||||
writer.writeAttribute("printColDelay", QString::number(model.printColDelay));
|
writer.writeAttribute("printColDelay", QString::number(model.printColDelay));
|
||||||
writer.writeAttribute("volParaIndex", QString::number(model.volParaIndex));
|
writer.writeAttribute("volParaIndex", QString::number(model.volParaIndex));
|
||||||
writer.writeAttribute("eleEyeTriggerPrintDelay", QString::number(model.eleEyeTriggerPrintDelay));
|
writer.writeAttribute("eleEyeTriggerPrintDelay", QString::number(model.eleEyeTriggerPrintDelay));
|
||||||
|
|||||||
+5
-1
@@ -42,6 +42,10 @@ struct PrintSettingModel
|
|||||||
|
|
||||||
float encoderPulsePerMm = 40; // 编码器的每毫米脉冲数
|
float encoderPulsePerMm = 40; // 编码器的每毫米脉冲数
|
||||||
|
|
||||||
|
double encoderDiameter = 10; // 编码器的直径,单位毫米
|
||||||
|
|
||||||
|
double encoderPulsePerCycle = 5000; // 编码器每圈的脉冲数
|
||||||
|
|
||||||
unsigned printColDelay = 6; // 打印列延迟,(字宽)
|
unsigned printColDelay = 6; // 打印列延迟,(字宽)
|
||||||
|
|
||||||
unsigned short volParaIndex = 0; // 喷印模式的索引, 决定选择哪组电压参数
|
unsigned short volParaIndex = 0; // 喷印模式的索引, 决定选择哪组电压参数
|
||||||
@@ -145,7 +149,7 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void buttonClickedSlot();
|
void buttonClickedSlot();
|
||||||
|
|
||||||
void on_pushButtonApplyPulseFix_clicked();
|
void updateTriggerPPM();
|
||||||
|
|
||||||
void onPulseNumFixDone(float);
|
void onPulseNumFixDone(float);
|
||||||
|
|
||||||
|
|||||||
+41
-38
@@ -592,6 +592,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="lineEditTriggerPulsePerMm">
|
<widget class="QLineEdit" name="lineEditTriggerPulsePerMm">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -816,19 +819,6 @@
|
|||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLineEdit" name="lineEditDiameter">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>400</x>
|
|
||||||
<y>220</y>
|
|
||||||
<width>161</width>
|
|
||||||
<height>31</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="inputMethodHints">
|
|
||||||
<set>Qt::ImhNone</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="labelDiameter">
|
<widget class="QLabel" name="labelDiameter">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
@@ -861,49 +851,57 @@
|
|||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLineEdit" name="lineEditPulsePerCycle">
|
<widget class="CustomDoubleSpinBox" name="dsb_pulsePerCycle">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>400</x>
|
<x>400</x>
|
||||||
<y>170</y>
|
<y>170</y>
|
||||||
<width>161</width>
|
<width>171</width>
|
||||||
<height>31</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="inputMethodHints">
|
<property name="buttonSymbols">
|
||||||
<set>Qt::ImhNone</set>
|
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>10000000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>100.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>5000.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="pushButtonApplyPulseFix">
|
<widget class="CustomDoubleSpinBox" name="dsb_diameter">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>400</x>
|
<x>400</x>
|
||||||
<y>260</y>
|
<y>220</y>
|
||||||
<width>161</width>
|
<width>171</width>
|
||||||
<height>37</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="buttonSymbols">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="decimals">
|
||||||
<size>
|
<number>10</number>
|
||||||
<width>150</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="layoutDirection">
|
<property name="minimum">
|
||||||
<enum>Qt::LeftToRight</enum>
|
<double>5.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="maximum">
|
||||||
<string>脉冲数修正</string>
|
<double>10000.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="value">
|
||||||
<iconset resource="image.qrc">
|
<double>100.000000000000000</double>
|
||||||
<normaloff>:/icon/pulse.png</normaloff>:/icon/pulse.png</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -1484,6 +1482,11 @@
|
|||||||
<signal>pressed()</signal>
|
<signal>pressed()</signal>
|
||||||
</slots>
|
</slots>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>CustomDoubleSpinBox</class>
|
||||||
|
<extends>QDoubleSpinBox</extends>
|
||||||
|
<header>CustomDoubleSpinBox.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="image.qrc"/>
|
<include location="image.qrc"/>
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ HEADERS += Public.h \
|
|||||||
# ParaSettingUI.h \
|
# ParaSettingUI.h \
|
||||||
DevOp.h \
|
DevOp.h \
|
||||||
posix_qextserialport.h \
|
posix_qextserialport.h \
|
||||||
|
PressureMonitor.h \
|
||||||
rfid/sm4.h \
|
rfid/sm4.h \
|
||||||
rfid/sm3.h \
|
rfid/sm3.h \
|
||||||
rfid/rfidfunction.h \
|
rfid/rfidfunction.h \
|
||||||
@@ -184,7 +185,8 @@ HEADERS += Public.h \
|
|||||||
runtimectrl.h \
|
runtimectrl.h \
|
||||||
dump.h \
|
dump.h \
|
||||||
DlgCanvasHeightEditor.h \
|
DlgCanvasHeightEditor.h \
|
||||||
StateMachine/PrinterStateManager.h
|
StateMachine/PrinterStateManager.h \
|
||||||
|
CustomDoubleSpinBox.h
|
||||||
|
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
@@ -253,6 +255,7 @@ SOURCES +=\
|
|||||||
# ParaSettingUI.cpp \
|
# ParaSettingUI.cpp \
|
||||||
DevOp.cpp \
|
DevOp.cpp \
|
||||||
posix_qextserialport.cpp \
|
posix_qextserialport.cpp \
|
||||||
|
PressureMonitor.cpp \
|
||||||
rfid/sm4.cpp \
|
rfid/sm4.cpp \
|
||||||
rfid/sm3.cpp \
|
rfid/sm3.cpp \
|
||||||
rfid/rfidfunction.cpp \
|
rfid/rfidfunction.cpp \
|
||||||
|
|||||||
@@ -31,17 +31,6 @@ PrinterStateManager::~PrinterStateManager()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrinterStateManager::initTimer()
|
|
||||||
{
|
|
||||||
if (m_updateUITimer == NULL) {
|
|
||||||
m_updateUITimer = new QTimer();
|
|
||||||
connect(m_updateUITimer, &QTimer::timeout, this,
|
|
||||||
&PrinterStateManager::slt_timeout);
|
|
||||||
m_updateUITimer->setInterval(50);
|
|
||||||
m_updateUITimer->setSingleShot(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString PrinterStateManager::stateName() const
|
QString PrinterStateManager::stateName() const
|
||||||
{
|
{
|
||||||
switch (m_currentState) {
|
switch (m_currentState) {
|
||||||
@@ -149,30 +138,23 @@ void PrinterStateManager::requestTransition(PrinterEvent event)
|
|||||||
setState(trans->toState, trans->description);
|
setState(trans->toState, trans->description);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int f = 0;
|
|
||||||
void PrinterStateManager::checkReadyState()
|
void PrinterStateManager::checkReadyState()
|
||||||
{
|
{
|
||||||
// 自检完成后,随时检查能否进入READY状态
|
// 自检完成后,随时检查能否进入READY状态
|
||||||
if (m_currentState == PrinterState::SELF_CHECK) {
|
if (m_currentState == PrinterState::SELF_CHECK) {
|
||||||
if (m_sysPara) {
|
if (m_sysPara) {
|
||||||
if (f ++ > 50) {
|
// 现在还有个压力稳定期,期间也不能切换状态
|
||||||
f = 0;
|
|
||||||
LogInfo::setRunStatusText
|
|
||||||
(QString("%3:%1---airPushing:%2")
|
|
||||||
.arg(m_sysPara->status.reclaimTankstatus)
|
|
||||||
.arg(m_sysPara->status.airPushing)
|
|
||||||
.arg(stateName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_sysPara->status.airPushing) {
|
if (m_sysPara->status.airPushing) {
|
||||||
emit sig_enableOpenTank(false);
|
|
||||||
emit sig_enableCloseTank(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m_sysPara->status.reclaimTankstatus) {
|
switch (m_sysPara->status.reclaimTankstatus) {
|
||||||
case 5:
|
case 5:
|
||||||
setState(PrinterState::READY, "READY");
|
emit sig_updateReclaimStatus();
|
||||||
|
// 检测压力波动 -10~10,检测 3 秒,相位故障 检测3秒,总时长不超过60秒
|
||||||
|
if (!isState(PrinterState::READY)) {
|
||||||
|
if (m_canReadyTimer) m_canReadyTimer->start();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// 回收槽状态变化后就更新一次
|
// 回收槽状态变化后就更新一次
|
||||||
@@ -202,8 +184,9 @@ void PrinterStateManager::setState(PrinterState newState, const QString& reason)
|
|||||||
|
|
||||||
qDebug() << "State changed:" << stateName() << "Reason:" << reason;
|
qDebug() << "State changed:" << stateName() << "Reason:" << reason;
|
||||||
|
|
||||||
if (m_updateUITimer && !m_updateUITimer->isActive())
|
if (m_updateUITimer && !m_updateUITimer->isActive()) {
|
||||||
m_updateUITimer->start();
|
m_updateUITimer->start();
|
||||||
|
}
|
||||||
|
|
||||||
// 发送信号通知外部
|
// 发送信号通知外部
|
||||||
emit sig_stateChanged(newState, m_previousState, reason);
|
emit sig_stateChanged(newState, m_previousState, reason);
|
||||||
@@ -227,30 +210,22 @@ QString PrinterStateManager::stateNameFromEnum(PrinterState state) const
|
|||||||
|
|
||||||
// ============ 守卫条件函数 ============
|
// ============ 守卫条件函数 ============
|
||||||
|
|
||||||
static char times = 0;
|
|
||||||
bool PrinterStateManager::guardReclaimTankOpen()
|
bool PrinterStateManager::guardReclaimTankOpen()
|
||||||
{
|
{
|
||||||
if (!m_sysPara) return false;
|
if (!m_sysPara) return false;
|
||||||
if (times ++ > 50) {
|
// 开完成和关完成后,回收槽状态会变成0
|
||||||
times = 0;
|
|
||||||
LogInfo::setRunStatusText(QString("guardReclaimTankOpen:%1").arg(m_sysPara->status.reclainTankReachEnd));
|
|
||||||
LogInfo::setRunStatusText(QString("reclaimTankstatus:%1").arg(m_sysPara->status.reclaimTankstatus));
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_sysPara->status.reclainTankReachEnd || (m_sysPara->status.reclaimTankstatus == 5);
|
return m_sysPara->status.reclainTankReachEnd || (m_sysPara->status.reclaimTankstatus == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrinterStateManager::guardInkSwintOpen()
|
bool PrinterStateManager::guardInkSwintOpen()
|
||||||
{
|
{
|
||||||
if (!m_sysPara) return false;
|
if (!m_sysPara) return false;
|
||||||
LogInfo::setRunStatusText("guardInkSwintOpen:" + !(m_sysPara->status.statWarn & WARN_STATUS_INK_SWINT));
|
|
||||||
return !(m_sysPara->status.statWarn & WARN_STATUS_INK_SWINT);
|
return !(m_sysPara->status.statWarn & WARN_STATUS_INK_SWINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrinterStateManager::guardNoError()
|
bool PrinterStateManager::guardNoError()
|
||||||
{
|
{
|
||||||
if (!m_sysPara) return false;
|
if (!m_sysPara) return false;
|
||||||
LogInfo::setRunStatusText("guardNoError:" + (m_sysPara->status.statWarn == 0));
|
|
||||||
return m_sysPara->status.statWarn == 0;
|
return m_sysPara->status.statWarn == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,8 +244,7 @@ bool PrinterStateManager::guardNoSolventWarn()
|
|||||||
bool PrinterStateManager::guardSelfCheckDone()
|
bool PrinterStateManager::guardSelfCheckDone()
|
||||||
{
|
{
|
||||||
if (!m_sysPara) return false;
|
if (!m_sysPara) return false;
|
||||||
LogInfo::setRunStatusText("guardSelfCheckDone:" + m_sysPara->status.selfCheckDone);
|
return m_sysPara->status.selfCheckDone;
|
||||||
return m_sysPara->status.selfCheckDone == true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrinterStateManager::guardCanStartPrint()
|
bool PrinterStateManager::guardCanStartPrint()
|
||||||
@@ -282,15 +256,34 @@ bool PrinterStateManager::guardCanStartPrint()
|
|||||||
guardNoError() && guardSelfCheckDone();
|
guardNoError() && guardSelfCheckDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrinterStateManager::slt_timeout()
|
void PrinterStateManager::initTimer()
|
||||||
|
{
|
||||||
|
if (m_updateUITimer == NULL) {
|
||||||
|
m_updateUITimer = new QTimer();
|
||||||
|
connect(m_updateUITimer, &QTimer::timeout, this,
|
||||||
|
&PrinterStateManager::slt_timeoutUI);
|
||||||
|
m_updateUITimer->setInterval(50);
|
||||||
|
m_updateUITimer->setSingleShot(true);
|
||||||
|
}
|
||||||
|
if (m_canReadyTimer == NULL) {
|
||||||
|
m_canReadyTimer = new QTimer();
|
||||||
|
connect(m_canReadyTimer, &QTimer::timeout, this,
|
||||||
|
&PrinterStateManager::slt_timeoutReady);
|
||||||
|
m_canReadyTimer->setInterval(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrinterStateManager::slt_timeoutUI()
|
||||||
{
|
{
|
||||||
if (m_sysPara) {
|
if (m_sysPara) {
|
||||||
LogInfo::setRunStatusText(QString("slt_timeout ENTER:%1--state:%2--airPushing:%3")
|
LogInfo::setRunStatusText(QString("slt_timeout ENTER:%1--state:%2")
|
||||||
.arg(stateName())
|
.arg(stateName())
|
||||||
.arg(m_sysPara->status.reclaimTankstatus)
|
.arg(m_sysPara->status.reclaimTankstatus));
|
||||||
.arg(m_sysPara->status.airPushing));
|
|
||||||
|
|
||||||
switch (m_sysPara->status.reclaimTankstatus) {
|
switch (m_sysPara->status.reclaimTankstatus) {
|
||||||
|
case 0:
|
||||||
|
emit sig_updateReclaimStatus();
|
||||||
|
break;
|
||||||
case 1: // 开
|
case 1: // 开
|
||||||
emit sig_enableOpenTank(false);
|
emit sig_enableOpenTank(false);
|
||||||
emit sig_enableCloseTank(true);
|
emit sig_enableCloseTank(true);
|
||||||
@@ -303,8 +296,6 @@ void PrinterStateManager::slt_timeout()
|
|||||||
case 4:
|
case 4:
|
||||||
break;
|
break;
|
||||||
case 5: // 开完成
|
case 5: // 开完成
|
||||||
// emit sig_enableStartPrint(true);
|
|
||||||
// emit sig_enableStopPrint(true);
|
|
||||||
emit sig_enableOpenTank(false);
|
emit sig_enableOpenTank(false);
|
||||||
emit sig_enableCloseTank(true);
|
emit sig_enableCloseTank(true);
|
||||||
break;
|
break;
|
||||||
@@ -342,3 +333,32 @@ void PrinterStateManager::slt_timeout()
|
|||||||
// 避免发出太多信号
|
// 避免发出太多信号
|
||||||
if (m_updateUITimer) m_updateUITimer->stop();
|
if (m_updateUITimer) m_updateUITimer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static short allTimes = 0;
|
||||||
|
static short checkTimes = 0;
|
||||||
|
void PrinterStateManager::slt_timeoutReady()
|
||||||
|
{
|
||||||
|
allTimes++; //3s(checkTimes=6)一个周期,不超过60秒
|
||||||
|
if (allTimes > 120) {
|
||||||
|
if (m_canReadyTimer) m_canReadyTimer->stop();
|
||||||
|
|
||||||
|
allTimes = 0;
|
||||||
|
checkTimes = 0;
|
||||||
|
emit sig_closeTank();
|
||||||
|
emit sig_infoMsg(tr("相位故障,回收喷嘴"));
|
||||||
|
}
|
||||||
|
|
||||||
|
emit sig_infoMsg(tr("检查相位中..."));
|
||||||
|
|
||||||
|
// 检查相位,如果有一个错误,就重新开始累计
|
||||||
|
if (m_sysPara->status.lastPhaseFault) { checkTimes = 0; }
|
||||||
|
|
||||||
|
// 累计6次(3秒)后,再进入READY状态
|
||||||
|
if (checkTimes++ > 5){
|
||||||
|
if (m_canReadyTimer) m_canReadyTimer->stop();
|
||||||
|
|
||||||
|
checkTimes = 0;
|
||||||
|
setState(PrinterState::READY, "READY");
|
||||||
|
emit sig_infoMsg(tr("检查完毕"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -69,6 +69,11 @@ signals:
|
|||||||
|
|
||||||
// 更新回收槽状态
|
// 更新回收槽状态
|
||||||
void sig_updateReclaimStatus();
|
void sig_updateReclaimStatus();
|
||||||
|
|
||||||
|
// 收回收槽
|
||||||
|
void sig_closeTank();
|
||||||
|
// 提示信息
|
||||||
|
void sig_infoMsg(QString);
|
||||||
private:
|
private:
|
||||||
PrinterStateManager();
|
PrinterStateManager();
|
||||||
~PrinterStateManager();
|
~PrinterStateManager();
|
||||||
@@ -79,9 +84,6 @@ private:
|
|||||||
PrinterState m_currentState = PrinterState::IDLE;
|
PrinterState m_currentState = PrinterState::IDLE;
|
||||||
PrinterState m_previousState = PrinterState::IDLE;
|
PrinterState m_previousState = PrinterState::IDLE;
|
||||||
|
|
||||||
QTimer* m_updateUITimer = NULL;
|
|
||||||
void initTimer();
|
|
||||||
|
|
||||||
// 状态转移表
|
// 状态转移表
|
||||||
// 守卫条件函数类型
|
// 守卫条件函数类型
|
||||||
using GuardFunc = std::function<bool()>;
|
using GuardFunc = std::function<bool()>;
|
||||||
@@ -129,7 +131,12 @@ private:
|
|||||||
// 检查是否满足所有打印条件
|
// 检查是否满足所有打印条件
|
||||||
bool guardCanStartPrint();
|
bool guardCanStartPrint();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTimer* m_updateUITimer = NULL; //更新按钮UI
|
||||||
|
QTimer* m_canReadyTimer = NULL; //回收槽到底后检查是否满足打印条件
|
||||||
|
void initTimer();
|
||||||
private slots:
|
private slots:
|
||||||
void slt_timeout();
|
void slt_timeoutUI();
|
||||||
|
void slt_timeoutReady();
|
||||||
};
|
};
|
||||||
#endif // PRINTERSTATEMANAGER_H
|
#endif // PRINTERSTATEMANAGER_H
|
||||||
|
|||||||
@@ -1115,7 +1115,7 @@ typedef struct{
|
|||||||
int viscosityFault;// 0 正常,1-粘度值高,2-粘度值低
|
int viscosityFault;// 0 正常,1-粘度值高,2-粘度值低
|
||||||
int lastViscosityFault; //用来记录上一次的粘度错误状态
|
int lastViscosityFault; //用来记录上一次的粘度错误状态
|
||||||
int lastStatWarn;
|
int lastStatWarn;
|
||||||
int lastPhaseFault;
|
int lastPhaseFault; //相位
|
||||||
int phaseErrorCnt;
|
int phaseErrorCnt;
|
||||||
|
|
||||||
/* Yang */
|
/* Yang */
|
||||||
|
|||||||
+6
-7
@@ -568,15 +568,14 @@ fi\n" ;
|
|||||||
void SystemManage::on_pushButtonUpdateSoftware_pressed()
|
void SystemManage::on_pushButtonUpdateSoftware_pressed()
|
||||||
{
|
{
|
||||||
if(sysPara->status.updateSoftEN==0){
|
if(sysPara->status.updateSoftEN==0){
|
||||||
QWidget *p = dialogUpateMm->parentWidget();
|
|
||||||
if (p) {
|
|
||||||
QPoint topLeft = p->mapToGlobal(QPoint(0, 0));
|
|
||||||
int x = topLeft.x() + (p->width() - dialogUpateMm->width()) / 2;
|
|
||||||
int y = topLeft.y() + (p->height() - dialogUpateMm->height()) / 2 - 100;
|
|
||||||
dialogUpateMm->move(x, y);
|
|
||||||
}
|
|
||||||
dialogUpateMm->clearAuth();
|
dialogUpateMm->clearAuth();
|
||||||
dialogUpateMm->show();
|
dialogUpateMm->show();
|
||||||
|
|
||||||
|
QPoint topLeft = this->mapToGlobal(QPoint(0, 0));
|
||||||
|
int x = topLeft.x() + (this->width() - dialogUpateMm->width()) / 2;
|
||||||
|
int y = topLeft.y() + (this->height() - dialogUpateMm->height()) / 2 - 200;
|
||||||
|
dialogUpateMm->move(x, y);
|
||||||
|
|
||||||
}
|
}
|
||||||
else ondialogAuthorizationAccepted();
|
else ondialogAuthorizationAccepted();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -498,6 +498,39 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnSaveAs">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QPushButton {
|
||||||
|
background: qlineargradient(x1: 0.5, y1: 0, x2: 0.5, y2: 1, stop: 0 #6F9CD6, stop: 1 #FFFFFF);
|
||||||
|
border: 1px solid #a0a0a0;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
min-width: 90px;
|
||||||
|
min-height: 50px;
|
||||||
|
}
|
||||||
|
QPushButton:hover {
|
||||||
|
background-color: #d0d0d0;
|
||||||
|
}
|
||||||
|
QPushButton:pressed {
|
||||||
|
background-color: #c0c0c0;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>另存为</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="image.qrc">
|
||||||
|
<normaloff>:/image/saveAs.png</normaloff>:/image/saveAs.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>62</width>
|
||||||
|
<height>62</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btnListConfig">
|
<widget class="QPushButton" name="btnListConfig">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
#define UP_PRINTER_MAJOR_VER 6
|
#define UP_PRINTER_MAJOR_VER 6
|
||||||
#define UP_PRINTER_MINOR_VER 9
|
#define UP_PRINTER_MINOR_VER 9
|
||||||
#define UP_PRINTER_RIVISION_VER 1
|
#define UP_PRINTER_RIVISION_VER 5
|
||||||
#define SUB_VERSION "_KOR"
|
#define SUB_VERSION "_KOR"
|
||||||
#ifdef __RFID_OLD
|
#ifdef __RFID_OLD
|
||||||
#define SUB_RFID "_RO"
|
#define SUB_RFID "_RO"
|
||||||
|
|||||||
+396
-361
File diff suppressed because it is too large
Load Diff
+396
-361
File diff suppressed because it is too large
Load Diff
@@ -149,5 +149,6 @@
|
|||||||
<file>image/up_white.png</file>
|
<file>image/up_white.png</file>
|
||||||
<file>image/RePipeClose.png</file>
|
<file>image/RePipeClose.png</file>
|
||||||
<file>image/RePipeOpen.png</file>
|
<file>image/RePipeOpen.png</file>
|
||||||
|
<file>image/saveAs.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
+116
-52
@@ -129,6 +129,8 @@ void MainWidget::init()
|
|||||||
airPushTimer = new QTimer(this);
|
airPushTimer = new QTimer(this);
|
||||||
connect(airPushTimer, SIGNAL(timeout()), this, SLOT(airPushingProcess()));
|
connect(airPushTimer, SIGNAL(timeout()), this, SLOT(airPushingProcess()));
|
||||||
|
|
||||||
|
m_pressureMonitor = new PressureMonitor();
|
||||||
|
|
||||||
timerPowerOff = new QTimer(this);
|
timerPowerOff = new QTimer(this);
|
||||||
connect(timerPowerOff,SIGNAL(timeout()),this,SLOT(sendPowerOffCmd()));
|
connect(timerPowerOff,SIGNAL(timeout()),this,SLOT(sendPowerOffCmd()));
|
||||||
|
|
||||||
@@ -144,6 +146,9 @@ void MainWidget::init()
|
|||||||
}
|
}
|
||||||
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);
|
connect(m_setNumDlg, &SetNumDlg::sig_clearCnt, this, &MainWidget::slt_clearCnt);
|
||||||
|
|
||||||
|
connect(m_setNumDlg, &SetNumDlg::sig_resetCNT1, this, &MainWidget::slt_resetCNT1);
|
||||||
|
connect(m_setNumDlg, &SetNumDlg::sig_resetCNT2, this, &MainWidget::slt_resetCNT2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::buttonClickedSlot()
|
void MainWidget::buttonClickedSlot()
|
||||||
@@ -185,7 +190,7 @@ void MySleep(unsigned int msec)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWidget::generatePrintContent(PicScene *scene)
|
bool MainWidget::generatePrintContent(PicScene *scene, const PrintSettingModel& printSettings)
|
||||||
{
|
{
|
||||||
if(!scene) {
|
if(!scene) {
|
||||||
qWarning() << "Scene is empty!";
|
qWarning() << "Scene is empty!";
|
||||||
@@ -200,7 +205,34 @@ bool MainWidget::generatePrintContent(PicScene *scene)
|
|||||||
this->pPicScene = scene;
|
this->pPicScene = scene;
|
||||||
onPreviewScene();
|
onPreviewScene();
|
||||||
|
|
||||||
|
this->printSettingsModel = printSettings;
|
||||||
|
PrintSettingModel::applyToSysPara(printSettings, sysPara);
|
||||||
|
|
||||||
SendPrintDataToFpga(0);
|
SendPrintDataToFpga(0);
|
||||||
|
|
||||||
|
|
||||||
|
// 检查场景内是否有计数器,根据是否有对应计数器,显示或禁用setNumDlg中对应的按钮。
|
||||||
|
bool hasCNT1 = false;
|
||||||
|
bool hasCNT2 = false;
|
||||||
|
auto items = pPicScene->items();
|
||||||
|
for(auto item : items) {
|
||||||
|
auto cntItem = dynamic_cast<PicCounterItem*>(item);
|
||||||
|
if(!cntItem)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(cntItem->counterType() == COUNTER_TYPE_1) {
|
||||||
|
hasCNT1 = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cntItem->counterType() == COUNTER_TYPE_2) {
|
||||||
|
hasCNT2 = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_setNumDlg->setCNTResetBtnsEnable(hasCNT1, hasCNT2);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1059,6 +1091,10 @@ void MainWidget::SendPrintDataToFpga(unsigned char alterEnable, bool isUpdate)
|
|||||||
|
|
||||||
void MainWidget::setReclaimOpenBtnStatus(bool enable)
|
void MainWidget::setReclaimOpenBtnStatus(bool enable)
|
||||||
{
|
{
|
||||||
|
if (airPushTimer && airPushTimer->isActive()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __RFID_CARD
|
#ifdef __RFID_CARD
|
||||||
if(sysPara->RFIDPara.inkCardTimeOut
|
if(sysPara->RFIDPara.inkCardTimeOut
|
||||||
|| sysPara->RFIDPara.solventCardTimeOut
|
|| sysPara->RFIDPara.solventCardTimeOut
|
||||||
@@ -1068,11 +1104,16 @@ void MainWidget::setReclaimOpenBtnStatus(bool enable)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
enable = !sysPara->status.airPushing && enable;
|
enable = !sysPara->status.airPushing && enable;
|
||||||
|
|
||||||
ui.m_RightBtn->setEnabled(enable);
|
ui.m_RightBtn->setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::setReclaimCloseBtnStatus(bool enable)
|
void MainWidget::setReclaimCloseBtnStatus(bool enable)
|
||||||
{
|
{
|
||||||
|
if (airPushTimer && airPushTimer->isActive()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
enable = !sysPara->status.airPushing && enable;
|
enable = !sysPara->status.airPushing && enable;
|
||||||
ui.m_LeftBtn->setEnabled(enable);
|
ui.m_LeftBtn->setEnabled(enable);
|
||||||
}
|
}
|
||||||
@@ -1104,7 +1145,7 @@ void MainWidget::stopFlashReclaimOpenBtn()
|
|||||||
flashReclaimOpenBtn();
|
flashReclaimOpenBtn();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::updateReclaimStatus()
|
void MainWidget::updateReclaimText()
|
||||||
{
|
{
|
||||||
QString strR = "";
|
QString strR = "";
|
||||||
QString strL = "";
|
QString strL = "";
|
||||||
@@ -1121,20 +1162,23 @@ void MainWidget::updateReclaimStatus()
|
|||||||
strR = tr("喷嘴已开启");
|
strR = tr("喷嘴已开启");
|
||||||
strL = tr("喷嘴关闭");
|
strL = tr("喷嘴关闭");
|
||||||
break;
|
break;
|
||||||
case 0:
|
|
||||||
case 6:
|
case 6:
|
||||||
strR = tr("喷嘴开启");
|
strR = tr("喷嘴开启");
|
||||||
strL = tr("喷嘴已关闭");
|
strL = tr("喷嘴已关闭");
|
||||||
break;
|
break;
|
||||||
|
case 0: // 后续运行中5和6状态之后会自动置为0,所以加额外逻辑
|
||||||
|
strR = ui.lb_RightBtn->text();
|
||||||
|
strL = ui.lb_LeftBtn->text();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (strR!="" && strL!="") {
|
||||||
ui.lb_RightBtn->setText(strR);
|
ui.lb_RightBtn->setText(strR);
|
||||||
ui.lb_LeftBtn->setText(strL);
|
ui.lb_LeftBtn->setText(strL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mainInkPumpCtrlStatus = 0;
|
|
||||||
static int mainInkPumpCtrlCnt = 0;
|
|
||||||
//100ms 为单位
|
//100ms 为单位
|
||||||
void MainWidget::airPushingProcess()
|
void MainWidget::airPushingProcess()
|
||||||
{
|
{
|
||||||
@@ -1153,17 +1197,6 @@ void MainWidget::airPushingProcess()
|
|||||||
sysPara->saveParaToFile();
|
sysPara->saveParaToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 延迟 0.5秒后才开回收槽,正式结束排气阶段
|
|
||||||
if(sysPara->status.airPushingOnTime >= sysPara->para.airPushDurationSec * 1000 + 500){
|
|
||||||
reclaimTanOpen();
|
|
||||||
sysPara->status.airPushingDone = 1;
|
|
||||||
sysPara->status.airPushing = 0;
|
|
||||||
sysPara->status.airPushingOnTime = 0;
|
|
||||||
airPushTimer->stop();
|
|
||||||
setRunStatus(tr("喷嘴开启中"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sysPara->status.airPushingOnTime >= sysPara->para.airPushDurationSec * 1000){
|
if(sysPara->status.airPushingOnTime >= sysPara->para.airPushDurationSec * 1000){
|
||||||
sysPara->devOp->controlViscosityPump(false);
|
sysPara->devOp->controlViscosityPump(false);
|
||||||
sysPara->devOp->controlCycleValve(false);
|
sysPara->devOp->controlCycleValve(false);
|
||||||
@@ -1171,7 +1204,42 @@ void MainWidget::airPushingProcess()
|
|||||||
if(!sysPara->devOp->isReclaimPumpOpen())
|
if(!sysPara->devOp->isReclaimPumpOpen())
|
||||||
sysPara->devOp->controlReclaimPump(true, false);
|
sysPara->devOp->controlReclaimPump(true, false);
|
||||||
|
|
||||||
sysPara->status.isPumpValveControledByHand = false;//切换自动让压力回升
|
// 切换回自动模式
|
||||||
|
sysPara->status.isPumpValveControledByHand = false;
|
||||||
|
|
||||||
|
setRunStatus(tr("等待压力稳定..."));
|
||||||
|
|
||||||
|
if(m_pressureMonitor->tick((float)sysPara->status.PRESSURE, (float)sysPara->para.pressure)) {
|
||||||
|
reclaimTanOpen();
|
||||||
|
sysPara->status.airPushingDone = 1;
|
||||||
|
sysPara->status.airPushing = 0;
|
||||||
|
sysPara->status.airPushingOnTime = 0;
|
||||||
|
airPushTimer->stop();
|
||||||
|
bool isTimeout = m_pressureMonitor->wasTimeout();
|
||||||
|
float bufCopy[12];
|
||||||
|
memcpy(bufCopy, m_pressureMonitor->buffer(), sizeof(bufCopy));
|
||||||
|
m_pressureMonitor->reset();
|
||||||
|
setRunStatus(tr("喷嘴开启中"));
|
||||||
|
|
||||||
|
LogInfo::setRunStatusText(isTimeout
|
||||||
|
? "Pressure unstable timeout, fallback open the reclaim tank."
|
||||||
|
: "Pressure has stabled, will open the reclaim tank.");
|
||||||
|
|
||||||
|
QString pressureSet = QString("Pressure buffer: [%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12]")
|
||||||
|
.arg(bufCopy[0], 0, 'f', 1)
|
||||||
|
.arg(bufCopy[1], 0, 'f', 1)
|
||||||
|
.arg(bufCopy[2], 0, 'f', 1)
|
||||||
|
.arg(bufCopy[3], 0, 'f', 1)
|
||||||
|
.arg(bufCopy[4], 0, 'f', 1)
|
||||||
|
.arg(bufCopy[5], 0, 'f', 1)
|
||||||
|
.arg(bufCopy[6], 0, 'f', 1)
|
||||||
|
.arg(bufCopy[7], 0, 'f', 1)
|
||||||
|
.arg(bufCopy[8], 0, 'f', 1)
|
||||||
|
.arg(bufCopy[9], 0, 'f', 1)
|
||||||
|
.arg(bufCopy[10], 0, 'f', 1)
|
||||||
|
.arg(bufCopy[11], 0, 'f', 1);
|
||||||
|
LogInfo::setRunStatusText(pressureSet);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1190,7 +1258,7 @@ void MainWidget::reclaimTanOpen()
|
|||||||
sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable());
|
sysPara->devOp->controlReclaimTankOpen(!sysPara->devOp->isReclaimTankOpenEnable());
|
||||||
sysPara->devOp->highVoltageCtrl(0); /*回收槽动作的时候务必关高压*/
|
sysPara->devOp->highVoltageCtrl(0); /*回收槽动作的时候务必关高压*/
|
||||||
sysPara->status.reclaimTankstatus = 1;
|
sysPara->status.reclaimTankstatus = 1;
|
||||||
updateReclaimStatus();
|
// updateReclaimStatus();
|
||||||
|
|
||||||
sysPara->status.currReclaimOperationCnt = 0;
|
sysPara->status.currReclaimOperationCnt = 0;
|
||||||
sysPara->status.reclainTankReachEnd = false;
|
sysPara->status.reclainTankReachEnd = false;
|
||||||
@@ -1341,6 +1409,15 @@ void MainWidget::on_m_RightBtn_clicked()
|
|||||||
sysPara->status.airPushingOnTime = 0;
|
sysPara->status.airPushingOnTime = 0;
|
||||||
|
|
||||||
airPushTimer->start(100); // 100ms
|
airPushTimer->start(100); // 100ms
|
||||||
|
m_pressureMonitor->reset();
|
||||||
|
|
||||||
|
// 喷嘴开启中
|
||||||
|
if (m_reclaimOpenBtnFlashTimer && !m_reclaimOpenBtnFlashTimer->isActive()){
|
||||||
|
ui.lb_RightBtn->setText(tr("正在排气..."));
|
||||||
|
m_reclaimFlashState = true;
|
||||||
|
m_reclaimOpenBtnFlashTimer->start();
|
||||||
|
LogInfo::setRunStatusText("m_reclaimOpenBtnFlashTimer start");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1358,13 +1435,7 @@ void MainWidget::on_m_RightBtn_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 喷嘴开启中
|
|
||||||
if (m_reclaimOpenBtnFlashTimer && !m_reclaimOpenBtnFlashTimer->isActive()){
|
|
||||||
ui.lb_RightBtn->setText(tr("正在排气..."));
|
|
||||||
m_reclaimFlashState = true;
|
|
||||||
m_reclaimOpenBtnFlashTimer->start();
|
|
||||||
LogInfo::setRunStatusText("m_reclaimOpenBtnFlashTimer start");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2054,25 +2125,22 @@ void MainWidget::updatePrintDisplayLabel()
|
|||||||
m_PrintDisplay->update();
|
m_PrintDisplay->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static short recycleWarnTimes = 0;
|
||||||
void MainWidget::RefreshStatusLight(){//100ms
|
void MainWidget::RefreshStatusLight(){//100ms
|
||||||
if(sysPara){
|
if(sysPara){
|
||||||
if(sysPara->status.lastStatWarn != sysPara->status.statWarn || flagOfClearHighVltageWarnning){
|
if(sysPara->status.lastStatWarn != sysPara->status.statWarn || flagOfClearHighVltageWarnning){
|
||||||
if(!(sysPara->status.statWarn & WARN_STATUS_INK_SWINT)){//墨线开关
|
if(!(sysPara->status.statWarn & WARN_STATUS_INK_SWINT)){//墨线开关
|
||||||
// ui->labelStatusInkSwint->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMGreen.PNG")));
|
|
||||||
alarmStatus.inkSwint = DEV_STATUS_GREEN;
|
alarmStatus.inkSwint = DEV_STATUS_GREEN;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// ui->labelStatusInkSwint->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMRed.PNG")));
|
|
||||||
alarmStatus.inkSwint = DEV_STATUS_RED;
|
alarmStatus.inkSwint = DEV_STATUS_RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!(sysPara->status.statWarn & WARN_STATUS_SUMP_WARN)){ //液位渗漏,高电平警告
|
if(!(sysPara->status.statWarn & WARN_STATUS_SUMP_WARN)){ //液位渗漏,高电平警告
|
||||||
// ui->labelStatusInkLeak->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMGreen.PNG")));
|
|
||||||
alarmStatus.inkLeak = DEV_STATUS_GREEN;
|
alarmStatus.inkLeak = DEV_STATUS_GREEN;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// ui->labelStatusInkLeak->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMRed.PNG")));
|
|
||||||
alarmStatus.inkLeak = DEV_STATUS_RED;
|
alarmStatus.inkLeak = DEV_STATUS_RED;
|
||||||
strTitle = tr("墨水缸满报警");
|
strTitle = tr("墨水缸满报警");
|
||||||
if(sysPara->devOp->isMixValveOpen()) {
|
if(sysPara->devOp->isMixValveOpen()) {
|
||||||
@@ -2080,69 +2148,56 @@ void MainWidget::RefreshStatusLight(){//100ms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!(sysPara->status.statWarn & WARN_STATUS_INK_WARN)){
|
if(!(sysPara->status.statWarn & WARN_STATUS_INK_WARN)){
|
||||||
// ui->labelStatusInkWaterLevel->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMGreen.PNG")));
|
|
||||||
alarmStatus.inkWaterLevel = DEV_STATUS_GREEN;
|
alarmStatus.inkWaterLevel = DEV_STATUS_GREEN;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// ui->labelStatusInkWaterLevel->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMRed.PNG")));
|
|
||||||
alarmStatus.inkWaterLevel = DEV_STATUS_RED;
|
alarmStatus.inkWaterLevel = DEV_STATUS_RED;
|
||||||
strTitle = tr("墨水液位报警");
|
strTitle = tr("墨水液位报警");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(!(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN)){
|
if(!(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN)){
|
||||||
// ui->labelStatusSolvLevelWarn->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMGreen.PNG")));
|
|
||||||
alarmStatus.solveLevelWarn = DEV_STATUS_GREEN;
|
alarmStatus.solveLevelWarn = DEV_STATUS_GREEN;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// ui->labelStatusSolvLevelWarn->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMRed.PNG")));
|
|
||||||
alarmStatus.solveLevelWarn = DEV_STATUS_RED;
|
alarmStatus.solveLevelWarn = DEV_STATUS_RED;
|
||||||
strTitle = tr("溶剂液位报警");
|
strTitle = tr("溶剂液位报警");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(sysPara->status.statWarn & WARN_STATUS_RECYCLE_FAULT) ){
|
if(!(sysPara->status.statWarn & WARN_STATUS_RECYCLE_FAULT) ){
|
||||||
// ui->labelStatusRecycleWarn->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMGreen.PNG")));
|
|
||||||
alarmStatus.recycleWarn = DEV_STATUS_GREEN;
|
alarmStatus.recycleWarn = DEV_STATUS_GREEN;
|
||||||
|
recycleWarnTimes = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// ui->labelStatusRecycleWarn->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMRed.PNG")));
|
// 实际使用中这个报警很容易触发,决定添加防抖
|
||||||
|
if (recycleWarnTimes++ > 30) {
|
||||||
alarmStatus.recycleWarn = DEV_STATUS_RED;
|
alarmStatus.recycleWarn = DEV_STATUS_RED;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//static int HVfaultCnt=0;
|
|
||||||
if(!(sysPara->status.statWarn & WARN_STATUS_POWER_MON)){
|
if(!(sysPara->status.statWarn & WARN_STATUS_POWER_MON)){
|
||||||
if(!sysPara->status.lastHighVoltageFault)
|
if(!sysPara->status.lastHighVoltageFault)
|
||||||
{
|
{
|
||||||
flagOfClearHighVltageWarnning = false;
|
flagOfClearHighVltageWarnning = false;
|
||||||
// ui->labelStatusHighVoltageFault->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMGreen.PNG")));
|
|
||||||
alarmStatus.highVoltageFault = DEV_STATUS_GREEN;
|
alarmStatus.highVoltageFault = DEV_STATUS_GREEN;
|
||||||
}
|
}
|
||||||
// HVfaultCnt=0;
|
|
||||||
//sysPara->status.HVFaultCloseEn=0;
|
//sysPara->status.HVFaultCloseEn=0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// ui->labelStatusHighVoltageFault->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMRed.PNG")));
|
|
||||||
alarmStatus.highVoltageFault = DEV_STATUS_RED;
|
alarmStatus.highVoltageFault = DEV_STATUS_RED;
|
||||||
if(sysPara->status.isPrinting){ //已经在打印,则暂停打印 2013-9-15高压报警停止充电
|
if(sysPara->status.isPrinting){ //已经在打印,则暂停打印 2013-9-15高压报警停止充电
|
||||||
on_m_StopBtn_clicked();
|
on_m_StopBtn_clicked();
|
||||||
LogInfo::setRunStatusText(tr("高压故障,暂停打印"));
|
LogInfo::setRunStatusText(tr("高压故障,暂停打印"));
|
||||||
setRunStatus(tr("高压故障,暂停打印"));
|
setRunStatus(tr("高压故障,暂停打印"));
|
||||||
|
|
||||||
strTitle = tr("高压故障,暂停打印.");
|
strTitle = tr("高压故障,暂停打印.");
|
||||||
|
|
||||||
sysPara->status.lastHighVoltageFault = true;
|
sysPara->status.lastHighVoltageFault = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((sysPara->status.currReclaimTankPos != 0) && sysPara->para.HVFaultCloseEn )
|
if((sysPara->status.currReclaimTankPos != 0) && sysPara->para.HVFaultCloseEn )
|
||||||
{
|
{
|
||||||
//HVfaultCnt++;
|
|
||||||
// 高压故障关回收槽
|
// 高压故障关回收槽
|
||||||
if(sysPara->status.HVFaultCloseEn==0){
|
if(sysPara->status.HVFaultCloseEn==0){
|
||||||
sysPara->status.reclaimTankBlockedAppending=0;
|
sysPara->status.reclaimTankBlockedAppending=0;
|
||||||
sysPara->status.reclaimCloseCnt=100;
|
sysPara->status.reclaimCloseCnt=100;
|
||||||
// on_pushButtonReclaimTankClose_pressed();
|
|
||||||
on_m_LeftBtn_clicked();
|
on_m_LeftBtn_clicked();
|
||||||
sysPara->status.reclaimTankBlockedAppending=1;
|
sysPara->status.reclaimTankBlockedAppending=1;
|
||||||
LogInfo::setRunStatusText(tr("高压故障,关回收槽"));
|
LogInfo::setRunStatusText(tr("高压故障,关回收槽"));
|
||||||
@@ -2158,17 +2213,14 @@ void MainWidget::RefreshStatusLight(){//100ms
|
|||||||
sysPara->status.lastStatWarn = sysPara->status.statWarn;
|
sysPara->status.lastStatWarn = sysPara->status.statWarn;
|
||||||
if(sysPara->status.lastViscosityFault != sysPara->status.viscosityFault){
|
if(sysPara->status.lastViscosityFault != sysPara->status.viscosityFault){
|
||||||
if(sysPara->status.viscosityFault==0){
|
if(sysPara->status.viscosityFault==0){
|
||||||
// ui->labelStatusViscosityWarn->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMGreen.PNG")));
|
|
||||||
alarmStatus.viscosityWarn = DEV_STATUS_GREEN;
|
alarmStatus.viscosityWarn = DEV_STATUS_GREEN;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(sysPara->status.viscosityFault==1){
|
if(sysPara->status.viscosityFault==1){
|
||||||
|
|
||||||
// ui->labelStatusViscosityWarn->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMRed.PNG")));
|
|
||||||
alarmStatus.viscosityWarn = DEV_STATUS_RED;
|
alarmStatus.viscosityWarn = DEV_STATUS_RED;
|
||||||
}
|
}
|
||||||
else if(sysPara->status.viscosityFault==2) {
|
else if(sysPara->status.viscosityFault==2) {
|
||||||
// ui->labelStatusViscosityWarn->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMYellow.PNG")));
|
|
||||||
alarmStatus.viscosityWarn = DEV_STATUS_YELLOW;
|
alarmStatus.viscosityWarn = DEV_STATUS_YELLOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2178,7 +2230,6 @@ void MainWidget::RefreshStatusLight(){//100ms
|
|||||||
if(!(sysPara->status.statWarn & WARN_STATUS_RECYCLE_FAULT)){ //20140211 nie
|
if(!(sysPara->status.statWarn & WARN_STATUS_RECYCLE_FAULT)){ //20140211 nie
|
||||||
if(sysPara->status.RecycleWarnCnt)
|
if(sysPara->status.RecycleWarnCnt)
|
||||||
alarmStatus.recycleWarn = DEV_STATUS_GREEN;
|
alarmStatus.recycleWarn = DEV_STATUS_GREEN;
|
||||||
// ui->labelStatusRecycleWarn->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMGreen.PNG")));
|
|
||||||
sysPara->status.RecycleWarnCnt = 0;
|
sysPara->status.RecycleWarnCnt = 0;
|
||||||
sysPara->status.lastRecycleWarn = 0;
|
sysPara->status.lastRecycleWarn = 0;
|
||||||
}
|
}
|
||||||
@@ -2189,7 +2240,6 @@ void MainWidget::RefreshStatusLight(){//100ms
|
|||||||
{
|
{
|
||||||
sysPara->status.lastRecycleWarn = RECYCLE_WARN_DELAY;//5s
|
sysPara->status.lastRecycleWarn = RECYCLE_WARN_DELAY;//5s
|
||||||
alarmStatus.recycleWarn = DEV_STATUS_RED;
|
alarmStatus.recycleWarn = DEV_STATUS_RED;
|
||||||
// ui->labelStatusRecycleWarn->setPixmap(QPixmap(QString::fromUtf8(":/image/ALARMRed.PNG")));
|
|
||||||
sysPara->status.reclaimCloseCnt=100;
|
sysPara->status.reclaimCloseCnt=100;
|
||||||
if(sysPara->para.RecycleWarnAction)
|
if(sysPara->para.RecycleWarnAction)
|
||||||
{
|
{
|
||||||
@@ -2244,7 +2294,7 @@ bool MainWidget::updatePhaseIndicatorLight(){
|
|||||||
if(sysPara==0) return 0;
|
if(sysPara==0) return 0;
|
||||||
|
|
||||||
/*------------------------------------------喷头盖未关或回收槽未全部打开的时候不报相位故障-------------------------------------------------*/
|
/*------------------------------------------喷头盖未关或回收槽未全部打开的时候不报相位故障-------------------------------------------------*/
|
||||||
if((!sysPara->status.flight_tm_error && !sysPara->status.detect_phase_error) || (sysPara->status.statWarn & WARN_STATUS_HDINT) || !sysPara->status.reclainTankReachEnd){
|
if((!sysPara->status.flight_tm_error && !sysPara->status.detect_phase_error) || !sysPara->status.reclainTankReachEnd){
|
||||||
//故障后必须等手动按故障恢复才会继续
|
//故障后必须等手动按故障恢复才会继续
|
||||||
if(!sysPara->para.suspendAfterPhaseFault && !sysPara->para.powerOffAfterPhaseFault){
|
if(!sysPara->para.suspendAfterPhaseFault && !sysPara->para.powerOffAfterPhaseFault){
|
||||||
if(sysPara->status.lastPhaseFault){
|
if(sysPara->status.lastPhaseFault){
|
||||||
@@ -2522,6 +2572,20 @@ void MainWidget::onLabelFaultRusumePressed(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWidget::slt_resetCNT1()
|
||||||
|
{
|
||||||
|
sysPara->para.cnt1CurrValue = printSettingsModel.cnt1Settings.currValue;
|
||||||
|
sysPara->para.cnt2CurrValue = QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue,16).toInt();
|
||||||
|
sysPara->devOp->writeFpgaCalandar(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWidget::slt_resetCNT2()
|
||||||
|
{
|
||||||
|
sysPara->para.cnt1CurrValue = QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue,16).toInt();
|
||||||
|
sysPara->para.cnt2CurrValue = printSettingsModel.cnt2Settings.currValue;
|
||||||
|
sysPara->devOp->writeFpgaCalandar(false);
|
||||||
|
}
|
||||||
|
|
||||||
extern int baudRateValue;
|
extern int baudRateValue;
|
||||||
void MainWidget::UpdateUIVersion(){
|
void MainWidget::UpdateUIVersion(){
|
||||||
int fpgaType = sysPara->status.fpgaVersionNum>>12;
|
int fpgaType = sysPara->status.fpgaVersionNum>>12;
|
||||||
|
|||||||
+10
-3
@@ -29,6 +29,8 @@
|
|||||||
#include "fileManage/FileManageWidget.h"
|
#include "fileManage/FileManageWidget.h"
|
||||||
|
|
||||||
#include "setnumdlg.h"
|
#include "setnumdlg.h"
|
||||||
|
#include "PrintSetting.h"
|
||||||
|
#include "PressureMonitor.h"
|
||||||
|
|
||||||
class MainWidget : public QWidget
|
class MainWidget : public QWidget
|
||||||
{
|
{
|
||||||
@@ -45,9 +47,10 @@ public:
|
|||||||
* @brief 生成打印内容,并发送打印内容到 FPGA
|
* @brief 生成打印内容,并发送打印内容到 FPGA
|
||||||
*
|
*
|
||||||
* @param pPicScene 包含打印内容的场景
|
* @param pPicScene 包含打印内容的场景
|
||||||
|
* @param printSettings 打印内容所需要的打印设置
|
||||||
* @return 成功返回true,否则false,查看日志
|
* @return 成功返回true,否则false,查看日志
|
||||||
*/
|
*/
|
||||||
bool generatePrintContent(PicScene* pPicScene);
|
bool generatePrintContent(PicScene* pPicScene, const PrintSettingModel& printSettings);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 重新生成打印内容,所用场景是由调用 generatePrintContent 时设置的,generatePrintContent 也会调用此函数
|
* @brief 重新生成打印内容,所用场景是由调用 generatePrintContent 时设置的,generatePrintContent 也会调用此函数
|
||||||
@@ -107,7 +110,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief 设置回收槽开关状态
|
* @brief 设置回收槽开关状态
|
||||||
*/
|
*/
|
||||||
void updateReclaimStatus();
|
void updateReclaimText();
|
||||||
|
|
||||||
void updateSysStatusToUI(); //重载
|
void updateSysStatusToUI(); //重载
|
||||||
//Mainwindow获取机器总状态
|
//Mainwindow获取机器总状态
|
||||||
@@ -160,8 +163,11 @@ private:
|
|||||||
int r_ExpiryDay;
|
int r_ExpiryDay;
|
||||||
QTimer *airPushTimer;
|
QTimer *airPushTimer;
|
||||||
|
|
||||||
|
PressureMonitor *m_pressureMonitor = nullptr;
|
||||||
|
|
||||||
PicScene *pPicScene = nullptr;
|
PicScene *pPicScene = nullptr;
|
||||||
QGraphicsView *view;
|
QGraphicsView *view;
|
||||||
|
PrintSettingModel printSettingsModel;
|
||||||
|
|
||||||
FileManageWidget *m_fileManageWidget = nullptr;
|
FileManageWidget *m_fileManageWidget = nullptr;
|
||||||
|
|
||||||
@@ -189,7 +195,8 @@ public slots:
|
|||||||
void _on_pushButtonPowerOff_pressed(bool notice);
|
void _on_pushButtonPowerOff_pressed(bool notice);
|
||||||
|
|
||||||
void onLabelFaultRusumePressed();
|
void onLabelFaultRusumePressed();
|
||||||
|
void slt_resetCNT1();
|
||||||
|
void slt_resetCNT2();
|
||||||
void UpdateUIVersion();
|
void UpdateUIVersion();
|
||||||
|
|
||||||
void on_m_RightBtn_clicked();
|
void on_m_RightBtn_clicked();
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ SetNumDlg::SetNumDlg(QWidget *parent) :
|
|||||||
|
|
||||||
ui->btn_confirm->setAutoDefault(false); // 禁止回车自动触发
|
ui->btn_confirm->setAutoDefault(false); // 禁止回车自动触发
|
||||||
ui->btn_confirm->setDefault(false); // 彻底取消默认按钮
|
ui->btn_confirm->setDefault(false); // 彻底取消默认按钮
|
||||||
|
|
||||||
|
connect(ui->btn_resetCnt1, &QPushButton::clicked, this, &SetNumDlg::sig_resetCNT1);
|
||||||
|
connect(ui->btn_resetCnt2, &QPushButton::clicked, this, &SetNumDlg::sig_resetCNT2);
|
||||||
|
|
||||||
|
// 默认禁用 重置计数器1 重置计数器2 的按钮
|
||||||
|
setCNTResetBtnsEnable(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetNumDlg::~SetNumDlg()
|
SetNumDlg::~SetNumDlg()
|
||||||
@@ -40,6 +46,12 @@ void SetNumDlg::on_btn_confirm_clicked()
|
|||||||
emit sig_setNum();
|
emit sig_setNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetNumDlg::setCNTResetBtnsEnable(bool cnt1Btn, bool cnt2Btn)
|
||||||
|
{
|
||||||
|
ui->btn_resetCnt1->setEnabled(cnt1Btn);
|
||||||
|
ui->btn_resetCnt2->setEnabled(cnt2Btn);
|
||||||
|
}
|
||||||
|
|
||||||
void SetNumDlg::on_btn_clearProductCnt_clicked()
|
void SetNumDlg::on_btn_clearProductCnt_clicked()
|
||||||
{
|
{
|
||||||
emit sig_clearCnt();
|
emit sig_clearCnt();
|
||||||
|
|||||||
+12
@@ -19,6 +19,14 @@ public:
|
|||||||
|
|
||||||
int getNum();
|
int getNum();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 设置对话框中,重置计数器1/2 的两个按钮的可用性
|
||||||
|
*
|
||||||
|
* @param cnt1Btn 重置计数器1 按钮的可用性
|
||||||
|
* @param cnt2Btn 重置计数器2 按钮的可用性
|
||||||
|
*/
|
||||||
|
void setCNTResetBtnsEnable(bool cnt1Btn, bool cnt2Btn);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_btn_confirm_clicked();
|
void on_btn_confirm_clicked();
|
||||||
|
|
||||||
@@ -34,6 +42,10 @@ signals:
|
|||||||
void sig_setNum();
|
void sig_setNum();
|
||||||
|
|
||||||
void sig_clearCnt();
|
void sig_clearCnt();
|
||||||
|
|
||||||
|
void sig_resetCNT1();
|
||||||
|
|
||||||
|
void sig_resetCNT2();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETNUMDLG_H
|
#endif // SETNUMDLG_H
|
||||||
|
|||||||
+27
-1
@@ -87,7 +87,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
<y>160</y>
|
<y>130</y>
|
||||||
<width>111</width>
|
<width>111</width>
|
||||||
<height>61</height>
|
<height>61</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -96,6 +96,32 @@
|
|||||||
<string>清空产品计数</string>
|
<string>清空产品计数</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QPushButton" name="btn_resetCnt1">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>131</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>重置计数器1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="btn_resetCnt2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>160</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>131</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>重置计数器2</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>cb_setNum</tabstop>
|
<tabstop>cb_setNum</tabstop>
|
||||||
|
|||||||
+396
-361
File diff suppressed because it is too large
Load Diff
@@ -201,6 +201,8 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
|||||||
|
|
||||||
// 网络通信,暂时屏蔽
|
// 网络通信,暂时屏蔽
|
||||||
// ui.btnList->hide();
|
// ui.btnList->hide();
|
||||||
|
|
||||||
|
connect(ui.btnSaveAs, &QPushButton::clicked, this, &TestPrintWidget::onBtnSaveAsClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPrintWidget::bindSysPara(SysPara *sysPara)
|
void TestPrintWidget::bindSysPara(SysPara *sysPara)
|
||||||
@@ -1159,3 +1161,18 @@ void TestPrintWidget::on_btn_paste_clicked()
|
|||||||
{
|
{
|
||||||
pasteCopiedLayer();
|
pasteCopiedLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestPrintWidget::onBtnSaveAsClicked()
|
||||||
|
{
|
||||||
|
dialogSaveFile->refreshListView(SCENE);
|
||||||
|
dialogSaveFile->setEnterFileName("");
|
||||||
|
auto ret = dialogSaveFile->exec();
|
||||||
|
|
||||||
|
if(ret == QDialog::Accepted) {
|
||||||
|
auto filename = dialogSaveFile->filename();
|
||||||
|
if(!filename.endsWith(".xml",Qt::CaseInsensitive))
|
||||||
|
filename += ".xml";
|
||||||
|
|
||||||
|
saveFile(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -108,6 +108,8 @@ private slots:
|
|||||||
// 粘贴
|
// 粘贴
|
||||||
void on_btn_paste_clicked();
|
void on_btn_paste_clicked();
|
||||||
|
|
||||||
|
void onBtnSaveAsClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// UI对象
|
// UI对象
|
||||||
Ui::TestPrintWidget ui;
|
Ui::TestPrintWidget ui;
|
||||||
|
|||||||
Reference in New Issue
Block a user