209 lines
6.0 KiB
C++
209 lines
6.0 KiB
C++
/*
|
|
*
|
|
*
|
|
* DIFF_SEPTAL_POSITION 隔膜位置由20改为50的主泵动作时间
|
|
*/
|
|
#ifndef INKJETPRINTER_H
|
|
#define INKJETPRINTER_H
|
|
|
|
#define SPEEDOVER //超速停止
|
|
|
|
|
|
#include <QTabWidget>
|
|
#include <QTimer>
|
|
#include <QTime>
|
|
#include "Tftp/filetranseceiver.h"
|
|
#include "ParaSettingUI.h"
|
|
#include "modbus/modbustcp.h"
|
|
#include <QCloseEvent>
|
|
#include "dlgshowmsg.h"
|
|
#include <QThread>
|
|
#include <QMessageBox>
|
|
#include "Serial/serial.h"
|
|
#include <cstring>
|
|
#include <iostream>
|
|
#include "Public.h"
|
|
#include "rfid/rfidmanager.h"
|
|
namespace Ui {
|
|
class InkJetPrinter;
|
|
}
|
|
|
|
|
|
#define MAX_PRESSURE_RELEASE_DIFF 25
|
|
#define MAX_PRESSURE_DIFF 50
|
|
#define MAX_VISICOSITY_RATIO 110 //105%
|
|
#define DIFF_SEPTAL_POSITION 50
|
|
#define MAX_VISICOSITY_VALUE_OVERFLOW_NUM 3 //连续超过此值会进行粘度调整
|
|
#define MAX_ALLOW_VISICOSITY_OVERFLOW_NUM 120 //连续超那么多次,会被认为粘度故障
|
|
|
|
class PicScene;
|
|
class DlgVoltePara25Dots;
|
|
class DlgVolteParaNo73;
|
|
|
|
class InkJetPrinter : public QTabWidget,public ParaSettingUI
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit InkJetPrinter(QWidget *parent = 0);
|
|
~InkJetPrinter();
|
|
void pressureAdj();
|
|
FileTranseceiver* fileTransceiv;
|
|
FileTranseceiver* tcpTransceiv;
|
|
Serial *serialFPGA;
|
|
Serial *serialSTM32;
|
|
QThread* m_serialThreadFPGA;
|
|
QThread* m_serialThreadSTM32;
|
|
bool flagOfSerialThreadStratEn;
|
|
// void processCommands();
|
|
#ifdef MODBUS
|
|
// class ModbusSerial *modbus;
|
|
class ModbusTcp *modbus;
|
|
QThread *m_thread;
|
|
#endif
|
|
|
|
public slots:
|
|
void onchangeEditMode(int);
|
|
void onChangeTab(QString);
|
|
void onPrintErrorStatus(QString s, unsigned int res);
|
|
void closeSerialFPGA();
|
|
void closeSerialSTM32();
|
|
void close_jd_timer();
|
|
void handlePushButtonStartPressed(bool);
|
|
void handleInitedPID();
|
|
void saveFPGAStatus(unsigned char *data);
|
|
void saveFPGAPhaseDetectHighTm(unsigned char *data);
|
|
void saveFPGAVersionNum(unsigned int);
|
|
void saveGearPumpVal(unsigned char *data);
|
|
void saveSTM32Status(unsigned char *data);
|
|
void savePulseCntVal(unsigned char *data);
|
|
void saveFPGACalandarAndDat(unsigned char *data);
|
|
void saveFPGACnt3CurrValue(unsigned char *data);
|
|
void saveFPGAXXXDay(unsigned char *data);
|
|
void saveSTM32Version(unsigned char *data);
|
|
void saveSTM32Time(unsigned char *data);
|
|
void onModbusWriteCalendar();
|
|
|
|
void stopSendFPGAData(bool);
|
|
void stopSendSTM32Data(bool);
|
|
void closedSerial();
|
|
void restartSerialPort();
|
|
|
|
void resetPressureCnt();
|
|
void pressureAdjustForsystemseeting();
|
|
|
|
private:
|
|
Ui::InkJetPrinter *ui;
|
|
DlgShowMsg *dlgShowMsg;
|
|
DlgVoltePara25Dots *voltePara25DotsDlg;
|
|
DlgVolteParaNo73 *no73VolteParaDlg;
|
|
//MainWindow *mainWindow;
|
|
QTimer* viscosity_timer;
|
|
QTimer* timer;
|
|
QTime t1;
|
|
|
|
// 隔膜泵状态枚举
|
|
enum DiaphragmPumpState {
|
|
DPUMP_STOPPED = 0, // 停止状态
|
|
DPUMP_STARTING = 1, // 启动爬升状态
|
|
DPUMP_RUNNING = 2 // 运行微调状态
|
|
};
|
|
|
|
// 隔膜泵控制参数
|
|
DiaphragmPumpState m_pumpState = DPUMP_STOPPED; // 泵当前状态
|
|
int m_stateChangeCount = 0; // 状态切换计数器(用于实现800ms间隔)
|
|
int m_adjSkip = 0; // 调节跳过计数器
|
|
int m_lastActualPressure = 0; // 上次实时压力(微分项用)
|
|
int m_startingStepCount = 0; // 启动步进计数器
|
|
int m_pressureBuf[10] = {}; // 压力滑动平均缓冲(10点=1s)
|
|
int m_bufIdx = 0; // 滑动平均写入索引
|
|
int m_bufValidCount = 0; // 缓冲区有效点数(用于启动阶段判断)
|
|
bool m_lastReclaimMode = false; // 上次回收泵使能状态
|
|
bool m_lastByHand = false; // 上次手动控制状态
|
|
bool m_powerOffPressureControlActive = false; // 关机压力控制已初始化
|
|
|
|
// 隔膜泵控制函数
|
|
float calculateTargetSpeed(int err);
|
|
void handleStoppedState(int err, bool canSwitch);
|
|
void handleStartingState(int err, int actual, int target);
|
|
void handleRunningState(int err, bool canSwitch);
|
|
|
|
void autoControlHeater();
|
|
void autoControlValvePump();
|
|
void detectAndcontrolReclaimTank();
|
|
void refreshModbusStatus(void);
|
|
void checkPressureControl();
|
|
void showMessage(QString);
|
|
|
|
#ifdef __RFID_CARD
|
|
RFIDManager* manager_rfid = nullptr;
|
|
void initRFIDManager();
|
|
#endif
|
|
|
|
Q_SIGNALS:
|
|
|
|
// void updateQRcode();
|
|
// void startPrint();
|
|
// void pausePrint();
|
|
// void stopPrint();
|
|
void showMotorIsen(int,int);
|
|
void showReclaimTankstatus(unsigned char);
|
|
|
|
void setReclaimTankCurrentPos(int);
|
|
void reclaimTankOpenDone();
|
|
void reclaimTankCloseDone();
|
|
void reclaimTankBlock(); //回收槽卡住
|
|
//void changeEditMode(int);
|
|
void SpeedOver(int mode);
|
|
void updateCnt1GroupDisp(bool);
|
|
|
|
void sig_updateDisp(bool);
|
|
|
|
void updataPara2UI();
|
|
void sendPicScene(PicScene* pPicScene);
|
|
void openFile(QString filePath,bool insertFlag);
|
|
|
|
private slots:
|
|
void OnSpeedOver(int mode);
|
|
|
|
void timerHandler();
|
|
void onInkJetPrinterCurrentChanged(int index);
|
|
void onReclaimTankBlock();
|
|
void onAuthChanged(int auth);
|
|
void onConfigChanged();
|
|
void OnFinished(int event);
|
|
void OnBoxFinished(int event);
|
|
void DacAdjustStore();
|
|
void recievedFile2Save(QString fileName);
|
|
void viscosity_timerHandler();
|
|
void disableTabClick();
|
|
void enableInkJetTabClick(bool);
|
|
void sendDataManual(QString,QString,QString,QString,QString);
|
|
|
|
void slt_showMsg(QString msg);
|
|
private:
|
|
|
|
QLabel *t_label;
|
|
QMessageBox *msgtest,*msgBox1;
|
|
void closeEvent(QCloseEvent *event);
|
|
void resizeEvent(QResizeEvent *);
|
|
void checkMixValveOpen();
|
|
void checkMixValveClose();
|
|
void cycleValveRunForSelfCheck();
|
|
void cnt1GroupCheck(void);
|
|
void cntGroupCheck();
|
|
|
|
void autoControlCycleValve();
|
|
|
|
void loadVoltageValue();
|
|
bool pushButtonStartFlag;
|
|
|
|
unsigned char rWarnViscoReady;
|
|
|
|
void initCntGroup();
|
|
public:
|
|
bool eventFilter(QObject *watched, QEvent *event);
|
|
};
|
|
|
|
#endif // INKJETPRINTER_H
|