qt/ledset/expertwin.cpp

1747 lines
93 KiB
C++
Raw Normal View History

2022-08-25 18:43:03 +08:00
#include "expertwin.h"
2023-03-31 18:44:09 +08:00
#include "gutil/qgui.h"
2023-04-18 18:21:34 +08:00
#include "expertboxlayoutwin.h"
2022-08-25 18:43:03 +08:00
#include "expertsmartpointsetwin.h"
2023-09-05 10:02:20 +08:00
#include "expertsendpanel.h"
2022-08-26 23:15:25 +08:00
#include "expertscreenconnwin.h"
2023-08-24 16:55:38 +08:00
#include "globalfunc.h"
2022-08-25 18:43:03 +08:00
#include <QTabWidget>
#include <QLineEdit>
#include <QPushButton>
#include <QGroupBox>
2022-09-13 23:16:36 +08:00
#include <QStackedWidget>
#include <QRadioButton>
2022-12-16 15:08:53 +08:00
#include <QCheckBox>
#include <QApplication>
#include <QFile>
#include <QMessageBox>
#include <QFileDialog>
2023-07-28 14:48:41 +08:00
#include <QSplitter>
2023-09-05 10:02:20 +08:00
#include "efffrefr.h"
#include "globalfunc.h"
2022-08-25 18:43:03 +08:00
2023-09-05 10:02:20 +08:00
auto zrf_param_msg = QByteArray::fromHex( "20 00 06 20 10 10 00 E4 06 FF FF FF FF 00 00 80 80 80 00 00 00 1F 00 00 00 3C 01 33 00 00 00 80 00 00 12 05 00 00 00 01 "
"02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 01 00 00 00 00 10 00 00 20 00 "
"00 30 00 00 40 00 00 50 00 00 60 00 00 70 00 00 80 00 00 90 00 00 A0 00 00 B0 00 00 C0 00 00 D0 00 00 F0 00 00 00 01 00 "
"10 01 00 20 01 00 30 01 00 40 01 00 50 01 00 60 01 00 70 01 00 80 01 00 90 01 00 A0 01 00 B0 01 00 C0 01 00 D0 01 00 F0 "
"01 00 00 02 00 10 02 05 00 1F F8 7F 01 40 07 1F F8 73 01 40 07 1F F8 5F 01 40 07 40 10 40 10 40 10 00 00 00 00 00 00 00 "
"00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
"00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");//256个
2023-09-01 16:17:33 +08:00
//modified by alahover -o 20230823
2022-08-25 18:43:03 +08:00
2023-08-24 16:55:38 +08:00
ExpertWin::ExpertWin(QWidget *parent, int rcvCardType) : BaseWin{parent}, m_iRcvCardType{rcvCardType} {
2022-08-25 18:43:03 +08:00
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle("专家调屏");
2023-07-28 14:48:41 +08:00
resize(900, 720);
2023-09-05 10:02:20 +08:00
qDebug()<<"rcvCardType"<<rcvCardType;
//added by alahover -s 20230829
//初始化变量
for(int i=0;i<256;i++)
{
zrf_rcv_obj.p_x[i]=0;
zrf_rcv_obj.p_y[i]=0;
zrf_rcv_obj.p_w[i]=256;
zrf_rcv_obj.p_h[i]=1024;
zrf_rcv_obj.p_posNum[i]=0;
}
for(int i=0;i<2048;i++)
{
zrf_rcv_obj.m_pixelPos[i][0]=i%256;//描点参数中一点占用 2字节8bit 列 + 8 bit 行)
zrf_rcv_obj.m_pixelPos[i][1]=0;//描点参数中一点占用 2字节8bit 列 + 8 bit 行)
}
GammaGen(zrf_rcv_obj.g_all,(float)2.2,65535);
GammaGen(zrf_rcv_obj.g_red,(float)2.2,65535);
GammaGen(zrf_rcv_obj.g_green,(float)2.2,65535);
GammaGen(zrf_rcv_obj.g_blue,(float)2.2,65535);
changeValueBySmart();
//added by alahover -o 20230829
2022-08-25 18:43:03 +08:00
auto vBox = new QVBoxLayout(center);
vBox->setContentsMargins(0,0,0,0);
vBox->setSpacing(3);
vBox->addLayout(addBtns(new QHBoxLayout()));
auto tab = new QTabWidget;
tab->setStyleSheet(R"rrr(
QTabWidget::pane {border: 1px solid #888; margin-top:-1px;}
QTabBar::tab {margin-top: 4px; padding: 6px 20px; border: 1px solid #888; border-radius: 0 0 3px 3px;}
QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; background-color: #000;}
)rrr");
vBox->addWidget(tab);
2023-09-05 10:02:20 +08:00
auto sendPanel = new ExpertSendPanel;
tab->addTab(sendPanel, "发送设备");
2022-12-16 15:08:53 +08:00
{
auto file = QApplication::applicationDirPath()+"/temp.screen";
QFile qFile(file);
if(qFile.open(QFile::ReadOnly)) {
auto data = qFile.readAll();
qFile.close();
2023-07-28 14:48:41 +08:00
auto json = JFrom(data).toObj();
if(! json.empty()) {
2023-08-21 11:21:00 +08:00
cfg = json;
2023-07-28 14:48:41 +08:00
mBox = json["ModuleConnectionInfo"].toObj();
mModule = mBox["ModuleInfo"].toObj();
2022-12-16 15:08:53 +08:00
}
} else {
auto file = QApplication::applicationDirPath()+"/temp.module";
QFile qFile(file);
if(qFile.open(QFile::ReadOnly)) {
auto data = qFile.readAll();
qFile.close();
2023-07-28 14:48:41 +08:00
auto json = JFrom(data).toObj();
if(! json.empty()) mModule = json;
2022-12-16 15:08:53 +08:00
}
}
}
2022-08-25 18:43:03 +08:00
auto receivePanel = new QWidget;
tab->addTab(receivePanel, "接收卡");
{
2022-09-13 23:16:36 +08:00
auto vBox = new VBox(receivePanel);
2023-09-05 10:02:20 +08:00
vBox->setContentsMargins(4, 4, 4, 4);
2022-08-26 23:15:25 +08:00
auto gBox = new QGroupBox("模组信息");
2022-08-25 18:43:03 +08:00
vBox->addWidget(gBox);
2022-12-16 15:08:53 +08:00
{
auto hh = new HBox(gBox);
hh->addSpacing(20);
auto vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
auto lb = new QLabel("驱动芯片: ");
vvv->addWidget(lb);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
lb = new QLabel("译码方式: ");
vvv->addWidget(lb);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
2023-07-28 14:48:41 +08:00
fdChipType = new QLabel(mModule["ChipType"].toStr());
2022-12-16 15:08:53 +08:00
vvv->addWidget(fdChipType);
2022-08-25 18:43:03 +08:00
2023-07-28 14:48:41 +08:00
fdDecodeMode = new QLabel(mModule["DecodeMode"].toStr());//译码方式
2022-12-16 15:08:53 +08:00
vvv->addWidget(fdDecodeMode);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
hh->addSpacing(20);
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
lb = new QLabel("模组宽度: ");
vvv->addWidget(lb);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
lb = new QLabel("模组高度: ");
vvv->addWidget(lb);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
fdModuleWidth = new QLabel(QString::number(mModule["ModuleWidth"].toInt()));
vvv->addWidget(fdModuleWidth);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
fdModuleHeight = new QLabel(QString::number(mModule["ModuleHeight"].toInt()));
vvv->addWidget(fdModuleHeight);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
hh->addSpacing(20);
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
lb = new QLabel("扫描数: ");
vvv->addWidget(lb);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
lb = new QLabel("数据数组: ");
vvv->addWidget(lb);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
fdScanNum = new QLabel(QString::number(mModule["ScanNum"].toInt()));
vvv->addWidget(fdScanNum);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
fdGroupNum = new QLabel(QString::number(mModule["GroupNum"].toInt()));
vvv->addWidget(fdGroupNum);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
hh->addSpacing(20);
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
auto btn = new QPushButton(tr("数据线颜色"));
btn->setStyleSheet("QPushButton {border: none; }");
vvv->addWidget(btn);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
btn = new QPushButton(tr("模组抽行设置"));
btn->setStyleSheet("QPushButton {border: none; }");
vvv->addWidget(btn);
2022-08-25 18:43:03 +08:00
2023-09-05 10:02:20 +08:00
vvv = new VBox(hh);
fdDataGroupColor = new QLabel("红,绿,蓝");
vvv->addWidget(fdDataGroupColor);
fdChouDian = new QLabel("");
vvv->addWidget(fdChouDian);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
hh->addStretch();
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
btn = new QPushButton("模组选择");
btn->setProperty("ss","blue");
vvv->addWidget(btn);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
btn = new QPushButton("智能设置");
btn->setProperty("ss","blue");
connect(btn, &QPushButton::clicked, this, [this] {
(new ExpertSmartPointSetWin(this))->show();
});
vvv->addWidget(btn);
}
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
gBox = new QGroupBox("单卡带载");
vBox->addWidget(gBox);
{
auto hh = new HBox(gBox);
hh->addSpacing(20);
auto vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
auto fdNormal = new QRadioButton("常规设计");
fdNormal->setChecked(true);
vvv->addWidget(fdNormal);
2022-09-09 23:25:49 +08:00
2023-08-21 11:21:00 +08:00
fdAdvacned = new QRadioButton("高级设计");
2022-12-16 15:08:53 +08:00
vvv->addWidget(fdAdvacned);
2022-09-09 23:25:49 +08:00
2022-12-16 15:08:53 +08:00
hh->addSpacing(20);
2022-09-09 23:25:49 +08:00
2022-12-16 15:08:53 +08:00
auto line = new QFrame;
line->setFrameShadow(QFrame::Sunken);
line->setFrameShape(QFrame::VLine);
hh->addWidget(line);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
auto stack = new QStackedWidget;
auto poli = stack->sizePolicy();
poli.setVerticalPolicy(QSizePolicy::Maximum);
stack->setSizePolicy(poli);
hh->addWidget(stack);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
auto normalPanel = new QWidget;
stack->addWidget(normalPanel);
{
auto hh = new HBox(normalPanel);
hh->setContentsMargins(0,0,0,0);
auto vvv = new VBox(hh);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
auto lb = new QLabel(tr("宽度"));
vvv->addWidget(lb);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
lb = new QLabel(tr("高度"));
vvv->addWidget(lb);
2022-09-09 23:25:49 +08:00
2022-12-16 15:08:53 +08:00
vvv = new VBox(hh);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
fdCardWidth = new QSpinBox;
fdCardWidth->setRange(0, 99999);
fdCardWidth->setValue(mBox["ModuleRow"].toInt() * mModule["ModuleWidth"].toInt());
vvv->addWidget(fdCardWidth);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
fdCardHeight = new QSpinBox;
fdCardHeight->setRange(0, 99999);
fdCardHeight->setValue(mBox["ModuleCol"].toInt() * mModule["ModuleHeight"].toInt());
vvv->addWidget(fdCardHeight);
hh->addSpacing(20);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
vvv = new VBox(hh);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
lb = new QLabel(tr("多开设置"));
vvv->addWidget(lb);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
lb = new QLabel(tr("级联方向"));
vvv->addWidget(lb);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
vvv = new VBox(hh);
2022-09-09 23:25:49 +08:00
2022-12-16 15:08:53 +08:00
fdSectorCount = new QComboBox;
fdSectorCount->addItem(tr(""), 1);
2023-09-05 10:02:20 +08:00
fdSectorCount->addItem(tr("2开"), 2);
fdSectorCount->addItem(tr("3开"), 3);
fdSectorCount->addItem(tr("4开"), 4);
fdSectorCount->addItem(tr("5开"), 5);
fdSectorCount->addItem(tr("6开"), 6);
fdSectorCount->addItem(tr("8开"), 7);
fdSectorCount->addItem(tr("12开"), 7);
2023-08-21 11:21:00 +08:00
SetCurData(fdSectorCount, mBox["SectorCount"].toInt());
2022-12-16 15:08:53 +08:00
vvv->addWidget(fdSectorCount);
2022-09-13 23:16:36 +08:00
2023-09-05 10:02:20 +08:00
fdDirection = new QComboBox;
2022-12-16 15:08:53 +08:00
fdDirection->addItem(tr("从右到左"));
fdDirection->addItem(tr("从上到下"));
2023-09-05 10:02:20 +08:00
fdDirection->addItem(tr("从左到右"));
2022-12-16 15:08:53 +08:00
fdDirection->addItem(tr("从下到上"));
fdDirection->setCurrentIndex(mBox["ModuleDirection"].toInt());
vvv->addWidget(fdDirection);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
hh->addStretch();
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
vvv = new VBox(hh);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
auto cb = new QCheckBox(tr("旋转180°"));
vvv->addWidget(cb);
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
auto btn = new QPushButton(tr("数据交换"));
btn->setProperty("ss","blue");
vvv->addWidget(btn);
}
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
auto advacnedPanel = new QWidget;
stack->addWidget(advacnedPanel);
{
auto hh = new HBox(advacnedPanel);
hh->setContentsMargins(0,0,0,0);
vvv = new VBox(hh);
auto btn = new QPushButton(tr("平面造型"));
btn->setProperty("ss","blue");
btn->setMaximumWidth(100);
2023-04-18 18:21:34 +08:00
connect(btn, &QPushButton::clicked, this, [=] {
auto win = new ExpertBoxLayoutWin(this);
win->show();
2023-08-21 11:21:00 +08:00
win->raise();
win->activateWindow();
2023-04-18 18:21:34 +08:00
});
2022-12-16 15:08:53 +08:00
vvv->addWidget(btn);
}
connect(fdNormal, &QRadioButton::toggled, this, [=](bool checked) {
stack->setCurrentWidget(checked ? normalPanel : advacnedPanel);
});
2023-08-21 11:21:00 +08:00
if(cfg["is_irr"].toBool()) fdAdvacned->setChecked(true);
2022-12-16 15:08:53 +08:00
}
2022-09-13 23:16:36 +08:00
2022-12-16 15:08:53 +08:00
gBox = new QGroupBox(tr("效果测试"));
2023-09-05 10:02:20 +08:00
//modified by alahover -s 20230830
2022-12-16 15:08:53 +08:00
vBox->addWidget(gBox);
{
2023-09-05 10:02:20 +08:00
if(m_iRcvCardType == enum_zrf) {
auto vBox1=new VBox(gBox);
auto hh = new HBox(vBox1);
hh->addSpacing(20);
//第一列区域
auto vvv = new VBox(hh);
//1.1.移位时钟频率
auto hhh = new HBox(vvv);
auto lb = new QLabel(tr("DCLK频率:"));
hhh->addWidget(lb);
cbDCLKf = new QComboBox(); cbDCLKf->addItem("31.2M");cbDCLKf->addItem("25M");cbDCLKf->addItem("20.83M");cbDCLKf->addItem("17.86M");cbDCLKf->addItem("15.63M");cbDCLKf->addItem("12.5M");cbDCLKf->addItem("10.42M");cbDCLKf->addItem("8.9M");
cbDCLKf->addItem("7.8M");cbDCLKf->addItem("6.25M");;cbDCLKf->addItem("5.2M");;cbDCLKf->addItem("4.5M");;cbDCLKf->addItem("3.9M");;cbDCLKf->addItem("3.125M"); ;cbDCLKf->addItem("1.9M"); ;cbDCLKf->addItem("1M"); hhh->addWidget(cbDCLKf);
//1.2.灰度级别
hhh = new HBox(vvv);
lb = new QLabel(tr("灰度级数:")); hhh->addWidget(lb);
cbGryLevel = new QComboBox(); cbGryLevel->addItem("无灰度"); cbGryLevel->addItem("无OE8级");cbGryLevel->addItem("无OE16级");cbGryLevel->addItem("无OE32级");cbGryLevel->addItem("无OE64级");cbGryLevel->addItem("正常16级"); cbGryLevel->addItem("高亮16级");cbGryLevel->addItem("正常32级");
cbGryLevel->addItem("高亮32级");cbGryLevel->addItem("正常64级");cbGryLevel->addItem("高亮64级");cbGryLevel->addItem("正常128级");cbGryLevel->addItem("高亮128级");cbGryLevel->addItem("正常256级");cbGryLevel->addItem("高亮256级");cbGryLevel->addItem("正常512级");
cbGryLevel->addItem("高亮512级");cbGryLevel->addItem("正常1024级");cbGryLevel->addItem("高亮1024级");cbGryLevel->addItem("低亮2048级");cbGryLevel->addItem("正常2048级");cbGryLevel->addItem("高亮2048级");cbGryLevel->addItem("低亮4096级");cbGryLevel->addItem("正常4096级");
cbGryLevel->addItem("高亮4096级");cbGryLevel->addItem("低亮8192级");cbGryLevel->addItem("正常8192级");cbGryLevel->addItem("高亮8192级");cbGryLevel->addItem("低亮16384级");cbGryLevel->addItem("正常16384");cbGryLevel->addItem("正常32768级");cbGryLevel->addItem("正常65535级"); hhh->addWidget(cbGryLevel);
//1.3.刷新倍率
hhh = new HBox(vvv);
lb = new QLabel(tr("刷新倍率:")); hhh->addWidget(lb);
freshBeiLv = new QComboBox(); freshBeiLv->addItem("20");freshBeiLv->addItem("24");freshBeiLv->addItem("28");freshBeiLv->addItem("32");freshBeiLv->addItem("36");freshBeiLv->addItem("40");freshBeiLv->addItem("44");freshBeiLv->addItem("48");freshBeiLv->addItem("64M"); hhh->addWidget(freshBeiLv);
//1.4.换行时间
hhh = new HBox(vvv);
lb = new QLabel(tr("换行时间(ns):")); hhh->addWidget(lb);
spinLineNs = new QSpinBox; spinLineNs->setRange(2, 9999); hhh->addWidget(spinLineNs);
//1.5.换行位置
hhh = new HBox(vvv);
lb = new QLabel(tr("换行位置(ns):")); hhh->addWidget(lb);
spinLineWz = new QSpinBox; spinLineWz->setRange(2, 9999); hhh->addWidget(spinLineWz);
//1.6.行消隐时间
hhh = new HBox(vvv);
lb = new QLabel(tr("行消隐时间(ns):")); hhh->addWidget(lb);
spinLineXy = new QSpinBox; spinLineWz->setRange(2, 9999); hhh->addWidget(spinLineXy);
//第二列区域
hh->addSpacing(20);
vvv = new VBox(hh);
//2.1.无信号数据
hhh = new HBox(vvv);
lb = new QLabel(tr("无信号数据:")); hhh->addWidget(lb);
cbNoSign = new QComboBox();
cbNoSign->addItem("最后一帧画面");
cbNoSign->addItem("黑屏");
hhh->addWidget(cbNoSign);
//2.2.显卡同步
hhh = new HBox(vvv);
lb = new QLabel(tr("显卡同步")); hhh->addWidget(lb);
checkSyncXianKa = new QCheckBox; checkSyncXianKa->setChecked(true); hhh->addWidget(checkSyncXianKa);
//2.3.开屏渐亮
hhh = new HBox(vvv);
lb = new QLabel(tr("双卡备份")); hhh->addWidget(lb);
checkDoubleCopy = new QCheckBox; checkDoubleCopy->setChecked(false); hhh->addWidget(checkDoubleCopy);
//2.4.开屏渐亮
hhh = new HBox(vvv);
lb = new QLabel(tr("开屏渐亮")); hhh->addWidget(lb);
checkJianLiang = new QCheckBox; checkSyncXianKa->setChecked(false); hhh->addWidget(checkJianLiang);
//2.5.D信号为第二组时钟
hhh = new HBox(vvv);
lb = new QLabel(tr("信号为第二组时钟")); hhh->addWidget(lb);
checkDsignalAsCLk = new QCheckBox; checkDsignalAsCLk->setChecked(false); hhh->addWidget(checkDsignalAsCLk);
//更多设置
hh->addStretch();
vvv = new VBox(hh);
vvv->addStretch();
hhh = new HBox(vvv);
auto btn = new QPushButton(tr("更多设置"));
btn->setProperty("ss","blue");
hhh->addWidget(btn);
btn = new QPushButton(tr("亮度设置"));
btn->setProperty("ss","blue");
vvv->addWidget(btn);
btn = new QPushButton(tr("Gamma设置"));
btn->setProperty("ss","blue");
vvv->addWidget(btn);
btn = new QPushButton(tr("电流增益设置"));
btn->setProperty("ss","blue");
vvv->addWidget(btn);
2022-12-16 15:08:53 +08:00
2023-09-05 10:02:20 +08:00
vvv->addStretch();
hh->addStretch();
2022-09-13 23:16:36 +08:00
2023-09-05 10:02:20 +08:00
vvv = new VBox(hh);
//分割线
auto hh3 = new HBox(vvv);
QFrame * line2 = new QFrame();
line2->setFrameShape(QFrame::VLine);
line2->setFrameShadow(QFrame::Sunken);
line2->setStyleSheet("background-color:#222;");
hh3->addWidget(line2);
//第三列区域
vvv = new VBox(hh);
//3.1.DCLK相位
hhh = new HBox(vvv);
lb = new QLabel(tr("DCLK相位:")); hhh->addWidget(lb);
cbDclkXw = new QComboBox(); cbDclkXw->addItem("0度");cbDclkXw->addItem("+90度");cbDclkXw->addItem("-90度"); hhh->addWidget(cbDclkXw);
//3.2.DCLK占空比
hhh = new HBox(vvv);
lb = new QLabel(tr("DCLK占空比:")); hhh->addWidget(lb);
cbDclkZkb = new QComboBox(); cbDclkZkb->addItem("50%");cbDclkZkb->addItem("25%");cbDclkZkb->addItem("75%"); hhh->addWidget(cbDclkZkb);
//3.3.锁存STB相位微调
hhh = new HBox(vvv);
lb = new QLabel(tr("锁存STB相位微调:")); hhh->addWidget(lb);
cbStb = new QComboBox(); cbStb->addItem("不调整");cbStb->addItem("前移1个时钟");cbStb->addItem("前移2个时钟");cbStb->addItem("前移3个时钟");cbStb->addItem("后移1个时钟");cbStb->addItem("后移2个时钟");cbStb->addItem("后移3个时钟"); hhh->addWidget(cbStb);
//3.4.行信号DE相位微调
hhh = new HBox(vvv);
lb = new QLabel(tr("行信号DE相位微调:")); hhh->addWidget(lb);
cbDE = new QComboBox(); cbDE->addItem("不调整");cbDE->addItem("前移1个时钟");cbDE->addItem("前移2个时钟");cbDE->addItem("前移3个时钟");cbDE->addItem("后移1个时钟");cbDE->addItem("后移2个时钟");cbDE->addItem("后移3个时钟"); hhh->addWidget(cbDE);
//3.5.行信号ABC相位微调
hhh = new HBox(vvv);
lb = new QLabel(tr("行信号ABC相位微调:")); hhh->addWidget(lb);
cbABC = new QComboBox(); cbABC->addItem("不调整");cbABC->addItem("前移1个时钟");cbABC->addItem("前移2个时钟");cbABC->addItem("前移3个时钟");cbABC->addItem("后移1个时钟");cbABC->addItem("后移2个时钟");cbABC->addItem("后移3个时钟"); hhh->addWidget(cbABC);
//3.6.单口带载点数
hhh = new HBox(vvv);
lb = new QLabel(tr("单口带载点数:")); hhh->addWidget(lb);
spinPointsOnePort = new QSpinBox; spinPointsOnePort->setRange(1, 999); hhh->addWidget(spinPointsOnePort);
hh->addSpacing(20);
//第四列区域
vvv = new VBox(hh);
//4.1.消隐电平
hhh = new HBox(vvv);
lb = new QLabel(tr("消隐电平:")); hhh->addWidget(lb);
cbXiaoYinDianPing= new QComboBox(); cbXiaoYinDianPing->addItem("高有效");cbXiaoYinDianPing->addItem("低有效"); hhh->addWidget(cbXiaoYinDianPing);
//4.2.锁存信号
hhh = new HBox(vvv);
lb = new QLabel(tr("锁存信号:")); hhh->addWidget(lb);
cbSTB = new QComboBox(); cbSTB->addItem("正向");cbSTB->addItem("反向"); hhh->addWidget(cbSTB);
//4.3.行输出
hhh = new HBox(vvv);
lb = new QLabel(tr("行输出:")); hhh->addWidget(lb);
cbSRowOut = new QComboBox(); cbSRowOut->addItem("低有效");cbSRowOut->addItem("高有效"); hhh->addWidget(cbSRowOut);
//4.4.GCLK频率
hhh = new HBox(vvv);
lb = new QLabel(tr("GCLK频率:"));
hhh->addWidget(lb);
cbGCLKf = new QComboBox();
cbGCLKf->addItem("25M");cbGCLKf->addItem("20.83M");cbGCLKf->addItem("17.86M");cbGCLKf->addItem("15.63M");cbGCLKf->addItem("13.89M");cbGCLKf->addItem("12.5M");cbGCLKf->addItem("11.36M");cbGCLKf->addItem("10.42M");cbGCLKf->addItem("9.62M");
hhh->addWidget(cbGCLKf);
//4.5.GCLK相位
hhh = new HBox(vvv);
lb = new QLabel(tr("GCLK相位:")); hhh->addWidget(lb);
spinGclkXw = new QSpinBox; spinGclkXw->setRange(20, 80); hhh->addWidget(spinGclkXw);
//4.6.GCLK占空比
hhh = new HBox(vvv);
lb = new QLabel(tr("GCLK占空比:")); hhh->addWidget(lb);
spinGclkZkb = new QSpinBox; spinGclkZkb->setRange(20, 80); hhh->addWidget(spinGclkZkb);
//分割线
auto hh1 = new HBox(vBox1);
QFrame * line = new QFrame();
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
line->setStyleSheet("background-color:#222;");
hh1->addWidget(line);
auto hh2=new HBox(vBox1);
//计算结果竖直信息区
auto resultInfo = new HBox(hh2);
lb = new QLabel(tr("视觉刷新率:")); resultInfo->addWidget(lb);
float freshLv1=Get_Frefr(7/*小数权值*/ , 12/*灰度位宽*/ , 12500000/*移位时钟频率*/ , 240/*扫描长度*/ , 16/*扫描类型*/ , 4/*倍频*/ ); m_ctrlFreshRate = new QLabel(QString::number(freshLv1)); resultInfo->addWidget(m_ctrlFreshRate);
resultInfo->addStretch();
lb = new QLabel(tr("亮度有效率:")); resultInfo->addWidget(lb);
float BrightYouXiaoLv1=Get_Eff(8,16); m_ctrlBrightEff = new QLabel(QString::number(BrightYouXiaoLv1)); resultInfo->addWidget(m_ctrlBrightEff);
resultInfo->addStretch();
lb = new QLabel(tr("最小OE:")); resultInfo->addWidget(lb);
float minOe=Get_Eff(8,16); m_ctrlMinOE = new QLabel(QString::number(minOe)); resultInfo->addWidget(m_ctrlMinOE);
resultInfo->addStretch();
}
else if(m_iRcvCardType == enum_xixun_sync)
{
auto hh = new HBox(gBox);
hh->addSpacing(20);
2022-09-13 23:16:36 +08:00
2023-09-05 10:02:20 +08:00
auto vvv = new VBox(hh);
2022-12-16 15:08:53 +08:00
2023-09-05 10:02:20 +08:00
auto hhh = new HBox(vvv);
auto lb = new QLabel(tr("DCLK频率:"));
hhh->addWidget(lb);
auto cbDCLKf = new QComboBox();
cbDCLKf->addItem("31.2M");cbDCLKf->addItem("25M");cbDCLKf->addItem("20.83M");cbDCLKf->addItem("17.86M");cbDCLKf->addItem("15.63M");cbDCLKf->addItem("13.89M");cbDCLKf->addItem("12.5M");
cbDCLKf->addItem("11.36M");cbDCLKf->addItem("10.42M");cbDCLKf->addItem("9.62M");cbDCLKf->addItem("8.9M");cbDCLKf->addItem("7.8M");cbDCLKf->addItem("6.25M");
hhh->addWidget(cbDCLKf);
hhh = new HBox(vvv);
lb = new QLabel(tr("DCLK相位:"));
hhh->addWidget(lb);
auto spinDclkXw = new QSpinBox;
spinDclkXw->setRange(0, 99999);
hhh->addWidget(spinDclkXw);
hhh = new HBox(vvv);
lb = new QLabel(tr("DCLK占空比:"));
hhh->addWidget(lb);
auto spinDclkZkb = new QSpinBox;
spinDclkZkb->setRange(20, 80);
hhh->addWidget(spinDclkZkb);
hhh = new HBox(vvv);
lb = new QLabel(tr("换行时间(ns):"));
hhh->addWidget(lb);
auto spinLineNs = new QSpinBox;
spinLineNs->setRange(2, 9999);
hhh->addWidget(spinLineNs);
hhh = new HBox(vvv);
lb = new QLabel(tr("视觉刷新率:"));
hhh->addWidget(lb);
float freshLv=Get_Frefr(7/*小数权值*/ , 12/*灰度位宽*/ , 12500000/*移位时钟频率*/ , 240/*扫描长度*/ , 16/*扫描类型*/ , 4/*倍频*/ );
qDebug()<<"get_eff="<<freshLv;//QString("%1").arg(temp,0,10);
lb = new QLabel(QString::number(freshLv));
hhh->addWidget(lb);
2022-09-13 23:16:36 +08:00
2023-09-05 10:02:20 +08:00
hh->addSpacing(20);
vvv = new VBox(hh);
hhh = new HBox(vvv);
lb = new QLabel(tr("亮度有效率:"));
hhh->addWidget(lb);
float BrightYouXiaoLv=Get_Eff(8,16);
qDebug()<<"get_eff="<<BrightYouXiaoLv;
lb = new QLabel(QString::number(BrightYouXiaoLv));
hhh->addWidget(lb);
hhh = new HBox(vvv);
lb = new QLabel(tr("GCLK频率:"));
hhh->addWidget(lb);
auto cbGCLKf = new QComboBox();
cbGCLKf->addItem("25M");
cbGCLKf->addItem("20.83M");
cbGCLKf->addItem("17.86M");
cbGCLKf->addItem("15.63M");
cbGCLKf->addItem("13.89M");
cbGCLKf->addItem("12.5M");
cbGCLKf->addItem("11.36M");
cbGCLKf->addItem("10.42M");
cbGCLKf->addItem("9.62M");
hhh->addWidget(cbGCLKf);
hhh = new HBox(vvv);
lb = new QLabel(tr("灰度级数:"));
hhh->addWidget(lb);
auto cbGryLevel = new QComboBox();
cbGryLevel->addItem("256");
cbGryLevel->addItem("1024");
cbGryLevel->addItem("4096");
cbGryLevel->addItem("8192");
cbGryLevel->addItem("16384");
cbGryLevel->addItem("32768");
cbGryLevel->addItem("65536");
hhh->addWidget(cbGryLevel);
hhh = new HBox(vvv);
lb = new QLabel(tr("GCLK占空比:"));
hhh->addWidget(lb);
auto spinGclkZkb = new QSpinBox;
spinGclkZkb->setRange(20, 80);
hhh->addWidget(spinGclkZkb);
hhh = new HBox(vvv);
lb = new QLabel(tr("换行位置(ns):"));
hhh->addWidget(lb);
auto spinLineWz = new QSpinBox;
spinLineWz->setRange(2, 9999);
hhh->addWidget(spinLineWz);
hh->addStretch();
vvv = new VBox(hh);
hhh = new HBox(vvv);
auto btn = new QPushButton(tr("更多设置"));
btn->setProperty("ss","blue");
hhh->addWidget(btn);
}
2022-09-13 23:16:36 +08:00
}
2022-12-16 15:08:53 +08:00
vBox->addStretch();
auto hBox = new HBox(vBox);
2023-09-05 10:02:20 +08:00
auto btn = new QPushButton(tr("保存接收卡配置"));
2022-12-16 15:08:53 +08:00
btn->setProperty("ss","blue");
connect(btn, &QPushButton::clicked, this, [=] {
auto dir = QApplication::applicationDirPath()+"/BoxFiles";
QDir(dir).mkdir(".");
auto file = QFileDialog::getSaveFileName(this, tr("保存文件"), dir, tr("Box file (*.box)"));
if(file.isEmpty()) return;
QFile qFile(file);
if(! qFile.open(QFile::WriteOnly)) {
QMessageBox::critical(this, tr("失败"), QString(tr("准备写入 %1 文件失败")).arg(file));
return;
}
auto res = qFile.write(savedData());
qFile.close();
if(res < 0) {
QMessageBox::critical(this, tr("失败"), QString(tr("写入 %1 文件失败")).arg(file));
return;
}
QMessageBox::information(this, tr("保存成功"), tr("保存成功"));
});
hBox->addWidget(btn);
btn = new QPushButton(tr("保存Map"));
2023-09-05 10:02:20 +08:00
if(m_iRcvCardType != enum_xixun_sync) btn->hide();
2022-12-16 15:08:53 +08:00
btn->setProperty("ss","blue");
connect(btn, &QPushButton::clicked, this, [=] {
2023-09-05 10:02:20 +08:00
auto file = QFileDialog::getSaveFileName(this, tr("保存文件"), gFileHome);
2022-12-16 15:08:53 +08:00
if(file.isEmpty()) return;
2023-09-05 10:02:20 +08:00
gFileHome = QFileInfo(file).absolutePath();
2022-12-16 15:08:53 +08:00
QFile qFile(file);
if(! qFile.open(QFile::WriteOnly)) {
QMessageBox::critical(this, tr("失败"), QString(tr("准备写入 %1 文件失败")).arg(file));
return;
}
QByteArray data;
addMapData(data);
auto res = qFile.write(data);
qFile.close();
2023-09-05 10:02:20 +08:00
if(res < 0) QMessageBox::critical(this, tr("失败"), QString(tr("写入 %1 文件失败")).arg(file));
else QMessageBox::information(this, tr("成功"), tr("保存成功"));
2022-12-16 15:08:53 +08:00
});
hBox->addWidget(btn);
2023-09-05 10:02:20 +08:00
hBox->addStretch();
btn = new QPushButton(tr("发送接收参数"));
2022-12-16 15:08:53 +08:00
btn->setProperty("ss","blue");
connect(btn, &QPushButton::clicked, this, [=] {
2023-09-05 10:02:20 +08:00
if(m_iRcvCardType == enum_zrf) {
2023-09-01 16:17:33 +08:00
//发送基本参数
2023-09-05 10:02:20 +08:00
auto zrf_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 ff ff 00 f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 00 00 00");
auto zrf_cmd_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00");
int res1=0;
//发送基本参数
MACRO_FUNC_SEND_PARAM("读取基本参数",classToBaseMsg(),1,0x00)
//发送gamma参数
MACRO_FUNC_SEND_PARAM("读取gamma参数",classToGammaMsg(0,flashPage),2,0x10)
//发送描点参数
MACRO_FUNC_SEND_PARAM("读取描点参数",classToMiaoDianMsg(flashPage),16,0x30)
QMessageBox::information(this, tr("提示"), tr("发送接收卡参数成功"));
} else QMessageBox::information(this, tr("提示"), tr("未能识别的控制卡类型"));
2022-12-16 15:08:53 +08:00
});
hBox->addWidget(btn);
2023-09-05 10:02:20 +08:00
btn = new QPushButton(tr("固化接收参数"));
2022-12-16 15:08:53 +08:00
btn->setProperty("ss","blue");
2023-09-01 16:17:33 +08:00
connect(btn, &QPushButton::clicked, this, [=] {
2023-09-05 10:02:20 +08:00
if(m_iRcvCardType == enum_zrf) {
int iReSendCount=3;
int iTimeout=2000;
//发送基本参数
auto zrf_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 ff ff 00 f0 f0 f0 f0 00 00 00 00 00 00 00 00 00 00 00 00");
auto zrf_cmd_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00");
int res1=0;
//发送基本参数
MACRO_FUNC_GUHUA_PARAM("发送基本参数",classToBaseMsg(),1,0x00)
//发送gamma参数
MACRO_FUNC_GUHUA_PARAM("发送gamma参数",classToGammaMsg(0,flashPage),2,0x10)
//发送描点参数
MACRO_FUNC_GUHUA_PARAM("发送描点参数",classToMiaoDianMsg(flashPage),16,0x30)
QMessageBox::information(this, tr("提示"), tr("固化接收卡参数成功"));
} else QMessageBox::information(this, tr("提示"), tr("未能识别的控制卡类型"));
});
hBox->addWidget(btn);
2023-09-01 16:17:33 +08:00
2023-09-05 10:02:20 +08:00
btnReceiveReadBack = new QPushButton(tr("回读接收卡参数"));
btnReceiveReadBack->setProperty("ss","blue");
connect(btnReceiveReadBack, &QPushButton::clicked, this, [=] {
if(m_iRcvCardType == enum_rcvCardType::enum_zrf)
2023-09-01 16:17:33 +08:00
{
2023-09-05 10:02:20 +08:00
int iReSendCount=3;
int iTimeout=10000;
quint8 flashAddr=0x00;
auto zrf_cmd_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00");
auto waitingDlg = new WaitingDlg(this, tr("读取基本参数")+" ...");
for(int i=0;i<iReSendCount;i++){
auto res = sendMsgSync(zrf_cmd_msg, 0x105B14, iTimeout, waitingDlg);
if(res.code==5){if(i>=2) {QMessageBox::critical(this, "Error", tr("读取基本参数请求超时")); return;} }
else if(res.code) {if(i>=2) {QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend))); return;} }
else {
int ioffset=headMap_zrf.paramStart+st_zrf_rb_param.param;
QByteArray return_msg=res.msg.mid(ioffset,256);
waitingDlg->close(); baseMsgToClass((quint8 *)return_msg.data()); qDebug()<<tr("回读基本参数成功");
qDebug()<<"return_msg = "<<return_msg.toHex();
break;
}
}
//回读GAMMA参数
flashAddr=0x10;
for(int m=0;m<2;m++){
int flashPage=flashAddr+m;
for(int n=0;n<4;n++)
*(quint8 *)(zrf_cmd_msg.data()+headMap_zrf.paramStart+st_zrf_cmd_param.flashPage+n)=flashPage;
waitingDlg = new WaitingDlg(this, tr("读取GAMMA参数")+" ...");
for(int i=0;i<iReSendCount;i++){
auto res = sendMsgSync(zrf_cmd_msg, 0x105B14, iTimeout, waitingDlg);
if(res.code==5){if(i>=2) {QMessageBox::critical(this, "Error", tr("读取GAMMA参数请求超时")); return;} }
else if(res.code) {if(i>=2) {QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend))); return;} }
else {
int ioffset=headMap_zrf.paramStart+st_zrf_rb_param.param;
QByteArray return_msg=res.msg.mid(ioffset,256);
waitingDlg->close(); gammaMsgToClass((quint8 *)return_msg.data(),flashPage); qDebug()<<tr("回读gamma参数成功");
qDebug()<<"return_msg = "<<return_msg.toHex();
break;
}
}
2023-09-01 16:17:33 +08:00
}
//回读描点参数
2023-09-05 10:02:20 +08:00
flashAddr=0x30;
for(int m=0;m<16;m++){
int flashPage=flashAddr+m;
for(int n=0;n<4;n++)
*(quint8 *)(zrf_cmd_msg.data()+headMap_zrf.paramStart+st_zrf_cmd_param.flashPage+n)=flashPage;
waitingDlg = new WaitingDlg(this, tr("读取描点参数")+" ...");
for(int i=0;i<iReSendCount;i++){
auto res = sendMsgSync(zrf_cmd_msg, 0x105B14, iTimeout, waitingDlg);
if(res.code==5){if(i>=2) {QMessageBox::critical(this, "Error", tr("读取描点参数请求超时")); return;} }
else if(res.code) {if(i>=2) {QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend))); return;} }
else {
int ioffset=headMap_zrf.paramStart+st_zrf_rb_param.param;
QByteArray return_msg=res.msg.mid(ioffset,256);
waitingDlg->close(); miaoDianMsgToClass((quint8 *)return_msg.data(),flashPage); qDebug()<<tr("回读描点参数成功");
qDebug()<<"return_msg = "<<return_msg.toHex();
break;
}
}
2023-09-01 16:17:33 +08:00
}
2023-09-05 10:02:20 +08:00
QMessageBox::information(this, tr("提示"), tr("回读接收卡参数成功"));
2023-09-01 16:17:33 +08:00
}
});
2023-09-05 10:02:20 +08:00
hBox->addWidget(btnReceiveReadBack);
2022-08-25 18:43:03 +08:00
}
2022-08-25 22:52:52 +08:00
auto connPanel = new QWidget;
2022-12-16 15:08:53 +08:00
tab->addTab(connPanel, tr("显示屏连接(正面看屏)"));
2022-08-25 22:52:52 +08:00
{
2023-09-05 10:02:20 +08:00
auto vBox = new VBox(connPanel);
2022-08-25 22:52:52 +08:00
vBox->setContentsMargins(4, 4, 4, 4);
2023-09-05 10:02:20 +08:00
auto hBox = new HBox(vBox);
2022-08-25 22:52:52 +08:00
auto bnScreen = new QPushButton("屏1");
2023-09-05 10:02:20 +08:00
hBox->addWidget(bnScreen);
2022-08-25 22:52:52 +08:00
2023-09-05 10:02:20 +08:00
hBox->addStretch();
2022-08-25 22:52:52 +08:00
auto lb = new QLabel("显示屏数目:");
2023-09-05 10:02:20 +08:00
hBox->addWidget(lb);
2022-08-25 22:52:52 +08:00
auto fdScreenCnt = new QSpinBox;
fdScreenCnt->setRange(1, 99);
fdScreenCnt->setValue(1);
2023-09-05 10:02:20 +08:00
hBox->addWidget(fdScreenCnt);
2022-08-25 22:52:52 +08:00
2023-09-05 10:02:20 +08:00
vBox->addLayout(connStack = new QStackedLayout);
connStack->addWidget(new ExpertScreenConnWin);
2022-08-26 23:15:25 +08:00
2023-09-05 10:02:20 +08:00
hBox = new HBox(vBox);
auto btn = new QPushButton(tr("保存到文件"));
btn->setProperty("ss","blue");
connect(btn, &QPushButton::clicked, this, [=] {
auto file = QFileDialog::getSaveFileName(this, tr("保存级联文件"), gFileHome, "Kcon文件 (*.kcon)");
if(file.isEmpty()) return;
gFileHome = QFileInfo(file).absolutePath();
QFile qFile(file);
if(! qFile.open(QFile::WriteOnly)) {
QMessageBox::critical(this, tr("失败"), QString(tr("准备写入 %1 文件失败")).arg(file));
return;
}
auto res = qFile.write(JToBytes(connSavedData(), " "));
qFile.close();
if(res < 0) QMessageBox::critical(this, tr("失败"), QString(tr("写入 %1 文件失败")).arg(file));
else QMessageBox::information(this, tr("成功"), tr("保存成功"));
});
hBox->addWidget(btn);
hBox->addStretch();
btn = new QPushButton(tr("发送级联参数"));
btn->setProperty("ss","blue");
connect(btn, &QPushButton::clicked, this, [=] {
if(m_iRcvCardType == enum_zrf) {
//发送基本参数
auto zrf_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 ff ff 00 f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 00 00 00");
auto zrf_cmd_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00");
int res1=0;
//发送排序参数
MACRO_FUNC_SEND_PARAM("读取排序参数",classToPaiXuSMsg(flashPage),8,0x20)
QMessageBox::information(this, tr("提示"), tr("发送级联参数成功"));
} else QMessageBox::information(this, tr("提示"), tr("未能识别的控制卡类型"));
});
hBox->addWidget(btn);
btn = new QPushButton(tr("固化级联参数"));
btn->setProperty("ss","blue");
connect(btn, &QPushButton::clicked, this, [=] {
if(m_iRcvCardType == enum_zrf) {
int iReSendCount=3;
int iTimeout=2000;
//发送基本参数
auto zrf_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 ff ff 00 f0 f0 f0 f0 00 00 00 00 00 00 00 00 00 00 00 00");
auto zrf_cmd_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00");
int res1=0;
//发送排序参数
MACRO_FUNC_GUHUA_PARAM("发送排序参数",classToPaiXuSMsg(flashPage),8,0x20)
QMessageBox::information(this, tr("提示"), tr("固化级联参数成功"));
} else QMessageBox::information(this, tr("提示"), tr("未能识别的控制卡类型"));
});
hBox->addWidget(btn);
btnConnReadBack = new QPushButton(tr("回读级联参数"));
btnConnReadBack->setProperty("ss","blue");
connect(btnConnReadBack, &QPushButton::clicked, this, [=] {
if(m_iRcvCardType == enum_rcvCardType::enum_zrf)
{
int iReSendCount=3;
int iTimeout=10000;
quint8 flashAddr=0x00;
auto zrf_cmd_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00");
auto waitingDlg = new WaitingDlg(this, tr("读取基本参数")+" ...");
//回读排序参数
flashAddr=0x20;
for(int m=0;m<8;m++){
int flashPage=flashAddr+m;
for(int n=0;n<4;n++)
*(quint8 *)(zrf_cmd_msg.data()+headMap_zrf.paramStart+st_zrf_cmd_param.flashPage+n)=flashPage;
waitingDlg = new WaitingDlg(this, tr("读取排序参数")+" ...");
for(int i=0;i<iReSendCount;i++){
auto res = sendMsgSync(zrf_cmd_msg, 0x105B14, iTimeout, waitingDlg);
if(res.code==5){if(i>=2) {QMessageBox::critical(this, "Error", tr("读取排序参数请求超时")); return;} }
else if(res.code) {if(i>=2) {QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend))); return;} }
else {
int ioffset=headMap_zrf.paramStart+st_zrf_rb_param.param;
QByteArray return_msg=res.msg.mid(ioffset,256);
waitingDlg->close(); paiXuMsgToClass((quint8 *)return_msg.data(),flashPage); qDebug()<<tr("回读排序参数成功");
qDebug()<<"return_msg = "<<return_msg.toHex();
break;
}
}
}
QMessageBox::information(this, tr("提示"), tr("回读级联参数成功"));
}
});
hBox->addWidget(btnConnReadBack);
}
connect(tab, &QTabWidget::currentChanged, [=](int value) {
if(value==1) {
if(needInit1) {
needInit1 = false;
emit btnReceiveReadBack->clicked();
}
} else if(value==2) {
if(needInit2) {
needInit2 = false;
emit btnConnReadBack->clicked();
}
}
});
changeValueByEffectControler();
//状态栏
auto statusWgt = new QWidget;
statusWgt->setStyleSheet("QWidget{background-color:#222;}");
vBox->addWidget(statusWgt);
{
auto hh = new HBox(statusWgt);
auto lb = new QLabel(tr("状态:"));
hh->addWidget(lb);
2022-08-25 22:52:52 +08:00
}
2022-08-25 18:43:03 +08:00
}
2022-12-16 15:08:53 +08:00
void ExpertWin::closeEvent(QCloseEvent *event) {
BaseWin::closeEvent(event);
2023-08-21 11:21:00 +08:00
QFile qFile("temp.screen");
2022-12-16 15:08:53 +08:00
if(! qFile.open(QFile::WriteOnly)) return;
qFile.write(savedData());
qFile.close();
}
QByteArray ExpertWin::savedData() {
mBox.insert("ModuleInfo", mModule);
auto ModuleWidth = mModule["ModuleWidth"].toInt();
auto ModuleHeight = mModule["ModuleHeight"].toInt();
2023-09-05 10:02:20 +08:00
mBox.insert("ModuleRow", ModuleWidth==0 ? 0 : (fdCardWidth->value() + ModuleWidth - 1) / ModuleWidth);
mBox.insert("ModuleCol", ModuleHeight==0 ? 0 : (fdCardHeight->value() + ModuleHeight - 1) / ModuleHeight);
2022-12-16 15:08:53 +08:00
mBox.insert("ModuleDirection", fdDirection->currentIndex());
mBox.insert("SectorCount", fdSectorCount->currentData().toInt());
2023-08-21 11:21:00 +08:00
JObj obj{
{"ModuleConnectionInfo", mBox},
{"is_irr", fdAdvacned->isChecked()},
};
2023-07-28 14:48:41 +08:00
return JToBytes(obj, " ");
2022-12-16 15:08:53 +08:00
}
2023-09-05 10:02:20 +08:00
JObj ExpertWin::connSavedData() {
JArray values;
qDebug()<<"connStack->count()"<<connStack->count();
for(int ss=0; ss<connStack->count(); ss++) {
auto connWin = (ExpertScreenConnWin*) connStack->widget(ss);
JArray boxList;
for(int nn=0; nn<sizeof(connWin->netss)/sizeof(connWin->netss[0]); nn++) for(int bb=0; bb<(int)connWin->netss[nn].size(); bb++) {
auto pos = connWin->netss[nn][bb];
boxList.append(JObj{
{"X", pos.x()*connWin->fdCardWidth->value()},
{"Y", pos.y()*connWin->fdCardHeight->value()},
{"ModuleWidth", connWin->fdCardWidth->value()},
{"ModuleHeight", connWin->fdCardHeight->value()},
{"PortId", nn},
{"SubId", bb+1},
{"ScreenPosRow", pos.x()},
{"ScreenPosCol", pos.y()},
{"ScreenRow", connWin->table->rowCount()},
{"ScreenCol", connWin->table->columnCount()},
{"SettingWidth", connWin->fdCardWidth->value()},
{"SettingHeight", connWin->fdCardHeight->value()},
{"ScreenIndex", ss}
});
}
values.append(JObj{
{"isCompScreen", false},
{"boxList", boxList},
});
}
return {{"values", values}};
}
2022-12-16 15:08:53 +08:00
void ExpertWin::addMapData(QByteArray &data) {
auto ModuleWidth = mModule["ModuleWidth"].toInt();
auto ModuleHeight = mModule["ModuleHeight"].toInt();
auto ModuleRow = (fdCardWidth->value() + ModuleWidth - 1) / ModuleWidth;
auto ModuleCol = (fdCardHeight->value() + ModuleHeight - 1) / ModuleHeight;
auto CardWidth = ModuleRow * ModuleWidth;
auto CardHeight = ModuleCol * ModuleHeight;
auto ModuleDirection = fdDirection->currentIndex();
//auto SectorCount = fdSectorCount->currentData().toInt();
QMap<uint, uint> map;
int memY = 0, memX = 0;
for(int boxY=0; boxY<CardHeight; boxY++) {
for(int boxX=0; boxX<CardWidth; boxX++) {
if(memX > 255) {
memX = 0;
memY++;
}
map.insert(boxY<<16|boxX, memY<<16|memX);
memX++;
}
memX = 0;
memY++;
}
2023-09-05 10:02:20 +08:00
auto points = mModule["ColumnMap"].toArray();
auto scans = mModule["RowMap"].toArray();
2022-12-16 15:08:53 +08:00
auto GroupNum = mModule["GroupNum"].toInt();
auto jCnt = ModuleCol * GroupNum;
2023-07-28 14:48:41 +08:00
for(auto scan : scans) {
2022-12-16 15:08:53 +08:00
QList<QList<QByteArray>> chunkses;
for(int j=0; j<jCnt; j++) {
int lastMemY = INT_MIN;
int lastMemX = -1;
int cnt = 1, ttl = 1;
bool isAnti = false;
QList<QByteArray> chunks;
QByteArray chunk;
QString chstr;
for(int mm=0; mm<ModuleRow; mm++) {
int m = ModuleDirection==0 ? ModuleRow-1-mm : mm;
2023-07-28 14:48:41 +08:00
for(auto point : points) {
2022-12-16 15:08:53 +08:00
uint boxY = j * scans.size() + scan.toInt();
uint boxX = m * ModuleWidth + point.toInt();
if(boxX < 0) { //虚点
if(lastMemY==-1) memX = lastMemX + 1;
else {
memY = -1;
memX = 0;
}
} else {
auto mem = map[boxY<<16 | boxX];
memY = mem >> 16;
memX = mem & 0xffff;
}
if(memY==lastMemY && ttl < 64 && qAbs(memX-lastMemX)==1) {
if(cnt==1) {
isAnti = memX < lastMemX;
cnt++;
ttl++;
lastMemX = memX;
continue;
} else if(memX < lastMemX == isAnti) {
cnt++;
ttl++;
lastMemX = memX;
continue;
}
}
if(lastMemY > INT_MIN) {
uint y = lastMemY==-1 ? 0 : lastMemY;
uint x = isAnti ? lastMemX : lastMemX-cnt+1;
chunk.append((j << 2) + (y >> 8)).append(y).append(x).append((isAnti << 7)+cnt);
chstr += QString("j%1 行%2 列%3 序%4 长%5").arg(j).arg(y).arg(x).arg(isAnti).arg(cnt);
}
if(ttl>=64) {
chunks.append(chunk);
chunk = QByteArray();
qDebug() << chstr;
chstr.clear();
ttl = 1;
}
cnt = 1;
lastMemY = memY;
lastMemX = lastMemY==-1 ? 0 : memX;
}
}
uint y = lastMemY==-1 ? 0 : lastMemY;
uint x = isAnti ? lastMemX : lastMemX-cnt+1;
chunk.append((j << 2) + (y >> 8)).append(y).append(x).append((isAnti << 7)+cnt);
chstr += QString("j%1 行%2 列%3 序%4 长%5").arg(j).arg(y).arg(x).arg(isAnti).arg(cnt);
chunks.append(chunk);
chunkses.append(chunks);
qDebug() << chstr;
}
data.append(0xAA).append(scan.toInt()).append(2, 0);
auto chend = chunkses[0].size()-1;
auto start = data.size();
for(int ch=0; ch<=chend; ch++) {
data.append(0x55).append(ch==chend ? (char)(1<<7) : 0).append(2, 0);
auto start = data.size();
foreach(auto chunks, chunkses) data.append(chunks[ch]);
auto num = (data.size() - start) / 4;
data[start-2] = num;
data[start-3] = num>>8;
}
auto len = data.size() - start;
data[start-1] = len;
data[start-2] = len>>8;
}
}
2023-09-05 10:02:20 +08:00
//added by alahover -s 02030829
2023-09-01 16:17:33 +08:00
void ExpertWin::classToBaseMsg()
{
2023-09-05 10:02:20 +08:00
byte * unitptr = (byte *)zrf_param_msg.data();
byte * bytePrt = (byte *)zrf_param_msg.data();
2023-09-01 16:17:33 +08:00
*bytePrt= (zrf_rcv_obj.b0_7 << 7 & 0b10000000)| (zrf_rcv_obj.b0_6 << 6 & 0b01000000)| (zrf_rcv_obj.b0_5 << 5 & 0b00100000)| (zrf_rcv_obj.b0_4 << 4 & 0b00010000)| (zrf_rcv_obj.b0_3_1 << 1 & 0b00001110) | (zrf_rcv_obj.b0_0 & 0b00000001);;
bytePrt =unitptr + st_zrf_base_param.b1_xiaoyingTime;
*bytePrt = ( zrf_rcv_obj.b1_7_6<< 6 & 0b11000000) | ( zrf_rcv_obj.b1_5<<5 & 0b00100000) | ( zrf_rcv_obj.b1_4<<4 & 0b00010000) | ( zrf_rcv_obj.b1_3_2<<2 & 0b00001100) | ( zrf_rcv_obj.b1_1<<1 & 0b00000010) |( zrf_rcv_obj.b1_0&0b00000001);
bytePrt =unitptr + st_zrf_base_param.b2_line_xytime;
*bytePrt= zrf_rcv_obj.b2;
bytePrt =unitptr + st_zrf_base_param.b3_rows1Group;
*bytePrt= zrf_rcv_obj.b3;
bytePrt =unitptr + st_zrf_base_param.b4_cols1Group;
*bytePrt= zrf_rcv_obj.b4;
bytePrt =unitptr + st_zrf_base_param.b5_scanNum;
*bytePrt= zrf_rcv_obj.b5;
bytePrt =unitptr + st_zrf_base_param.b6_emptyPointNum;
*bytePrt= zrf_rcv_obj.b6;
bytePrt =unitptr + st_zrf_base_param.b7_colorIndex;
*bytePrt= ( zrf_rcv_obj.b7_7_6 << 6 & 0b11000000) | ( zrf_rcv_obj.b7_5_4<<4 & 0b00110000) | ( zrf_rcv_obj.b7_3_2 << 2 & 0b00001100) | ( zrf_rcv_obj.b7_1_0 & 0b00000011) ;
bytePrt =unitptr + st_zrf_base_param.b8_dataOutModle;
*bytePrt= ( zrf_rcv_obj.b8_7<<7 &0b10000000) | ( zrf_rcv_obj.b8_6<<6 & 0b01000000) | ( zrf_rcv_obj.b8_5_4<<4 & 0b00110000) | ( zrf_rcv_obj.b8_3_0 & 0b00001111) ;
bytePrt =unitptr + st_zrf_base_param.b9_brightStatic;
*bytePrt= zrf_rcv_obj.b9 ;
bytePrt =unitptr + st_zrf_base_param.b10_brightRed;
*bytePrt= zrf_rcv_obj.b10;
bytePrt =unitptr + st_zrf_base_param.b11_brightGreen;
*bytePrt= zrf_rcv_obj.b11;
bytePrt =unitptr + st_zrf_base_param.b12_brightBlue;
*bytePrt= zrf_rcv_obj.b12;
bytePrt =unitptr + st_zrf_base_param.b13_icType;
*bytePrt= zrf_rcv_obj.b13;
bytePrt =unitptr + st_zrf_base_param.b14_icParma;
*bytePrt= zrf_rcv_obj.b14;
bytePrt =unitptr + st_zrf_base_param.b15_redIgain;
*bytePrt= zrf_rcv_obj.b15;
bytePrt =unitptr + st_zrf_base_param.b16_greenIgain;
*bytePrt= zrf_rcv_obj.b16;
bytePrt =unitptr + st_zrf_base_param.b17_blueIgain;
*bytePrt= zrf_rcv_obj.b17;
bytePrt =unitptr + st_zrf_base_param.b18_clkFreq;
*bytePrt= ( zrf_rcv_obj.b18_7_4<<4 & 0b11110000) | ( zrf_rcv_obj.b18_3_0 & 0b00001111);
bytePrt =unitptr + st_zrf_base_param.b19_clkDutyCycle;
*bytePrt=( zrf_rcv_obj.b19_7_4<<4 & 0b11110000) | ( zrf_rcv_obj.b19_3_0 & 0b00001111);
bytePrt =unitptr + st_zrf_base_param.b20_pwmIcGrayClk;
*bytePrt= zrf_rcv_obj.b20;
bytePrt =unitptr + st_zrf_base_param.b21_grayLevelMultFreq;
*bytePrt= ( zrf_rcv_obj.b21_7_5 << 5 & 0b11100000) | ( zrf_rcv_obj.b21_4_0 & 0b00011111);
bytePrt =unitptr + st_zrf_base_param.b22_MultFreqMode;
*bytePrt= ( zrf_rcv_obj.b22_7_6 << 6 & 0b11000000) | ( zrf_rcv_obj.b22_5_2<<2 & 0b00111100) | ( zrf_rcv_obj.b22_1_0 & 0b00000011);
bytePrt =unitptr + st_zrf_base_param.b23_reserve;
*bytePrt= zrf_rcv_obj.b23;
bytePrt =unitptr + st_zrf_base_param.b24_freshRate;
*bytePrt= ( zrf_rcv_obj.b24_7_5<<5 & 0b11100000) | ( zrf_rcv_obj.b24_4_0 & 0b00011111);
bytePrt =unitptr + st_zrf_base_param.b24_freshRate +1;
*bytePrt= zrf_rcv_obj.b25;
bytePrt =unitptr + st_zrf_base_param.b26_syncGraphicsCard;
*bytePrt= ( zrf_rcv_obj.b26_7<<7 & 0b10000000) | ( zrf_rcv_obj.b26_6<<6 & 0b01000000) | ( zrf_rcv_obj.b26_5_0 & 0b00111111);
bytePrt =unitptr + st_zrf_base_param.b27_Ldq;
*bytePrt= zrf_rcv_obj.b27_28[0];
bytePrt =unitptr + st_zrf_base_param.b27_Ldq +1;
*bytePrt= zrf_rcv_obj.b27_28[1];
bytePrt =unitptr + st_zrf_base_param.b29_reserve;
*bytePrt= ( zrf_rcv_obj.b29_7_4<<4 & 0b11110000) | ( zrf_rcv_obj.b29_3_2<<2 &0b00001100) | ( zrf_rcv_obj.b29_1_0 & 0b00000011);
bytePrt =unitptr + st_zrf_base_param.b30_pwmMultFreq;
*bytePrt= zrf_rcv_obj.b30;
bytePrt =unitptr + st_zrf_base_param.b31_rcvCardCols;
*bytePrt= zrf_rcv_obj.b31;
bytePrt =unitptr + st_zrf_base_param.b31_rcvCardCols + 1;
*bytePrt= zrf_rcv_obj.b32;
bytePrt =unitptr + st_zrf_base_param.b33_emptyRowMode;
*bytePrt= ( zrf_rcv_obj.b33_7_4<<4 & 0b11110000) | ( zrf_rcv_obj.b33_3_0 & 0b00001111);
bytePrt =unitptr + st_zrf_base_param.b34_emptyRowPos;
*bytePrt= ( zrf_rcv_obj.b34_7_4<<5 & 0b11110000) | ( zrf_rcv_obj.b34_3_0 & 0b00001111);
bytePrt =unitptr + st_zrf_base_param.b35_xiaoYingEndTime;
*bytePrt= zrf_rcv_obj.b35;
bytePrt =unitptr + st_zrf_base_param.b36_RowIcParam;
*bytePrt= ( zrf_rcv_obj.b36_7_6<<6 & 0b11000000) | ( zrf_rcv_obj.b36_5_0 & 0b00111111);
bytePrt =unitptr + st_zrf_base_param.b37_reserve;
*bytePrt= ( zrf_rcv_obj.b37_7_5<<5 & 0b11100000) | ( zrf_rcv_obj.b37_4_3<<3 & 0b00011000) | ( zrf_rcv_obj.b37_2<<2 & 0b00000100) | ( zrf_rcv_obj.b37_1 <<1 & 0b00000010) | ( zrf_rcv_obj.b37_0 & 0b00000001);
bytePrt =unitptr + st_zrf_base_param.b38_hub1to32Area;
memcpy(bytePrt,& zrf_rcv_obj.b38_69[32],32);
bytePrt =unitptr + st_zrf_base_param.b70_reserve;
*bytePrt= ( zrf_rcv_obj.b70_7<<7 & 0b10000000) | ( zrf_rcv_obj.b70_6<<6 & 0b01000000) | ( zrf_rcv_obj.b70_5_2<<2 & 0b00111100) | ( zrf_rcv_obj.b70_1<<1 & 0b00000010) | ( zrf_rcv_obj.b70_0 & 0b00000001);
bytePrt =unitptr + st_zrf_base_param.b71_imgArea1to32Param;
for(int i=0;i<32;i++)
{
memcpy(bytePrt,& zrf_rcv_obj.b71_166[i][0],3);
bytePrt +=3;
}
bytePrt =unitptr + st_zrf_base_param.b167_syncPreTime;
*bytePrt= zrf_rcv_obj.b167;
bytePrt =unitptr + st_zrf_base_param.b168_reserve;
*bytePrt= ( zrf_rcv_obj.b168_7_5<<5 & 0b11100000) | ( zrf_rcv_obj.b168_4_0 & 0b00011111);
bytePrt =unitptr + st_zrf_base_param.b169_redIcParam1;
memcpy(bytePrt,(unsigned char *)& zrf_rcv_obj.b169_192[0],24);
}
void ExpertWin::classToGammaMsg(int iColorType,quint8 flashPage)
{
auto unitptr = (unsigned char *)zrf_param_msg.data();
unsigned char * bytePrt = (unsigned char*)(unitptr);
2023-09-05 10:02:20 +08:00
int iCount=flashPage&0x0F;
if(iCount > 1)
QMessageBox::critical(this, "提示", tr("gamma数据越界"));
2023-09-01 16:17:33 +08:00
switch(iColorType)
{
case 0://all
2023-09-05 10:02:20 +08:00
for (int i = 0; i < 128; i++) {
bytePrt[i*2]=(zrf_rcv_obj.g_all[i+iCount*128]&0XFF00)>>8;
bytePrt[i*2+1]=zrf_rcv_obj.g_all[i+iCount*128]&0X00FF;
}
2023-09-01 16:17:33 +08:00
break;
case 1://red
2023-09-05 10:02:20 +08:00
for (int i = 0; i < 128; i++) {
bytePrt[i*2]=(zrf_rcv_obj.g_red[i+iCount*128]&0XFF00)>>8;
bytePrt[i*2+1]=zrf_rcv_obj.g_red[i+iCount*128]&0X00FF;
}
2023-09-01 16:17:33 +08:00
break;
case 2://green
2023-09-05 10:02:20 +08:00
for (int i = 0; i < 128; i++) {
bytePrt[i*2]=(zrf_rcv_obj.g_green[i+iCount*128]&0XFF00)>>8;
bytePrt[i*2+1]=zrf_rcv_obj.g_green[i+iCount*128]&0X00FF;
}
2023-09-01 16:17:33 +08:00
break;
case 3://blue
2023-09-05 10:02:20 +08:00
for (int i = 0; i < 128; i++) {
bytePrt[i*2]=(zrf_rcv_obj.g_blue[i+iCount*128]&0XFF00)>>8;
bytePrt[i*2+1]=zrf_rcv_obj.g_blue[i+iCount*128]&0X00FF;
}
2023-09-01 16:17:33 +08:00
break;
default:
2023-09-05 10:02:20 +08:00
for (int i = 0; i < 128; i++) {
bytePrt[i*2]=(zrf_rcv_obj.g_all[i+iCount*128]&0XFF00)>>8;
bytePrt[i*2+1]=zrf_rcv_obj.g_all[i+iCount*128]&0X00FF;
}
2023-09-01 16:17:33 +08:00
break;
}
}
2023-09-05 10:02:20 +08:00
void ExpertWin::classToPaiXuSMsg(quint8 flashPage)
2023-09-01 16:17:33 +08:00
{
2023-09-05 10:02:20 +08:00
auto unitptr = (unsigned char *)zrf_param_msg.data();
unsigned char * bytePrt = (unsigned char*)(unitptr);
if(flashPage == 0x20)
{
for(int i=0;i<256;i++)
{
zrf_rcv_obj.p8_st_rcv_pos[i].imgXL8 = zrf_rcv_obj.p_x[i] & 0x00FF;
zrf_rcv_obj.p8_st_rcv_pos[i].imgXH4_YH4 = ((zrf_rcv_obj.p_x[i] & 0x0F00) >>4 )| ((zrf_rcv_obj.p_y[i] & 0x0F00) >>8);
zrf_rcv_obj.p8_st_rcv_pos[i].imgYL8 = zrf_rcv_obj.p_y[i] & 0x00FF;
zrf_rcv_obj.p8_st_rcv_pos[i].imgWidthL8 = zrf_rcv_obj.p_w[i] & 0x00FF;
zrf_rcv_obj.p8_st_rcv_pos[i].imgWidthH4_HeightH4 = ((zrf_rcv_obj.p_w[i] & 0x0F00) >>4 )| ((zrf_rcv_obj.p_h[i] & 0x0F00) >>8);
zrf_rcv_obj.p8_st_rcv_pos[i].imgHeightL8 = zrf_rcv_obj.p_h[i] & 0x00FF;
zrf_rcv_obj.p8_st_rcv_pos[i].imgPosNumInScreenH8 = (zrf_rcv_obj.p_posNum[i] & 0xFF00) >>8;
zrf_rcv_obj.p8_st_rcv_pos[i].imgPosNumInScreenL8 = zrf_rcv_obj.p_posNum[i] & 0x00FF;
}
*bytePrt = zrf_rcv_obj.p0_cardIndexInNet ;//当前卡在网线内的序号
bytePrt++;
*bytePrt = zrf_rcv_obj.p1_SendCardCode ;//当前网线所在的发送卡编号
bytePrt++;
*bytePrt = zrf_rcv_obj.p2_netIndexInSendCard ;//当前网线所在发送卡输出口编号
bytePrt++;
*bytePrt = zrf_rcv_obj.p3_fenXianNum ;//当前分线号
bytePrt++;
*bytePrt = zrf_rcv_obj.p4_rcvCardsNumInNet ;//当前网线内接收卡总数
bytePrt++;
*bytePrt = zrf_rcv_obj.p5_netScreenIndex ; //当前网线所在屏号
bytePrt++;
*bytePrt = zrf_rcv_obj.p6_reserve ;//保留
bytePrt++;
*bytePrt = zrf_rcv_obj.p7_reserve1 ;//保留
bytePrt++;
memcpy(bytePrt,&zrf_rcv_obj.p8_st_rcv_pos[0],256-8);
}
else
{
int itemp=(flashPage&0x0F) -1;//flashpage 0x21~0x27,
memcpy(bytePrt,&zrf_rcv_obj.p8_st_rcv_pos[itemp * 32 + (256-8)/8],256);
}
//qDebug()<<"zrf_param_msg = "<<zrf_param_msg.toHex();
2023-09-01 16:17:33 +08:00
}
void ExpertWin::classToMiaoDianMsg(quint8 flashPage)
{
auto unitptr = (unsigned char *)zrf_param_msg.data();
unsigned char * bytePrt = (unsigned char*)(unitptr);
if(flashPage == 0x30)
{
memcpy(bytePrt,&zrf_rcv_obj.m_scanIndex , 64);
bytePrt += 64;
memcpy(bytePrt, &zrf_rcv_obj.m_pixelPos[0][0] , 256-64);
}
else
{
2023-09-05 10:02:20 +08:00
int itemp=(flashPage&0x0F) - 1;
int itemp2=((itemp*256)/2)+((256-64)/2);
memcpy(bytePrt, &zrf_rcv_obj.m_pixelPos[itemp2][0] , 256);
2023-09-01 16:17:33 +08:00
}
}
void ExpertWin::baseMsgToClass(quint8 * data)
{
2023-09-05 10:02:20 +08:00
zrf_rcv_obj.b0_7 = (data[st_zrf_base_param.b0_RP] & 0b10000000) >>7;//DAT信号 方式 0高有效共阴 1低有效共阳;
zrf_rcv_obj.b0_6 = (data[st_zrf_base_param.b0_RP] & 0b01000000) >>6;//STB信号有效方式 0正向 1反向;
zrf_rcv_obj.b0_5 = (data[st_zrf_base_param.b0_RP] & 0b00100000) >>5;//OE信号有效0 :低有 效1 :高有效;
zrf_rcv_obj.b0_4 = (data[st_zrf_base_param.b0_RP] & 0b00010000) >>4;//行有效方式0 低有效1 :高有效;
zrf_rcv_obj.b0_3_1 = (data[st_zrf_base_param.b0_RP] & 0b00001110) >>1;//行译码方式bit2~bit0与地址0x01 bit7~bit6 表示 bit4~bit3。0普通常规138译码00001SM526600010SM536601000:ICN201300100无译码00101595译码0110:5958译码01110ICND2018其他保留;
zrf_rcv_obj.b0_0 = (data[st_zrf_base_param.b0_RP] & 0b00000001) >>0;//0 :全色1 :单双色;
zrf_rcv_obj.b1_7_6 = (data[st_zrf_base_param.b1_xiaoyingTime] & 0b11000000)>>6; //行译码方式 bit4~bit3
zrf_rcv_obj.b1_5 = (data[st_zrf_base_param.b1_xiaoyingTime] & 0b00100000)>>5; //消影控制电平0高有效1低有效
zrf_rcv_obj.b1_4 = (data[st_zrf_base_param.b1_xiaoyingTime] & 0b00010000)>>4; //双卡备份0关闭1启用
zrf_rcv_obj.b1_3_2 = (data[st_zrf_base_param.b1_xiaoyingTime] & 0b00001100)>>2; //颜色深度00:8bit01:10bit10:12bit
zrf_rcv_obj.b1_1 = (data[st_zrf_base_param.b1_xiaoyingTime] & 0b00000010)>>1; //D信号扩展为第二时钟0关闭1启用
zrf_rcv_obj.b1_0 = (data[st_zrf_base_param.b1_xiaoyingTime] & 0b00000001)>>0; //上电渐亮0启用;1关闭
2023-09-01 16:17:33 +08:00
zrf_rcv_obj.b2 = data[st_zrf_base_param.b2_line_xytime]; //实际消影时间为:(输入值 * 2 + 1 * 48ns
zrf_rcv_obj.b3 = data[st_zrf_base_param.b3_rows1Group]; //一组数据控制模组的行数1~64其他无效
zrf_rcv_obj.b4 = data[st_zrf_base_param.b4_cols1Group]; //一组数据控制的模组列数1~128其他无效
zrf_rcv_obj.b5 = data[st_zrf_base_param.b5_scanNum]; //模组扫描方式1~64其他无效
zrf_rcv_obj.b6 = data[st_zrf_base_param.b6_emptyPointNum]; //模组每行空点数详见说明2
2023-09-05 10:02:20 +08:00
zrf_rcv_obj.b7_7_6 = (data[st_zrf_base_param.b7_colorIndex] & 0b11000000) >> 6; //输出数据线4,0001绿1011
zrf_rcv_obj.b7_5_4 = (data[st_zrf_base_param.b7_colorIndex] & 0b00110000) >> 4; //输出数据线3,0001绿1011
zrf_rcv_obj.b7_3_2 = (data[st_zrf_base_param.b7_colorIndex] & 0b00001100) >> 2; //输出数据线2,0001绿1011
zrf_rcv_obj.b7_1_0 = (data[st_zrf_base_param.b7_colorIndex] & 0b00000011) >> 0; //输出数据线1,0001绿1011
qDebug()<<"***zrf_rcv_obj.b7_7_6="<<zrf_rcv_obj.b7_7_6;
qDebug()<<"***zrf_rcv_obj.b7_5_4="<<zrf_rcv_obj.b7_5_4;
qDebug()<<"***zrf_rcv_obj.b7_3_2="<<zrf_rcv_obj.b7_3_2;
qDebug()<<"***zrf_rcv_obj.b7_1_0="<<zrf_rcv_obj.b7_1_0;
zrf_rcv_obj.b8_7 = (data[st_zrf_base_param.b8_dataOutModle] & 0b10000000)>>7; //多种描点数据 0关闭1启用
zrf_rcv_obj.b8_6 = (data[st_zrf_base_param.b8_dataOutModle] & 0b01000000)>>6; //扫描复用模式0行扫1列扫
zrf_rcv_obj.b8_5_4 = (data[st_zrf_base_param.b8_dataOutModle] & 0b00110000)>>4; //模组级联方向:00从右往左01从上往下10从左往右11从下往上
zrf_rcv_obj.b8_3_0 = (data[st_zrf_base_param.b8_dataOutModle] & 0b00001111)>>0; //数据输出模式0000标准16组并行数据输出0001增强20组并行数据输出0010增强24组并行数据输出0101串行16组数据输出0100串行32组数据输出0011串行 64 组数据输出0110增强32组并行数据输出0111串行 128 组数据1000串行 96 组数据1001~1111保留
2023-09-01 16:17:33 +08:00
zrf_rcv_obj.b9 = data[st_zrf_base_param.b9_brightStatic]; //静态亮度 0最暗ff最亮区别于帧同步包中的动态亮度
zrf_rcv_obj.b10 = data[st_zrf_base_param.b10_brightRed]; //红亮度0最暗ff最亮
zrf_rcv_obj.b11 = data[st_zrf_base_param.b11_brightGreen]; //绿亮度0最暗ff最亮
zrf_rcv_obj.b12 = data[st_zrf_base_param.b12_brightBlue]; //蓝亮度0最暗ff最亮
zrf_rcv_obj.b13 = data[st_zrf_base_param.b13_icType]; //模组驱动芯片类型选择: //0x00普通恒流芯片 0x0FICN2053 0x01MBI5042、MBI5041 0x10ICN2038S 0x02MY9268 0x11MBI5124 0x03MBI5050 0x12SM16017 0x04SD16749 0x13SM16207
//0x05SM16136 0x14SM16159 0x06APA101 0x15LS9929IP 0x07MY9266 0x16ICND2110 0x08MY9868 0x17LS9918IP 0x09MBI5052 0x18SM16237
//0x0ASUM2017 0x19SUM2028 0x0BMY9862 0x1ASUM2017TD 0x0CSUM2032 0x1BSM16259 0x0DMBI5153 0x1CICND2065/ICND2055; 0x1DSM16359 0x1ERT5965/RT5966;
//0x1FMBI5264 其他未定义
zrf_rcv_obj.b14 = data[st_zrf_base_param.b14_icParma]; //芯片辅助识别标志
zrf_rcv_obj.b15 = data[st_zrf_base_param.b15_redIgain]; //红电流增益 0最暗ff最亮
zrf_rcv_obj.b16 = data[st_zrf_base_param.b16_greenIgain]; //绿电流增益 0最暗ff最亮
zrf_rcv_obj.b17 = data[st_zrf_base_param.b17_blueIgain]; //蓝电流增益 0最暗ff最亮
2023-09-05 10:02:20 +08:00
zrf_rcv_obj.b18_7_4 = (data[st_zrf_base_param.b18_clkFreq] & 0b11110000)>>4; //保留
zrf_rcv_obj.b18_3_0 = (data[st_zrf_base_param.b18_clkFreq] & 0b00001111)>>0; //输出数据时钟频率选择031.25M 125M 220.83M 317.8M 415.625M 512.5M 610.4M 78.9M 87.8M 96.25M 105.2M 114.5M 123.9M 133.125M 141.9M 151M
zrf_rcv_obj.b19_7_4 = (data[st_zrf_base_param.b19_clkDutyCycle] & 0b11110000)>>4; //输出数据时钟相位00000 度; 0001- 90 度; 0010+90 度; 其他暂时保留;
zrf_rcv_obj.b19_3_0 = (data[st_zrf_base_param.b19_clkDutyCycle] & 0b00001111)>>0; //输出数据时钟占空比000050% 000125% 001075% 其他暂时保留;
2023-09-01 16:17:33 +08:00
zrf_rcv_obj.b20 = data[st_zrf_base_param.b20_pwmIcGrayClk]; //PWM 类智能芯片的灰度时钟周期设定MBI5042 芯片,软件计算; MY9268MBI5050用户设定设定有效值范围 4~128 其他不支持;
2023-09-05 10:02:20 +08:00
zrf_rcv_obj.b21_7_5 = (data[st_zrf_base_param.b21_grayLevelMultFreq] & 0b11100000)>>5; //输出数据时钟相位00000 度; 0001- 90 度; 0010+90 度; 其他暂时保留;
zrf_rcv_obj.b21_4_0 = (data[st_zrf_base_param.b21_grayLevelMultFreq] & 0b00011111)>>0; //输出数据时钟占空比000050% 000125% 001075% 其他暂时保留;
zrf_rcv_obj.b22_7_6 = (data[st_zrf_base_param.b22_MultFreqMode] & 0b11000000)>>6; //倍频模式00无倍频01VPWM10VPWM211VPWM3
zrf_rcv_obj.b22_5_2 = (data[st_zrf_base_param.b22_MultFreqMode] & 0b00111100)>>2; //补偿等级暂未定义0000~1111
zrf_rcv_obj.b22_1_0 = (data[st_zrf_base_param.b22_MultFreqMode] & 0b00000010)>>0; //低辉补偿00普通模式, 01合并补偿, 10累加补偿
2023-09-01 16:17:33 +08:00
zrf_rcv_obj.b23 = data[st_zrf_base_param.b23_reserve]; //保留
2023-09-05 10:02:20 +08:00
zrf_rcv_obj.b24_7_5 = (data[st_zrf_base_param.b24_freshRate] & 0b11100000)>>5; //图像帧频率00060Hz00150Hz01075Hz01130Hz100120Hz其他保留
zrf_rcv_obj.b24_4_0 = (data[st_zrf_base_param.b24_freshRate] & 0b00011111)>>0; //画面刷新频率 ,高 5bit
2023-09-01 16:17:33 +08:00
zrf_rcv_obj.b25 = data[st_zrf_base_param.b24_freshRate + 1]; //画面刷新频率 ,低 8bit
2023-09-05 10:02:20 +08:00
zrf_rcv_obj.b26_7 = (data[st_zrf_base_param.b26_syncGraphicsCard] & 0b10000000)>>7; //0与显卡同步1不同步
zrf_rcv_obj.b26_6 = (data[st_zrf_base_param.b26_syncGraphicsCard] & 0b01000000)>>6; //低于 120hz时该位置1选择为行外扫描灰度
zrf_rcv_obj.b26_5_0 = (data[st_zrf_base_param.b26_syncGraphicsCard] & 0b00111111)>>0; //显卡同步时,帧频倍数
2023-09-01 16:17:33 +08:00
memcpy(&zrf_rcv_obj.b27_28[0],&data[st_zrf_base_param.b27_Ldq],2); //非 5030/5042 时ldq 值 = 166M/场频/扫描方式/遍数, 此数据必须小于 65535当帧频不准时利用微调选项调整
//5030/5042 时ldq 值 = 166M/场频/扫描方式/19/遍数, 此数据必须小于 65535,此处遍数为4096 级时:5 8192 级时:9 16384级时:17 此值最小为 485.
//Ldq_vpwm普通芯片的普通模式和 PWM 芯片与 ldq 一致,普通芯片的 VPWM 模式下,对遍数进行了修正(4096-38 遍8192-39 遍16384-134 遍);
//Ldq_vpwm2方式时即普通芯片的VPWM灰度优先模式下对遍数进行了修正(4096-58 遍8192-59 遍16384-116 遍32768-117 遍65536-118 遍);
//MY9268、MBI5050 时:画面刷新率/60Hz注意同步刷新时数据源的帧频率需要考虑是 60Hz还是50Hz还是 75Hz低字节在前
2023-09-05 10:02:20 +08:00
zrf_rcv_obj.b29_7_4 = (data[st_zrf_base_param.b29_reserve] & 0b11110000)>>4; //0与显卡同步1不同步
zrf_rcv_obj.b29_3_2 = (data[st_zrf_base_param.b29_reserve] & 0b00001100)>>2; //低于 120hz时该位置1选择为行外扫描灰度
zrf_rcv_obj.b29_1_0 = (data[st_zrf_base_param.b29_reserve] & 0b00000011)>>0; //显卡同步时,帧频倍数
2023-09-01 16:17:33 +08:00
zrf_rcv_obj.b30 = data[st_zrf_base_param.b30_pwmMultFreq]; //DPWM 芯片刷新倍频数 ICND2055/ICND2065 刷新倍频数 b7~b0
zrf_rcv_obj.b31 = data[st_zrf_base_param.b31_rcvCardCols]; //接收卡带载列数低字节
zrf_rcv_obj.b32 = data[st_zrf_base_param.b31_rcvCardCols + 1]; //接收卡带载列数高字节
2023-09-05 10:02:20 +08:00
zrf_rcv_obj.b33_7_4 = (data[st_zrf_base_param.b33_emptyRowMode] & 0b11110000)>>4; //偶数图像区空行4bit
zrf_rcv_obj.b33_3_0 = (data[st_zrf_base_param.b33_emptyRowMode] & 0b00001111)>>0; //奇数图像区空行 4bit
zrf_rcv_obj.b34_7_4 = (data[st_zrf_base_param.b34_emptyRowPos] & 0b11110000)>>4; //1~14 表示第1到15组数据0 保留15 表示所有数据组都有空行
zrf_rcv_obj.b34_3_0 = (data[st_zrf_base_param.b34_emptyRowPos] & 0b00001111)>>0; //1~15表示1到15组数据0 保留
2023-09-01 16:17:33 +08:00
zrf_rcv_obj.b35 = data[st_zrf_base_param.b35_xiaoYingEndTime]; //消隐控制结束时刻
2023-09-05 10:02:20 +08:00
zrf_rcv_obj.b36_7_6 = (data[st_zrf_base_param.b36_RowIcParam] & 0b11000000)>>6; //保留
zrf_rcv_obj.b36_5_0 = (data[st_zrf_base_param.b36_RowIcParam] & 0b00111111)>>0; //详见说明3
zrf_rcv_obj.b37_7_5 = (data[st_zrf_base_param.b37_reserve] & 0b11100000)>>5; //保留
zrf_rcv_obj.b37_4_3 = (data[st_zrf_base_param.b37_reserve] & 0b00011000)>>3; //端口内空数据通道数
zrf_rcv_obj.b37_2 = (data[st_zrf_base_param.b37_reserve] & 0b00000100)>>2; //UD口交换
zrf_rcv_obj.b37_1 = (data[st_zrf_base_param.b37_reserve] & 0b00000010)>>1; //逆序
zrf_rcv_obj.b37_0 = (data[st_zrf_base_param.b37_reserve] & 0b00000001)>>0; //奇偶交换
2023-09-01 16:17:33 +08:00
memcpy(&zrf_rcv_obj.b38_69[0],&data[st_zrf_base_param.b38_hub1to32Area],32);//端口1~31输出图像区
2023-09-05 10:02:20 +08:00
zrf_rcv_obj.b70_7 = (data[st_zrf_base_param.b70_reserve] & 0b10000000)>>7; //空行模式 0关闭 1打开
zrf_rcv_obj.b70_6 = (data[st_zrf_base_param.b70_reserve] & 0b01000000)>>6; //对折偏移 0关闭 1打开
zrf_rcv_obj.b70_5_2 = (data[st_zrf_base_param.b70_reserve] & 0b00111100)>>2; //对折模式: 0正常模式 1两折 2镜像对折 3:3折 4:4折 5:5折 6:6折 7:8折其他保留
zrf_rcv_obj.b70_1 = (data[st_zrf_base_param.b70_reserve] & 0b00000010)>>1; //空列模式: 0禁止 1允许
zrf_rcv_obj.b70_0 = (data[st_zrf_base_param.b70_reserve] & 0b00000001)>>0; //bit0 图像区偏移: 0菱形偏移模式 1梯形 偏移模式
2023-09-01 16:17:33 +08:00
for(int i=0;i<32;i++)
memcpy(&zrf_rcv_obj.b71_166[i][0],&data[st_zrf_base_param.b71_imgArea1to32Param+i*3],3);
zrf_rcv_obj.b167 = data[st_zrf_base_param.b167_syncPreTime]; //同步预留时间
2023-09-05 10:02:20 +08:00
zrf_rcv_obj.b168_7_5 = (data[st_zrf_base_param.b168_reserve] & 0b11100000)>>5; //保留
zrf_rcv_obj.b168_4_0 = (data[st_zrf_base_param.b168_reserve] & 0b00011111)>>0; //消隐延迟时间:(输入值+1*48ns
2023-09-01 16:17:33 +08:00
memcpy((qint8*)&zrf_rcv_obj.b169_192[0], &data[st_zrf_base_param.b169_redIcParam1],24);
2023-09-05 10:02:20 +08:00
SetEffectControlerValueByClass();
2023-09-01 16:17:33 +08:00
}
void ExpertWin::gammaMsgToClass(quint8 * data,quint8 flashPage)
{
if(flashPage == 0x10)
{
2023-09-05 10:02:20 +08:00
for(int i=0;i<128;i++){
zrf_rcv_obj.g_all[i] = (data[i*2]<<8) | (data[i*2+1]);
zrf_rcv_obj.g_red[i] = (data[i*2]<<8) | (data[i*2+1]);
zrf_rcv_obj.g_green[i] = (data[i*2]<<8) | (data[i*2+1]);
zrf_rcv_obj.g_blue[i] = (data[i*2]<<8) | (data[i*2+1]);
}
2023-09-01 16:17:33 +08:00
}
else if(flashPage == 0x11)
{
2023-09-05 10:02:20 +08:00
for(int i=0;i<128;i++){
zrf_rcv_obj.g_all[128+i] = (data[i*2]<<8) | (data[i*2+1]);
zrf_rcv_obj.g_red[128+i] = (data[i*2]<<8) | (data[i*2+1]);
zrf_rcv_obj.g_green[128+i] = (data[i*2]<<8) | (data[i*2+1]);
zrf_rcv_obj.g_blue[128+i] = (data[i*2]<<8) | (data[i*2+1]);
}
2023-09-01 16:17:33 +08:00
}
}
2023-09-05 10:02:20 +08:00
void ExpertWin::paiXuMsgToClass(quint8 * data,quint8 flashPage)
2023-09-01 16:17:33 +08:00
{
if(flashPage == 0x20)//flashpage 0x20
{
zrf_rcv_obj.p0_cardIndexInNet = data[0];//当前卡在网线内的序号
zrf_rcv_obj.p1_SendCardCode = data[1];//当前网线所在的发送卡编号
zrf_rcv_obj.p2_netIndexInSendCard = data[2];//当前网线所在发送卡输出口编号
zrf_rcv_obj.p3_fenXianNum = data[3];//当前分线号
zrf_rcv_obj.p4_rcvCardsNumInNet = data[4];//当前网线内接收卡总数
zrf_rcv_obj.p5_netScreenIndex = data[5]; //当前网线所在屏号
zrf_rcv_obj.p6_reserve = data[6];//保留
zrf_rcv_obj.p7_reserve1 = data[7];//保留
memcpy(&zrf_rcv_obj.p8_st_rcv_pos[0],&data[8],256-8);
}
else
{
2023-09-05 10:02:20 +08:00
int itemp=(flashPage&0x0F) - 1;//flashpage 0x21~0x27,
2023-09-01 16:17:33 +08:00
memcpy(&zrf_rcv_obj.p8_st_rcv_pos[itemp*32+(256-8)/8],&data[0],256);
2023-09-05 10:02:20 +08:00
if(flashPage == 0x27)
{
for(int i=0;i<256;i++)
{
zrf_rcv_obj.p_x[i] = (zrf_rcv_obj.p8_st_rcv_pos[i].imgXH4_YH4&0xF0)<<4 | zrf_rcv_obj.p8_st_rcv_pos[i].imgXL8;
zrf_rcv_obj.p_y[i] = (zrf_rcv_obj.p8_st_rcv_pos[i].imgXH4_YH4&0x0F)<<8 | zrf_rcv_obj.p8_st_rcv_pos[i].imgYL8;
zrf_rcv_obj.p_w[i] = (zrf_rcv_obj.p8_st_rcv_pos[i].imgWidthH4_HeightH4&0xF0)<<4 | zrf_rcv_obj.p8_st_rcv_pos[i].imgWidthL8;
zrf_rcv_obj.p_h[i] = (zrf_rcv_obj.p8_st_rcv_pos[i].imgWidthH4_HeightH4&0x0F)<<8 | zrf_rcv_obj.p8_st_rcv_pos[i].imgHeightL8;
zrf_rcv_obj.p_posNum[i] = zrf_rcv_obj.p8_st_rcv_pos[i].imgPosNumInScreenH8<<8 | zrf_rcv_obj.p8_st_rcv_pos[i].imgPosNumInScreenL8;
}
2023-09-01 16:17:33 +08:00
2023-09-05 10:02:20 +08:00
}
2023-09-01 16:17:33 +08:00
}
2023-09-05 10:02:20 +08:00
}
void ExpertWin::miaoDianMsgToClass(quint8 * data, quint8 flashPage)
{
if(flashPage == 0x30)//flashpage 0x30
{
memcpy(&zrf_rcv_obj.m_scanIndex , data , 64);
memcpy(&zrf_rcv_obj.m_pixelPos[0][0] , &data[64] , 256-64);
2023-09-01 16:17:33 +08:00
}
else
{
2023-09-05 10:02:20 +08:00
int itemp=(flashPage&0x0F) - 1;//flashpage 0x31~0x3f,
memcpy(&zrf_rcv_obj.m_pixelPos[itemp*128+(256-64)/2],&data[0],256);
}
}
//added by alahover -o 20230829
//added by alahover -s 20230830
void ExpertWin::changeValueBySmart()
{
int iGroupNum=mModule["GroupNum"].toInt();
if(iGroupNum!=0)
zrf_rcv_obj.b3 = mModule["ModuleHeight"].toInt()/iGroupNum;
else
QMessageBox::information(this, tr("提示"), tr("模组内组数不能为0"));
zrf_rcv_obj.b4 = mModule["ModuleWidth"].toInt();
zrf_rcv_obj.b5 = mModule["ScanNum"].toInt();
zrf_rcv_obj.b13 = GetIcTypeIndexFromName(mModule["ChipType"].toStr());
quint8 uiRowYiMa=GetRowYiMaIndexFromName(mModule["DecodeMode"].toStr());
zrf_rcv_obj.b0_3_1=uiRowYiMa&0b00000111;
zrf_rcv_obj.b1_7_6=(uiRowYiMa&0b00011000) >> 3;
if(mModule["DataPolarity"].toBool())
zrf_rcv_obj.b0_7 = 0;
else
zrf_rcv_obj.b0_7 = 1;
if(mModule["OePolarity"].toBool())
zrf_rcv_obj.b0_5 = 0;
else
zrf_rcv_obj.b0_5 = 1;
//颜色
quint8 ColorMap=mModule["ColorMap"].toInt();
int iLine_1=(ColorMap & 0b11000000) >> 6;
int iLine_2=(ColorMap & 0b00110000) >> 4;
int iLine_3=(ColorMap & 0b00001100) >> 2;
int iLine_4=(ColorMap & 0b00000011) >> 0;
switch(iLine_1) {
case 0b00://黑色
zrf_rcv_obj.b7_1_0=0b11; break;
case 0b01:
zrf_rcv_obj.b7_1_0=0b00; break;
case 0b10:
zrf_rcv_obj.b7_1_0=0b01; break;
case 0b11:
zrf_rcv_obj.b7_1_0=0b10; break;
}
switch(iLine_2) {
case 0b00://黑色
zrf_rcv_obj.b7_3_2=0b11; break;
case 0b01:
zrf_rcv_obj.b7_3_2=0b00; break;
case 0b10:
zrf_rcv_obj.b7_3_2=0b01; break;
case 0b11:
zrf_rcv_obj.b7_3_2=0b10; break;
}
switch(iLine_3) {
case 0b00://黑色
zrf_rcv_obj.b7_5_4=0b11; break;
case 0b01:
zrf_rcv_obj.b7_5_4=0b00; break;
case 0b10:
zrf_rcv_obj.b7_5_4=0b01; break;
case 0b11:
zrf_rcv_obj.b7_5_4=0b10; break;
}
switch(iLine_4) {
case 0b00://黑色
zrf_rcv_obj.b7_7_6=0b11; break;
case 0b01:
zrf_rcv_obj.b7_7_6=0b00; break;
case 0b10:
zrf_rcv_obj.b7_7_6=0b01; break;
case 0b11:
zrf_rcv_obj.b7_7_6=0b10; break;
}
//alahover ?
if(mModule["GroupMode"].toStr()==tr("三线并行"))
zrf_rcv_obj.b8_3_0=0b0110;
else
zrf_rcv_obj.b8_3_0=0b0111;
zrf_rcv_obj.b8_3_0=0b0111;
zrf_rcv_obj.ucZheHuiCiShu=mModule["RowPerScan"].toInt();
//描点参数
int iScanIndex=0;
auto scans = mModule["RowMap"].toArray();
for(auto scan : scans) {
zrf_rcv_obj.m_scanIndex[iScanIndex]=scan.toInt();
iScanIndex++;
}
auto points = mModule["ColumnMap"].toArray();
int iPointIndex=0;
for(auto point : points) {
zrf_rcv_obj.m_pixelPos[iPointIndex][0]=point.toInt() & 0x000000ff;//列
zrf_rcv_obj.m_pixelPos[iPointIndex][1]=(point.toInt() & 0x0000ff00) >>8;//行
iPointIndex++;
}
}
int ExpertWin::GetIcTypeIndexFromName(QString strName)
{
auto file = QApplication::applicationDirPath()+"/driver.ic";
QFile qFile(file);
if(qFile.open(QFile::ReadOnly)) {
auto data = qFile.readAll();
qFile.close();
auto json = JFrom(data).toObj();
if(! json.empty())
2023-09-01 16:17:33 +08:00
{
2023-09-05 10:02:20 +08:00
if(!json[strName].isNull()){
return json[strName].toInt();
}
else{
QMessageBox::information(this, tr("提示"), tr("未能识别的驱动IC类型"));
return -1;
}
}
else{
QMessageBox::information(this, tr("提示"), tr("未能识别的驱动IC类型"));
return -1;
2023-09-01 16:17:33 +08:00
}
}
2023-09-05 10:02:20 +08:00
QMessageBox::information(this, tr("提示"), tr("缺失driver.ic配置文件"));
return -1;
2023-09-01 16:17:33 +08:00
}
2023-09-05 10:02:20 +08:00
int ExpertWin::GetRowYiMaIndexFromName(QString strName)
2023-09-01 16:17:33 +08:00
{
2023-09-05 10:02:20 +08:00
auto file = QApplication::applicationDirPath()+"/decoder.ic";
QFile qFile(file);
if(qFile.open(QFile::ReadOnly)) {
auto data = qFile.readAll();
qFile.close();
auto json = JFrom(data).toObj();
if(! json.empty())
{
if(!json[strName].isNull()){
return json[strName].toInt();
}
else{
QMessageBox::information(this, tr("提示"), tr("未能识别的行译码IC类型"));
return -1;
}
}
else{
QMessageBox::information(this, tr("提示"), tr("未能识别的行译码IC类型"));
return -1;
}
}
QMessageBox::information(this, tr("提示"), tr("缺失driver.ic配置文件"));
return -1;
}
void ExpertWin::changeValueByEffectControler() {
//spinbox
if(m_iRcvCardType!=enum_zrf) return;
QObject::connect(fdCardWidth, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](int value){ qDebug() << "箱体宽度当前值:" << value;
zrf_rcv_obj.b31=value&0x00ff; zrf_rcv_obj.b32=(value&0xff00) >> 8; });//
QObject::connect(spinGclkXw, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](int value){ qDebug() << "GCLK相位当前值" << value;
zrf_rcv_obj.b193=value; });
QObject::connect(spinGclkZkb, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](int value){ qDebug() << "GCLK占空比当前值" << value;
zrf_rcv_obj.b193=value; });
QObject::connect(spinLineNs, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](int value){ qDebug() << "换行时间当前值:" << value;
zrf_rcv_obj.b193=value; });
QObject::connect(spinLineWz, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](int value){ qDebug() << "行位置当前值:" << value;
zrf_rcv_obj.b193=value; });
QObject::connect(spinLineXy, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](int value){ qDebug() << "消隐时间当前值:" << value;
zrf_rcv_obj.b2=value; });//
QObject::connect(spinPointsOnePort, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](int value){ qDebug() << "单口带载点数当前值:" << value;
zrf_rcv_obj.b193=value; });
//combox
QObject::connect(cbDCLKf, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "DLC频率当前值" << value;
zrf_rcv_obj.b18_3_0=value; });//
QObject::connect(cbDclkXw, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "DCLK相位当前值" << value;
zrf_rcv_obj.b19_7_4=value; });//
QObject::connect(cbDclkZkb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "DCLK占空比当前值" << value;
zrf_rcv_obj.b19_3_0=value; });//
QObject::connect(fdDirection, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "模组级联方向出当前值:" << value;
zrf_rcv_obj.b8_5_4=value; });//
QObject::connect(fdSectorCount, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "多开设置出当前值:" << value;
zrf_rcv_obj.b70_5_2=value;
if(zrf_rcv_obj.b70_5_2!=0)
zrf_rcv_obj.b70_6=1;
else zrf_rcv_obj.b70_6=0; });//
QObject::connect(freshBeiLv, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "刷新倍率出当前值:" << value;
zrf_rcv_obj.b21_7_5=value; });//
QObject::connect(cbGCLKf, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "GCLK周期出当前值" << value;
zrf_rcv_obj.b193=value; });
QObject::connect(cbGryLevel, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "灰度等级出当前值:" << value;
if(zrf_rcv_obj.m_pwmFlag==1){
switch(value){
case 0: zrf_rcv_obj.b21_4_0=23; break;//正常4096
case 1: zrf_rcv_obj.b21_4_0=26; break;//正常8192
case 2: zrf_rcv_obj.b21_4_0=29; break;//正常16384
case 3: zrf_rcv_obj.b21_4_0=30; break;//正常32768
case 4: zrf_rcv_obj.b21_4_0=31; break;//正常65535
default: zrf_rcv_obj.b21_4_0=31; break;//正常65535
}
2023-09-01 16:17:33 +08:00
2023-09-05 10:02:20 +08:00
}
else
zrf_rcv_obj.b21_4_0=value; });//
QObject::connect(cbNoSign, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "无信号输出出当前值:" << value;
zrf_rcv_obj.b29_1_0=value; });//
QObject::connect(cbStb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "行信号STB微调出当前值" << value;
zrf_rcv_obj.b193=value; });
QObject::connect(cbDE, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "行信号DE微调出当前值" << value;
zrf_rcv_obj.b193=value; });
QObject::connect(cbABC, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "行信号ABC微调出当前值" << value;
zrf_rcv_obj.b193=value; });
QObject::connect(cbXiaoYinDianPing, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "消隐电平出当前值:" << value;
zrf_rcv_obj.b1_5=value; });//
QObject::connect(cbSTB, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "锁存STB电平方向出当前值" << value;
zrf_rcv_obj.b0_6=value; });//
QObject::connect(cbSRowOut, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=](int value){ qDebug() << "行输出电平出当前值:" << value;
zrf_rcv_obj.b0_4=value; });//
//checkbox
QObject::connect(checkSyncXianKa, static_cast<void (QCheckBox::*)(int)>(&QCheckBox::stateChanged), [=](int value){ qDebug() << "同步显卡出当前值:" << value;
if(value==0) zrf_rcv_obj.b26_7=value ;
else zrf_rcv_obj.b26_7=0b1; });//
QObject::connect(checkJianLiang, static_cast<void (QCheckBox::*)(int)>(&QCheckBox::stateChanged), [=](int value){ qDebug() << "开屏渐亮出当前值:" << value;
if(value==0) zrf_rcv_obj.b1_0=value ;
else zrf_rcv_obj.b1_0=0b1; });//
QObject::connect(checkDoubleCopy, static_cast<void (QCheckBox::*)(int)>(&QCheckBox::stateChanged), [=](int value){ qDebug() << "双备份出当前值:" << value;
if(value==0) zrf_rcv_obj.b1_4=value ;
else zrf_rcv_obj.b1_4=0b1; });//
QObject::connect(checkDsignalAsCLk, static_cast<void (QCheckBox::*)(int)>(&QCheckBox::stateChanged), [=](int value){ qDebug() << "D信号作为第二组CLK出当前值" << value;
if(value==0) zrf_rcv_obj.b1_1=value ;
else zrf_rcv_obj.b1_1=0b1; });//
}
void ExpertWin::SetEffectControlerValueByClass()
{
//spinbox
fdCardWidth->setValue(( zrf_rcv_obj.b32<<8)|zrf_rcv_obj.b31); qDebug() << "箱体宽度当前值:" << fdCardWidth->value();//
spinGclkXw->setValue(zrf_rcv_obj.b193); qDebug() << "GCLK相位当前值" << spinGclkXw->value();
spinGclkZkb->setValue(zrf_rcv_obj.b193); qDebug() << "GCLK占空比当前值" << spinGclkZkb->value();
spinLineNs->setValue(zrf_rcv_obj.b193); qDebug() << "换行时间当前值:" << spinLineNs->value();
spinLineWz->setValue(zrf_rcv_obj.b193); qDebug() << "行位置当前值:" << spinLineWz->value();
spinLineXy->setValue(zrf_rcv_obj.b2); qDebug() << "消隐时间当前值:" << spinLineXy->value();//
spinPointsOnePort->setValue(zrf_rcv_obj.b193); qDebug() << "单口带载点数当前值:" << spinPointsOnePort->value();
//combox
cbDCLKf->setCurrentIndex(zrf_rcv_obj.b18_3_0); qDebug() << "DLC频率当前值" << cbDCLKf->currentIndex();
cbDclkXw->setCurrentIndex(zrf_rcv_obj.b19_7_4); qDebug() << "DCLK相位当前值" << cbDclkXw->currentIndex();
cbDclkZkb->setCurrentIndex(zrf_rcv_obj.b19_3_0); qDebug() << "DCLK占空比当前值" << cbDclkZkb->currentIndex();
fdDirection->setCurrentIndex(zrf_rcv_obj.b8_5_4); qDebug() << "模组级联方向出当前值:" << fdDirection->currentIndex();
fdSectorCount->setCurrentIndex(zrf_rcv_obj.b70_5_2); qDebug() << "多开设置出当前值:" << fdSectorCount->currentIndex();
freshBeiLv->setCurrentIndex(zrf_rcv_obj.b21_7_5); qDebug() << "刷新倍率出当前值:" << freshBeiLv->currentIndex();
cbGCLKf->setCurrentIndex(zrf_rcv_obj.b193); qDebug() << "GCLK周期出当前值" << cbGCLKf->currentIndex();
int index=31;
if(zrf_rcv_obj.m_pwmFlag==1)
switch(zrf_rcv_obj.b21_4_0){
case 23: index=0; break;//正常4096
case 26: index=1; break;//正常8192
case 29: index=2; break;//正常16384
case 30: index=3; break;//正常32768
case 31: index=4; break;//正常65535
default: index=4; break;//正常65535
}
else
index=zrf_rcv_obj.b21_4_0;
cbGryLevel->setCurrentIndex(index); qDebug() << "灰度等级出当前值:" << cbGryLevel->currentIndex();
cbNoSign->setCurrentIndex(zrf_rcv_obj.b29_1_0); qDebug() << "无信号输出出当前值:" << cbNoSign->currentIndex();
cbStb->setCurrentIndex(zrf_rcv_obj.b193); qDebug() << "行信号STB微调出当前值" << cbStb->currentIndex();
cbDE->setCurrentIndex(zrf_rcv_obj.b193); qDebug() << "行信号DE微调出当前值" << cbDE->currentIndex();
cbABC->setCurrentIndex(zrf_rcv_obj.b193); qDebug() << "行信号ABC微调出当前值" << cbABC->currentIndex();
cbXiaoYinDianPing->setCurrentIndex(zrf_rcv_obj.b1_5); qDebug() << "消隐电平出当前值:" << cbXiaoYinDianPing->currentIndex();
cbSTB->setCurrentIndex(zrf_rcv_obj.b0_6); qDebug() << "锁存STB电平方向出当前值" << cbSTB->currentIndex();
cbSRowOut->setCurrentIndex(zrf_rcv_obj.b0_4); qDebug() << "行输出电平出当前值:" << cbSRowOut->currentIndex();
//checkbox
checkSyncXianKa->setChecked(zrf_rcv_obj.b26_7); qDebug() << "同步显卡出当前值:" << checkSyncXianKa->isChecked();
checkJianLiang->setChecked(zrf_rcv_obj.b1_0); qDebug() << "开屏渐亮出当前值:" << checkJianLiang->isChecked();
checkDoubleCopy->setChecked(zrf_rcv_obj.b1_4); qDebug() << "双备份出当前值:" << checkDoubleCopy->isChecked();
checkDsignalAsCLk->setChecked(zrf_rcv_obj.b1_1); qDebug() << "D信号作为第二组CLK出当前值" << checkDsignalAsCLk->isChecked();
if(m_iRcvCardType == enum_zrf) {
//发送基本参数
auto zrf_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 ff ff 00 f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 00 00 00");
auto zrf_cmd_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 e0 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00");
int res1=0;
//发送基本参数
MACRO_FUNC_SEND_PARAM("读取基本参数",classToBaseMsg(),1,0x00)
}
2023-09-01 16:17:33 +08:00
}
2023-09-05 10:02:20 +08:00
//added by alahover -o 20230830