Files
EJM_Display/Pages/P09_RemotePage.cpp

90 lines
5.1 KiB
C++
Raw Normal View History

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-09-15 22:28:43 +08:00
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()
{
if(this->isHidden())
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();
ui->Label_DialBut_1->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,4),getBitOf32Data(DK1,5),0)+");");
ui->Label_DialBut_2->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,6),getBitOf32Data(DK1,7),0)+");");
ui->Label_DialBut_3->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,8),getBitOf32Data(DK1,9),1)+");");
ui->Label_DialBut_4->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,10),getBitOf32Data(DK1,11),0)+");");
ui->Label_DialBut_5->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,12),getBitOf32Data(DK1,13),0)+");");
ui->Label_DialBut_6->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,14),getBitOf32Data(DK1,15),0)+");");
ui->Label_DialBut_7->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,16),getBitOf32Data(DK1,17),0)+");");
ui->Label_DialBut_8->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,18),getBitOf32Data(DK1,19),0)+");");
ui->Label_DialBut_9->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,20),getBitOf32Data(DK1,21),0)+");");
ui->Label_DialBut_10->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,22),getBitOf32Data(DK1,23),0)+");");
ui->Label_DialBut_11->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,24),getBitOf32Data(DK1,25),0)+");");
ui->Label_DialBut_12->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,26),getBitOf32Data(DK1,27),0)+");");
ui->Label_DialBut_13->setStyleSheet("border-image: url("+BitMaps().DialBut(getBitOf32Data(DK1,28),getBitOf32Data(DK1,29),1)+");");
ui->Label_DB_1->setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK1,0))+");");
ui->Label_DB_2->setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK1,1))+");");
ui->Label_DB_6->setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK1,2))+");");
ui->Label_DB_7->setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK1,3))+");");
ui->Label_DB_3->setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK1,30))+");");
ui->Label_DB_4->setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK1,31))+");");
ui->Label_DB_5->setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK2,0))+");");
ui->Label_Led_1->setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK2,1))+");");
ui->Label_Led_2->setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK2,2))+");");
ui->Label_Led_3->setStyleSheet("border-image: url("+BitMaps().DiBut(getBitOf32Data(DK2,3))+");");
int16_t AK1L = static_cast<int16_t>(AK1 & 0xFFFF);// 低 16 位
int16_t AK1H = static_cast<int16_t>(AK1 >> 16); // 高 16 位
int16_t AK2L = static_cast<int16_t>(AK2 & 0xFFFF);// 低 16 位
int16_t AK2H = static_cast<int16_t>(AK2 >> 16); // 高 16 位
ui->Slider_Haul_L->setValue(AK1L);
ui->Slider_Haul_R->setValue(AK1H);
uint16_t dX = map(AK2L + 256,0,512.,0,140)- ui->Label_TransportPos->width()/2;
uint16_t dY = map(AK2H + 256,0,512.,0,140)- ui->Label_TransportPos->height()/2;
ui->Label_TransportPos->move(dX,dY);
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"));
}