2025-08-20 23:06:28 +08:00
|
|
|
|
#include "P09_RemotePage.h"
|
|
|
|
|
|
#include "ui_P09_RemotePage.h"
|
2025-09-15 22:28:43 +08:00
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
#include <GlobalDefinitions/Variable.h>
|
|
|
|
|
|
#include <PublicFunctions/BitMaps.h>
|
|
|
|
|
|
#include <PublicFunctions/Basic.h>
|
2025-08-20 23:06:28 +08:00
|
|
|
|
P09_RemotePage::P09_RemotePage(QWidget *parent) :
|
|
|
|
|
|
QWidget(parent),
|
|
|
|
|
|
ui(new Ui::P09_RemotePage)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->setupUi(this);
|
2025-10-10 17:44:10 +08:00
|
|
|
|
QTimer::singleShot(10, this, &P09_RemotePage::WinInit);
|
2025-08-20 23:06:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
P09_RemotePage::~P09_RemotePage()
|
|
|
|
|
|
{
|
|
|
|
|
|
delete ui;
|
|
|
|
|
|
}
|
2025-09-15 22:28:43 +08:00
|
|
|
|
void P09_RemotePage::WinInit()
|
|
|
|
|
|
{
|
|
|
|
|
|
//所用定时器初始化
|
|
|
|
|
|
QTimer* UIRefresh_Timer = new QTimer(this);
|
|
|
|
|
|
connect(UIRefresh_Timer, &QTimer::timeout, this, &P09_RemotePage::UIRefreshTimeOut);
|
|
|
|
|
|
UIRefresh_Timer->setInterval(100); // 设置定时器间隔为 1000 毫秒(1 秒)
|
|
|
|
|
|
UIRefresh_Timer->start();
|
|
|
|
|
|
}
|
|
|
|
|
|
qreal readCurrent(QString Dev){
|
|
|
|
|
|
qreal CurrU = gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_Phase"+Dev+".Filtered30_U"] .toReal();
|
|
|
|
|
|
qreal CurrV = gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_Phase"+Dev+".Filtered30_V"] .toReal();
|
|
|
|
|
|
qreal CurrW = gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_Phase"+Dev+".Filtered30_W"] .toReal();
|
|
|
|
|
|
return fmax(CurrU,fmax(CurrV,CurrW));
|
|
|
|
|
|
}
|
|
|
|
|
|
void P09_RemotePage::UIRefreshTimeOut()
|
|
|
|
|
|
{
|
2025-10-10 17:44:10 +08:00
|
|
|
|
if(gPageIndexStr != "P09")
|
2025-09-15 22:28:43 +08:00
|
|
|
|
return;
|
|
|
|
|
|
QString StyleSheetSet;
|
|
|
|
|
|
uint32_t DK1 = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageContol.RemoteDKey1"] .toUInt();
|
|
|
|
|
|
uint32_t DK2 = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageContol.RemoteDKey2"] .toUInt();
|
|
|
|
|
|
uint32_t AK1 = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageContol.RemoteAKey1"] .toUInt();
|
|
|
|
|
|
uint32_t AK2 = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageContol.RemoteAKey2"] .toUInt();
|
|
|
|
|
|
|
2025-10-10 23:10:21 +08:00
|
|
|
|
// 牵引速度
|
|
|
|
|
|
ui->Slider_Haul_L->setValue(extractUInt32_8BitPart(AK1,0));
|
|
|
|
|
|
ui->Slider_Haul_R->setValue(extractUInt32_8BitPart(AK1,1));
|
|
|
|
|
|
// 右侧摇杆
|
|
|
|
|
|
uint16_t dX = map(extractUInt32_8BitPart(AK1,2) + 256,0,512.,0,140)- ui->Label_TransportPos->width()/2;
|
|
|
|
|
|
uint16_t dY = map(extractUInt32_8BitPart(AK1,3) + 256,0,512.,0,140)- ui->Label_TransportPos->height()/2;
|
|
|
|
|
|
ui->Label_TransportPos->move(dX,dY);
|
2025-09-15 22:28:43 +08:00
|
|
|
|
|
2025-10-10 23:10:21 +08:00
|
|
|
|
// 通用模拟量
|
|
|
|
|
|
ui->Label_DB_10-> setStyleSheet("border-image: url("+BitMaps().SwitchBut(extractUInt32_8BitPart(AK2,0)<127,extractUInt32_8BitPart(AK2,0)>127)+");");
|
|
|
|
|
|
ui->Label_DialBut_14-> setStyleSheet("border-image: url("+BitMaps().DialBut(extractUInt32_8BitPart(AK2,1)<127,extractUInt32_8BitPart(AK2,1)>127,0)+");");
|
|
|
|
|
|
ui->Label_DB_1-> setStyleSheet("border-image: url("+BitMaps().DiBut(extractUInt32_8BitPart(AK2,2)>127)+");");
|
|
|
|
|
|
ui->Label_DB_10-> setStyleSheet("border-image: url("+BitMaps().DiBut(extractUInt32_8BitPart(AK2,4)>127)+");");
|
2025-09-15 22:28:43 +08:00
|
|
|
|
|
2025-10-10 23:10:21 +08:00
|
|
|
|
// 急停 复位 启动
|
|
|
|
|
|
ui->Label_DB_5-> setStyleSheet("border-image: url("+BitMaps().DiBut(!(getBitOf32Data(DK1,0) && getBitOf32Data(DK1,31)))+");");
|
|
|
|
|
|
ui->Label_DB_2-> setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK1,1,0))+");");
|
|
|
|
|
|
ui->Label_DB_4-> setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK1,30,0))+");");
|
|
|
|
|
|
// 设备启停
|
|
|
|
|
|
ui->Label_DB_6-> setStyleSheet("border-image: url("+BitMaps().SwitchBut(getBitOf32Data(DK1,2),getBitOf32Data(DK1,3))+");");
|
|
|
|
|
|
ui->Label_DB_8-> setStyleSheet("border-image: url("+BitMaps().SwitchBut(getBitOf32Data(DK1,4),getBitOf32Data(DK1,5))+");");
|
|
|
|
|
|
ui->Label_DB_7-> setStyleSheet("border-image: url("+BitMaps().SwitchBut(getBitOf32Data(DK1,6),getBitOf32Data(DK1,7))+");");
|
|
|
|
|
|
ui->Label_DB_9-> setStyleSheet("border-image: url("+BitMaps().SwitchBut(getBitOf32Data(DK1,8),getBitOf32Data(DK1,9))+");");
|
|
|
|
|
|
// 高低速
|
|
|
|
|
|
ui->Label_DB_11-> setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK1,10,0))+");");
|
2025-09-15 22:28:43 +08:00
|
|
|
|
|
2025-10-10 23:10:21 +08:00
|
|
|
|
// 铲板液压
|
|
|
|
|
|
ui->Label_DialBut_5->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,11),getBitOf32Data(DK1,12),0)+");");
|
|
|
|
|
|
ui->Label_DialBut_6->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,13),getBitOf32Data(DK1,14),0)+");");
|
|
|
|
|
|
// 运输液压
|
|
|
|
|
|
ui->Label_DialBut_7->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,15),getBitOf32Data(DK1,16),0)+");");
|
|
|
|
|
|
ui->Label_DialBut_8->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,17),getBitOf32Data(DK1,18),0)+");");
|
|
|
|
|
|
// 临时支护液压
|
|
|
|
|
|
ui->Label_DialBut_9->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,19),getBitOf32Data(DK1,20),0)+");");
|
|
|
|
|
|
ui->Label_DialBut_10->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,21),getBitOf32Data(DK1,22),0)+");");
|
|
|
|
|
|
// 后支撑液压
|
|
|
|
|
|
ui->Label_DialBut_11->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,23),getBitOf32Data(DK1,24),0)+");");
|
|
|
|
|
|
ui->Label_DialBut_12->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,25),getBitOf32Data(DK1,26),0)+");");
|
2025-09-15 22:28:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui->LCD_RemoteCur_1->display(readCurrent("Pump"));
|
|
|
|
|
|
ui->LCD_RemoteCur_2->display(readCurrent("Cut"));
|
|
|
|
|
|
ui->LCD_RemoteCur_3->display(readCurrent("LoaderL"));
|
|
|
|
|
|
ui->LCD_RemoteCur_4->display(readCurrent("LoaderR"));
|
|
|
|
|
|
ui->LCD_RemoteCur_5->display(readCurrent("TransportL"));
|
|
|
|
|
|
ui->LCD_RemoteCur_6->display(readCurrent("TransportR"));
|
|
|
|
|
|
}
|