From 66066db0690145e390a3f536fbeef9e96a5f442b Mon Sep 17 00:00:00 2001 From: Gangphon Date: Fri, 1 Sep 2023 16:17:33 +0800 Subject: [PATCH] ledset --- ledset/expertboxlayoutwin.h | 10 +- ledset/expertsmartpointsetwin.cpp | 70 ++-- ledset/expertwin.cpp | 605 +++++++++++++++++++++++------- ledset/expertwin.h | 95 +++-- ledset/globalfunc.cpp | 3 + ledset/globalfunc.h | 126 +++++-- ledset/mainwin.cpp | 36 +- ledset/pcaprethread.cpp | 32 +- ledset/pcaprethread.h | 4 +- 9 files changed, 745 insertions(+), 236 deletions(-) diff --git a/ledset/expertboxlayoutwin.h b/ledset/expertboxlayoutwin.h index e631c96..b19d988 100644 --- a/ledset/expertboxlayoutwin.h +++ b/ledset/expertboxlayoutwin.h @@ -56,15 +56,17 @@ protected: class ModuleUnit : public QWidget { Q_OBJECT public: - explicit ModuleUnit(int, int, int, int, const JObj &module, const QString &name, QWidget *parent = nullptr); + explicit ModuleUnit(int, int, int, int, const JObj &module, const QString &name, QWidget *parent = 0); void drawed(); + BoxPanel *box; + QPoint mPressRel{INT_MIN, INT_MIN}; int mX, mY, mW, mH; JObj mModule; QString name; - QPoint mPressRel{INT_MIN, INT_MIN}; - BoxPanel *box; - bool isSel{false}; + bool isSel = false; + bool isVerticalMirror = false; + bool isHorizonMirror = false; protected: void mousePressEvent(QMouseEvent *) override; void mouseReleaseEvent(QMouseEvent *) override; diff --git a/ledset/expertsmartpointsetwin.cpp b/ledset/expertsmartpointsetwin.cpp index 370eb9d..525999e 100644 --- a/ledset/expertsmartpointsetwin.cpp +++ b/ledset/expertsmartpointsetwin.cpp @@ -18,43 +18,43 @@ #include struct ModUnitMap { - byte UUID{ie(16)}; - byte type{ipp(4)}; - byte len{ipp(4)}; - byte w{ipp(2)}; - byte h{ipp(2)}; - byte ex1{ipp(4)}; - byte chipType{ipp(2)}; - byte decodeMode{ipp(2)}; - byte ex3{ipp(4)}; - byte smartset{ipp(4)}; - byte smartsetRes{ipp(4)}; - byte 走点len{ipp(4)}; - byte endFlag{ipp(4)}; - byte end{fi}; + byte UUID = ie(16); + byte type = ipp(4); + byte len = ipp(4); + byte w = ipp(2); + byte h = ipp(2); + byte ex1 = ipp(4); + byte chipType = ipp(2); + byte decodeMode = ipp(2); + byte ex3 = ipp(4); + byte smartset = ipp(4); + byte smartsetRes = ipp(4); + byte 走点len = ipp(4); + byte endFlag = ipp(4); + byte end = fi; } modUnitMap; struct ModMap { - byte start{ie(4)}; - byte 保留{ipp(2)}; - byte len{ipp(2)}; - byte 换行时间{ipp(2)}; - byte 换行时刻{ipp(2)}; - byte 最小OE宽度{ipp(2)}; - byte 放电时间{ipp(2)}; - byte GLK占空比{fi++}; - byte 灰度等级{fi++}; - byte 数据时钟相位向后偏{fi++}; - byte 数据时钟相位向前偏{fi++}; - byte 时钟分频系数{fi++}; - byte 倍频数{fi++}; - byte 帧率{fi++}; - byte 校正类型{fi++}; - byte 芯片通道数{ipp(3)}; - byte 模组类型数目{ipp()}; - byte Unit{ipp(modUnitMap.end)}; - byte 保留2{ipp(4)}; - byte check{ipp(4)}; - byte end{fi}; + byte start = ie(4); + byte 保留 = ipp(2); + byte len = ipp(2); + byte 换行时间 = ipp(2); + byte 换行时刻 = ipp(2); + byte 最小OE宽度 = ipp(2); + byte 放电时间 = ipp(2); + byte GLK占空比 = fi++; + byte 灰度等级 = fi++; + byte 数据时钟相位向后偏 = fi++; + byte 数据时钟相位向前偏 = fi++; + byte 时钟分频系数 = fi++; + byte 倍频数 = fi++; + byte 帧率 = fi++; + byte 校正类型 = fi++; + byte 芯片通道数 = ipp(3); + byte 模组类型数目 = ipp(); + byte Unit = ipp(modUnitMap.end); + byte 保留2 = ipp(4); + byte check = ipp(4); + byte end = fi; } modMap; ExpertSmartPointSetWin::ExpertSmartPointSetWin(ExpertWin *expertWin) : BaseWin{expertWin}, expertWin(expertWin) { diff --git a/ledset/expertwin.cpp b/ledset/expertwin.cpp index 3922223..d34e9ad 100644 --- a/ledset/expertwin.cpp +++ b/ledset/expertwin.cpp @@ -20,130 +20,14 @@ #include #include -//added by alahover -s 20230817 -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 aa ff ff 00 11 11 11 11 00 00 00 00 00 00 00 00 00 00 00 00" - "00 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 ");//297 -void ExpertWin::claseToStruct() { - zrfBaseParam.b0 = (zrfBaseParam.b0_7 << 7 & 0b10000000)| (zrfBaseParam.b0_6 << 6 & 0b01000000)| (zrfBaseParam.b0_5 << 5 & 0b00100000)| (zrfBaseParam.b0_4 << 4 & 0b00010000)| (zrfBaseParam.b0_3_1 << 1 & 0b00001110) | (zrfBaseParam.b0_0 & 0b00000001); - auto unitptr = zrf_msg.data(); - unsigned char * bytePrt = (unsigned char*)(unitptr); - *bytePrt=zrfBaseParam.b0; - bytePrt ++; - zrfBaseParam.b1 = (zrfBaseParam.b1_7_6<< 6 & 0b11000000) | (zrfBaseParam.b1_5<<5 & 0b00100000) | (zrfBaseParam.b1_4<<4 & 0b00010000) | (zrfBaseParam.b1_3_2<<2 & 0b00001100) | (zrfBaseParam.b1_1<<1 & 0b00000010) |(zrfBaseParam.b1_0&0b00000001); - *bytePrt=zrfBaseParam.b1; - bytePrt ++; - *bytePrt=zrfBaseParam.b2; - bytePrt ++; - *bytePrt=zrfBaseParam.b3; - bytePrt ++; - *bytePrt=zrfBaseParam.b4; - bytePrt ++; - *bytePrt=zrfBaseParam.b5; - bytePrt ++; - *bytePrt=zrfBaseParam.b6; - bytePrt ++; - zrfBaseParam.b7 = (zrfBaseParam.b7_7_6 << 6 & 0b11000000) | (zrfBaseParam.b7_5_4<<4 & 0b00110000) | (zrfBaseParam.b7_3_2 << 2 & 0b00001100) | (zrfBaseParam.b7_1_0 & 0b00000011) ; - *bytePrt=zrfBaseParam.b7; - bytePrt ++; - zrfBaseParam.b8 = (zrfBaseParam.b8_7<<7 &0b10000000) | (zrfBaseParam.b8_6<<6 & 0b01000000) | (zrfBaseParam.b8_5_4<<4 & 0b00110000) | (zrfBaseParam.b8_3_0 & 0b00001111) ; - *bytePrt=zrfBaseParam.b8; - bytePrt ++; - *bytePrt=zrfBaseParam.b9 ; - bytePrt ++; - *bytePrt=zrfBaseParam.b10; - bytePrt ++; - *bytePrt=zrfBaseParam.b11; - bytePrt ++; - *bytePrt=zrfBaseParam.b12; - bytePrt ++; - *bytePrt=zrfBaseParam.b13; - bytePrt ++; - *bytePrt=zrfBaseParam.b14; - bytePrt ++; - *bytePrt=zrfBaseParam.b15; - bytePrt ++; - *bytePrt=zrfBaseParam.b16; - bytePrt ++; - *bytePrt=zrfBaseParam.b17; - bytePrt ++; - zrfBaseParam.b18 = (zrfBaseParam.b18_7_4<<4 & 0b11110000) | (zrfBaseParam.b18_3_0 & 0b00001111); - *bytePrt=zrfBaseParam.b18; - bytePrt ++; - zrfBaseParam.b19 = (zrfBaseParam.b19_7_4<<4 & 0b11110000) | (zrfBaseParam.b19_3_0 & 0b00001111); - *bytePrt=zrfBaseParam.b19; - bytePrt ++; - *bytePrt=zrfBaseParam.b20; - bytePrt ++; - zrfBaseParam.b21 = (zrfBaseParam.b21_7_5 << 5 & 0b11100000) | (zrfBaseParam.b21_4_0 & 0b00011111); - *bytePrt=zrfBaseParam.b21; - bytePrt ++; - zrfBaseParam.b22 = (zrfBaseParam.b22_7_6 << 6 & 0b11000000) | (zrfBaseParam.b22_5_2<<2 & 0b00111100) | (zrfBaseParam.b22_1_0 & 0b00000011); - *bytePrt=zrfBaseParam.b22; - bytePrt ++; - *bytePrt=zrfBaseParam.b23; - bytePrt ++; - zrfBaseParam.b24 = (zrfBaseParam.b24_7_5<<5 & 0b11100000) | (zrfBaseParam.b24_4_0 & 0b00011111); - *bytePrt=zrfBaseParam.b24; - bytePrt ++; - *bytePrt=zrfBaseParam.b25; - bytePrt ++; - zrfBaseParam.b26 = (zrfBaseParam.b26_7<<7 & 0b10000000) | (zrfBaseParam.b26_6<<6 & 0b01000000) | (zrfBaseParam.b26_5_0 & 0b00111111); - *bytePrt=zrfBaseParam.b26; - bytePrt ++; - *bytePrt=zrfBaseParam.b27_28[0]; - bytePrt ++; - *bytePrt=zrfBaseParam.b27_28[1]; - bytePrt ++; - zrfBaseParam.b29 = (zrfBaseParam.b29_7_4<<4 & 0b11110000) | (zrfBaseParam.b29_3_2<<2 &0b00001100) | (zrfBaseParam.b29_1_0 & 0b00000011); - *bytePrt=zrfBaseParam.b29; - bytePrt ++; - *bytePrt=zrfBaseParam.b30; - bytePrt ++; - *bytePrt=zrfBaseParam.b31; - bytePrt ++; - *bytePrt=zrfBaseParam.b32; - bytePrt ++; - *bytePrt=zrfBaseParam.b33 = (zrfBaseParam.b33_7_4<<4 & 0b11110000) | (zrfBaseParam.b33_3_0 & 0b00001111); - *bytePrt=zrfBaseParam.b33; - bytePrt ++; - *bytePrt=zrfBaseParam.b34 = (zrfBaseParam.b34_7_4<<5 & 0b11110000) | (zrfBaseParam.b34_3_0 & 0b00001111); - *bytePrt=zrfBaseParam.b34; - bytePrt ++; - *bytePrt=zrfBaseParam.b35; - bytePrt ++; - zrfBaseParam.b36 = (zrfBaseParam.b36_7_6<<6 & 0b11000000) | (zrfBaseParam.b36_5_0 & 0b00111111); - *bytePrt=zrfBaseParam.b36; - bytePrt ++; - zrfBaseParam. b37 = (zrfBaseParam.b37_7_5<<5 & 0b11100000) | (zrfBaseParam.b37_4_3<<3 & 0b00011000) | (zrfBaseParam.b37_2<<2 & 0b00000100) | (zrfBaseParam.b37_1 <<1 & 0b00000010) | (zrfBaseParam.b37_0 & 0b00000001); - *bytePrt=zrfBaseParam.b37; - bytePrt ++; - memcpy(bytePrt,&zrfBaseParam.b38_69[32],32); - bytePrt +=32; - zrfBaseParam.b70 = (zrfBaseParam.b70_7<<7 & 0b10000000) | (zrfBaseParam.b70_6<<6 & 0b01000000) | (zrfBaseParam.b70_5_2<<2 & 0b00111100) | (zrfBaseParam.b70_1<<1 & 0b00000010) | (zrfBaseParam.b70_0 & 0b00000001); - *bytePrt=zrfBaseParam.b70; - bytePrt ++; - for(int i=0;i<32;i++) - { - memcpy(bytePrt,&zrfBaseParam.b71_166[i][0],3); - bytePrt +=3; - } - *bytePrt=zrfBaseParam.b167; - bytePrt ++; - zrfBaseParam.b168 = (zrfBaseParam.b168_7_5<<5 & 0b11100000) | (zrfBaseParam.b168_4_0 & 0b00011111); - *bytePrt=zrfBaseParam.b168; - bytePrt ++; - memcpy(bytePrt,(unsigned char *)&zrfBaseParam.b169_192[0],24); - bytePrt +=12; - *bytePrt=zrfBaseParam.b193; -} -//added by alahover -o 20230817 - +auto zrf_param_msg = QByteArray::fromHex( "00 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 ");//297 +//modified by alahover -o 20230823 QColor colors[] {QColor(0xdd0000), QColor(0xdd6600), QColor(0x008800), QColor(0x008888), QColor(0x0000ff), QColor(0x777777), QColor(0xaaaaaa)}; ExpertWin::ExpertWin(QWidget *parent, int rcvCardType) : BaseWin{parent}, m_iRcvCardType{rcvCardType} { @@ -664,9 +548,10 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou addMapData(data); QMessageBox::information(this, tr("提示"), tr("发送成功")); } else if(m_iRcvCardType == enum_zrf) { - claseToStruct(); + //发送基本参数 + classToBaseMsg(); auto waitingDlg = new WaitingDlg(this, tr("Setting")+" ..."); - auto res = sendMsgSync(zrf_msg, 0x1EA, 10000, waitingDlg); + auto res = sendMsgSync(zrf_param_msg, 0x105B14, 10000, waitingDlg); if(res==5) QMessageBox::critical(this, "Error", tr("请求超时")); else if(res) QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend))); else { @@ -687,6 +572,65 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou btn = new QPushButton(tr("回读数据")); btn->setProperty("ss","blue"); + //added by alahover -s 20230823 + connect(btn, &QPushButton::clicked, this, [=] { + if(m_iRcvCardType == enum_rcvCardType::enum_xixun_sync) + { + QByteArray data; + addMapData(data); + QMessageBox::information(this, tr("提示"), tr("回读成功")); + + } + else if(m_iRcvCardType == enum_rcvCardType::enum_zrf) + { + //回读基本参数 + 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 ff ff 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00"); + + auto res_zrf = sendMsg(zrf_cmd_msg, 0x105B14, 10000, [=](int, const QByteArray data) { + //处理回读参数 + //qDebug()<<"回读基本参数:"<close(); + + if(res==5) QMessageBox::critical(this, "Error", tr("请求超时")); + else if(res) QMessageBox::critical(this, "Error", QString(tr("回读描点参数失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend))); + else { + waitingDlg->close(); + QMessageBox::information(this, tr("提示"), tr("回读描点参数成功")); + } + } + else if(m_iRcvCardType == enum_rcvCardType::enum_xixun_async) + { + QMessageBox::information(this, tr("提示"), tr("异步卡回读成功")); + + } + else + { + QMessageBox::information(this, tr("提示"), tr("未能识别的控制卡类型")); + + } + }); + + //added by alahover -o 20230823 + hBox->addWidget(btn); vBox->addStretch(); @@ -862,3 +806,412 @@ void ExpertWin::addMapData(QByteArray &data) { data[start-2] = len>>8; } } +//added by alahover -s 02030823 +void ExpertWin::classToBaseMsg() +{ + + auto unitptr = (unsigned char *)zrf_param_msg.data(); + unsigned char * bytePrt = (unsigned char*)(unitptr); + *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); + + bytePrt =unitptr + st_zrf_base_param.b193_reserve; + *bytePrt= zrf_rcv_obj.b193; +} +void ExpertWin::classToGammaMsg(int iColorType,quint8 flashPage) +{ + auto unitptr = (unsigned char *)zrf_param_msg.data(); + unsigned char * bytePrt = (unsigned char*)(unitptr); + switch(iColorType) + { + case 0://all + if(flashPage == 0x10) + memcpy(bytePrt ,(unsigned char*)&zrf_rcv_obj.g_all[0],256); + else if(flashPage == 0x11) + memcpy(bytePrt ,(unsigned char*)&zrf_rcv_obj.g_all[128],256); + break; + case 1://red + if(flashPage == 0x10) + memcpy(bytePrt ,(unsigned char*)&zrf_rcv_obj.g_red[0],256); + else if(flashPage == 0x11) + memcpy(bytePrt ,(unsigned char*)&zrf_rcv_obj.g_red[128],256); + + break; + case 2://green + if(flashPage == 0x10) + memcpy(bytePrt ,(unsigned char*)&zrf_rcv_obj.g_green[0],256); + else if(flashPage == 0x11) + memcpy(bytePrt ,(unsigned char*)&zrf_rcv_obj.g_green[128],256); + break; + case 3://blue + if(flashPage == 0x10) + memcpy(bytePrt ,(unsigned char*)&zrf_rcv_obj.g_blue[0],256); + else if(flashPage == 0x11) + memcpy(bytePrt ,(unsigned char*)&zrf_rcv_obj.g_blue[128],256); + break; + default: + if(flashPage == 0x10) + memcpy(bytePrt ,(unsigned char*)&zrf_rcv_obj.g_all[0],256); + else if(flashPage == 0x11) + memcpy(bytePrt ,(unsigned char*)&zrf_rcv_obj.g_all[128],256); + break; + + } +} + +void ExpertWin::classToPaiXuSMsg(quint8 flashPage,bool bInitP8_st_rcv_pos) +{ + if(bInitP8_st_rcv_pos) + { + 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; + } + + } + else + { + auto unitptr = (unsigned char *)zrf_param_msg.data(); + unsigned char * bytePrt = (unsigned char*)(unitptr); + if(flashPage == 0x20) + { + *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); + } + } +} +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 + { + int itemp=flashPage&0x0F - 1; + memcpy(bytePrt, &zrf_rcv_obj.m_pixelPos[(itemp*256)/2+(256-64)/2][0] , 256); + + } + +} + +void ExpertWin::baseMsgToClass(quint8 * data) +{ + zrf_rcv_obj.b0_7 = data[st_zrf_base_param.b0_RP] & 0b10000000;//DAT信号 方式 0:高有效(共阴) 1:低有效(共阳); + zrf_rcv_obj.b0_6 = data[st_zrf_base_param.b0_RP] & 0b01000000;//STB信号有效方式 0:正向 1:反向; + zrf_rcv_obj.b0_5 = data[st_zrf_base_param.b0_RP] & 0b00100000;//OE信号有效0 :低有 效1 :高有效; + zrf_rcv_obj.b0_4 = data[st_zrf_base_param.b0_RP] & 0b00010000;//行有效方式:0 :低有效1 :高有效; + zrf_rcv_obj.b0_3_1 = data[st_zrf_base_param.b0_RP] & 0b00001110;//行译码方式bit2~bit0与地址0x01 bit7~bit6 表示 bit4~bit3。0:普通,常规138译码;00001:SM5266;00010:SM5366;01000::ICN2013;00100:无译码;00101:595译码;0110::5958译码;01110:ICND2018;其他:保留; + zrf_rcv_obj.b0_0 = data[st_zrf_base_param.b0_RP] & 0b00000001;//0 :全色;1 :单双色; + zrf_rcv_obj.b1_7_6 = data[st_zrf_base_param.b1_xiaoyingTime] & 0b11000000; //行译码方式 bit4~bit3 + zrf_rcv_obj.b1_5 = data[st_zrf_base_param.b1_xiaoyingTime] & 0b00100000; //消影控制电平0:高有效;1:低有效 + zrf_rcv_obj.b1_4 = data[st_zrf_base_param.b1_xiaoyingTime] & 0b00010000; //双卡备份0:关闭;1:启用 + zrf_rcv_obj.b1_3_2 = data[st_zrf_base_param.b1_xiaoyingTime] & 0b00001100; //颜色深度00:8bit;01:10bit;10:12bit + zrf_rcv_obj.b1_1 = data[st_zrf_base_param.b1_xiaoyingTime] & 0b00000010; //D信号扩展为第二时钟0:关闭;1:启用 + zrf_rcv_obj.b1_0 = data[st_zrf_base_param.b1_xiaoyingTime] & 0b00000001; //上电渐亮0:启用;1:关闭 + 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; + zrf_rcv_obj.b7_7_6 = data[st_zrf_base_param.b7_colorIndex] & 0b11000000; //输出数据线4,00:红;01:绿;10:蓝;11:黑; + zrf_rcv_obj.b7_5_4 = data[st_zrf_base_param.b7_colorIndex] & 0b00110000; //输出数据线3,00:红;01:绿;10:蓝;11:黑; + zrf_rcv_obj.b7_3_2 = data[st_zrf_base_param.b7_colorIndex] & 0b00001100; //输出数据线2,00:红;01:绿;10:蓝;11:黑; + zrf_rcv_obj.b7_1_0 = data[st_zrf_base_param.b7_colorIndex] & 0b00000011; //输出数据线1,00:红;01:绿;10:蓝;11:黑; + zrf_rcv_obj.b8_7 = data[st_zrf_base_param.b8_dataOutModle] & 0b10000000; //多种描点数据 :0,关闭;1,启用 + zrf_rcv_obj.b8_6 = data[st_zrf_base_param.b8_dataOutModle] & 0b01000000; //扫描复用模式:0,行扫;1,列扫; + zrf_rcv_obj.b8_5_4 = data[st_zrf_base_param.b8_dataOutModle] & 0b00110000; //模组级联方向:00:从右往左;01:从上往下;10:从左往右;11:从下往上; + zrf_rcv_obj.b8_3_0 = data[st_zrf_base_param.b8_dataOutModle] & 0b00001111; //数据输出模式:0000:标准16组并行数据输出,0001:增强20组并行数据输出,0010:增强24组并行数据输出,0101:串行16组数据输出,0100:串行32组数据输出,0011:串行 64 组数据输出,0110:增强32组并行数据输出,0111:串行 128 组数据,1000:串行 96 组数据,1001~1111:保留 + 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:普通恒流芯片 0x0F:ICN2053; 0x01:MBI5042、MBI5041; 0x10:ICN2038S; 0x02:MY9268; 0x11:MBI5124; 0x03:MBI5050; 0x12:SM16017; 0x04:SD16749; 0x13:SM16207; + //0x05:SM16136; 0x14:SM16159; 0x06:APA101; 0x15:LS9929IP; 0x07:MY9266; 0x16:ICND2110 0x08:MY9868; 0x17:LS9918IP; 0x09:MBI5052; 0x18:SM16237; + //0x0A:SUM2017; 0x19:SUM2028; 0x0B:MY9862; 0x1A:SUM2017TD; 0x0C:SUM2032; 0x1B:SM16259; 0x0D:MBI5153; 0x1C:ICND2065/ICND2055; 0x1D:SM16359; 0x1E:RT5965/RT5966; + //0x1F:MBI5264; 其他未定义 + 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:最亮 + zrf_rcv_obj.b18_7_4 = data[st_zrf_base_param.b18_clkFreq] & 0b11110000; //保留 + zrf_rcv_obj.b18_3_0 = data[st_zrf_base_param.b18_clkFreq] & 0b00001111; //输出数据时钟频率选择:0:31.25M; 1:25M; 2:20.83M; 3:17.8M 4:15.625M; 5:12.5M; 6:10.4M; 7:8.9M; 8:7.8M; 9:6.25M; 10:5.2M; 11:4.5M; 12:3.9M; 13:3.125M; 14:1.9M; 15:1M; + zrf_rcv_obj.b19_7_4 = data[st_zrf_base_param.b19_clkDutyCycle] & 0b11110000; //输出数据时钟相位:0000:0 度; 0001:- 90 度; 0010:+90 度; 其他暂时保留; + zrf_rcv_obj.b19_3_0 = data[st_zrf_base_param.b19_clkDutyCycle] & 0b00001111; //输出数据时钟占空比:0000:50%; 0001:25%; 0010:75%; 其他暂时保留; + zrf_rcv_obj.b20 = data[st_zrf_base_param.b20_pwmIcGrayClk]; //PWM 类智能芯片的灰度时钟周期设定:MBI5042 芯片,软件计算; MY9268,MBI5050,用户设定;设定有效值范围 4~128, 其他不支持; + zrf_rcv_obj.b21_7_5 = data[st_zrf_base_param.b21_grayLevelMultFreq] & 0b11100000; //输出数据时钟相位:0000:0 度; 0001:- 90 度; 0010:+90 度; 其他暂时保留; + zrf_rcv_obj.b21_4_0 = data[st_zrf_base_param.b21_grayLevelMultFreq] & 0b00011111; //输出数据时钟占空比:0000:50%; 0001:25%; 0010:75%; 其他暂时保留; + zrf_rcv_obj.b22_7_6 = data[st_zrf_base_param.b22_MultFreqMode] & 0b11000000;; //倍频模式:00:无倍频;01:VPWM;10:VPWM2;11:VPWM3; + zrf_rcv_obj.b22_5_2 = data[st_zrf_base_param.b22_MultFreqMode] & 0b00111100;; //补偿等级:暂未定义:0000~1111 + zrf_rcv_obj.b22_1_0 = data[st_zrf_base_param.b22_MultFreqMode] & 0b00000010;; //低辉补偿:00:普通模式, 01:合并补偿, 10:累加补偿 + zrf_rcv_obj.b23 = data[st_zrf_base_param.b23_reserve]; //保留 + zrf_rcv_obj.b24_7_5 = data[st_zrf_base_param.b24_freshRate] & 0b11100000;; //图像帧频率000:60Hz;001:50Hz;010:75Hz;011:30Hz;100:120Hz;其他保留 + zrf_rcv_obj.b24_4_0 = data[st_zrf_base_param.b24_freshRate] & 0b00011111;; //画面刷新频率 ,高 5bit + zrf_rcv_obj.b25 = data[st_zrf_base_param.b24_freshRate + 1]; //画面刷新频率 ,低 8bit + zrf_rcv_obj.b26_7 = data[st_zrf_base_param.b26_syncGraphicsCard] & 0b10000000; //0:与显卡同步;1:不同步 + zrf_rcv_obj.b26_6 = data[st_zrf_base_param.b26_syncGraphicsCard] & 0b01000000; //低于 120hz时,该位置1,选择为行外扫描灰度 + zrf_rcv_obj.b26_5_0 = data[st_zrf_base_param.b26_syncGraphicsCard] & 0b00111111; //显卡同步时,帧频倍数 + 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;低字节在前 + zrf_rcv_obj.b29_7_4 = data[st_zrf_base_param.b29_reserve] & 0b11110000; //0:与显卡同步;1:不同步 + zrf_rcv_obj.b29_3_2 = data[st_zrf_base_param.b29_reserve] & 0b00001100; //低于 120hz时,该位置1,选择为行外扫描灰度 + zrf_rcv_obj.b29_1_0 = data[st_zrf_base_param.b29_reserve] & 0b00000011; //显卡同步时,帧频倍数 + 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]; //接收卡带载列数高字节 + zrf_rcv_obj.b33_7_4 = data[st_zrf_base_param.b33_emptyRowMode] & 0b11110000; //偶数图像区空行4bit + zrf_rcv_obj.b33_3_0 = data[st_zrf_base_param.b33_emptyRowMode] & 0b00001111; //奇数图像区空行 4bit + zrf_rcv_obj.b34_7_4 = data[st_zrf_base_param.b34_emptyRowPos] & 0b11110000; //1~14 表示第1到15组数据;0 保留;15 表示所有数据组都有空行 + zrf_rcv_obj.b34_3_0 = data[st_zrf_base_param.b34_emptyRowPos] & 0b00001111; //1~15,表示1到15组数据;0 保留 + zrf_rcv_obj.b35 = data[st_zrf_base_param.b35_xiaoYingEndTime]; //消隐控制结束时刻 + zrf_rcv_obj.b36_7_6 = data[st_zrf_base_param.b36_RowIcParam] & 0b11000000; //保留 + zrf_rcv_obj.b36_5_0 = data[st_zrf_base_param.b36_RowIcParam] & 0b00111111; //详见说明3 + zrf_rcv_obj.b37_7_5 = data[st_zrf_base_param.b37_reserve] & 0b11100000; //保留 + zrf_rcv_obj.b37_4_3 = data[st_zrf_base_param.b37_reserve] & 0b00011000; //端口内空数据通道数 + zrf_rcv_obj.b37_2 = data[st_zrf_base_param.b37_reserve] & 0b00000100; //UD口交换 + zrf_rcv_obj.b37_1 = data[st_zrf_base_param.b37_reserve] & 0b00000010; //逆序 + zrf_rcv_obj.b37_0 = data[st_zrf_base_param.b37_reserve] & 0b00000001; //奇偶交换 + memcpy(&zrf_rcv_obj.b38_69[0],&data[st_zrf_base_param.b38_hub1to32Area],32);//端口1~31输出图像区 + zrf_rcv_obj.b70_7 = data[st_zrf_base_param.b70_reserve] & 0b10000000; //空行模式 0:关闭 1:打开 + zrf_rcv_obj.b70_6 = data[st_zrf_base_param.b70_reserve] & 0b01000000; //对折偏移 0:关闭 1:打开 + zrf_rcv_obj.b70_5_2 = data[st_zrf_base_param.b70_reserve] & 0b00111100; //对折模式: 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; //空列模式: 0:禁止; 1:允许 + zrf_rcv_obj.b70_0 = data[st_zrf_base_param.b70_reserve] & 0b00000001; //bit0 图像区偏移: 0:菱形偏移模式; 1:梯形 偏移模式 + 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]; //同步预留时间 + zrf_rcv_obj.b168_7_5 = data[st_zrf_base_param.b168_reserve] & 0b11100000; //保留 + zrf_rcv_obj.b168_4_0 = data[st_zrf_base_param.b168_reserve] & 0b00011111; //消隐延迟时间:(输入值+1)*48ns + memcpy((qint8*)&zrf_rcv_obj.b169_192[0], &data[st_zrf_base_param.b169_redIcParam1],24); + zrf_rcv_obj.b193 = data[st_zrf_base_param.b193_reserve]; //保留 + +} +void ExpertWin::gammaMsgToClass(quint8 * data,quint8 flashPage) +{ + if(flashPage == 0x10) + { + memcpy((quint8 *)&zrf_rcv_obj.g_all[0] , &data[0] ,256) ; + memcpy((quint8 *)&zrf_rcv_obj.g_red[0] , &data[0] ,256) ; + memcpy((quint8 *)&zrf_rcv_obj.g_green[0] , &data[0] ,256) ; + memcpy((quint8 *)&zrf_rcv_obj.g_blue[0] , &data[0] ,256) ; + } + else if(flashPage == 0x11) + { + memcpy((quint8 *)&zrf_rcv_obj.g_all[128] , &data[0] ,256) ; + memcpy((quint8 *)&zrf_rcv_obj.g_red[128] , &data[0] ,256) ; + memcpy((quint8 *)&zrf_rcv_obj.g_green[128] , &data[0] ,256) ; + memcpy((quint8 *)&zrf_rcv_obj.g_blue[128] , &data[0] ,256) ; + } + +} +void ExpertWin::paiXuMsgToClass(quint8 * data,quint8 flashPage,bool bInitFromP8_st_rcv_pos) +{ + if(bInitFromP8_st_rcv_pos == false) + { + 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 + { + int itemp=flashPage&0x0F - 1;//flashpage 0x21~0x27, + memcpy(&zrf_rcv_obj.p8_st_rcv_pos[itemp*32+(256-8)/8],&data[0],256); + + } + } + else + { + 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; + } + } +} + +void ExpertWin::miaoDianMsgToClass(quint8 * data) +{ + memcpy(&zrf_rcv_obj.m_scanIndex , data , 64); + memcpy(&zrf_rcv_obj.m_pixelPos , &data[64] , 2048); + +} +//added by alahover -o 20230823 diff --git a/ledset/expertwin.h b/ledset/expertwin.h index 1e6ae59..6a494b3 100644 --- a/ledset/expertwin.h +++ b/ledset/expertwin.h @@ -44,15 +44,27 @@ public: //added by alahover -s 20230817 int m_iRcvCardType; - class zrf_base_param{ + + struct St_Rcv_Pos{ + unsigned char imgXL8 = 0;//接收卡图像列起始低八位 + unsigned char imgYL8 = 0;//接收卡图像行起始低八位 + unsigned char imgXH4_YH4 = 0;//接收卡图像列起始高四位+行起始高四位 + unsigned char imgWidthL8 = 0;//接收卡图像宽度低八位 + unsigned char imgWidthH4_HeightH4 = 0x14;//接收卡图像宽度低八位 + unsigned char imgHeightL8 = 0;//接收卡图像宽度低八位 + unsigned char imgPosNumInScreenL8 = 0;//接收卡在屏内的位置号低八位 + unsigned char imgPosNumInScreenH8 = 0;//接收卡在屏内的位置号高八位 + }; + class zrf_rcv_card{ public: + /////////////////描点参数成员变量//////////////// unsigned char b0_7 = 0b0; //DAT信号 方式 0:高有效(共阴) 1:低有效(共阳); unsigned char b0_6 = 0b0; //STB信号有效方式 0:正向 1:反向; unsigned char b0_5 = 0b0; //OE信号有效0 :低有 效1 :高有效; unsigned char b0_4 = 0b0; //行有效方式:0 :低有效1 :高有效; unsigned char b0_3_1 = 0b000; //行译码方式bit2~bit0与地址0x01 bit7~bit6 表示 bit4~bit3。0:普通,常规138译码;00001:SM5266;00010:SM5366;01000::ICN2013;00100:无译码;00101:595译码;0110::5958译码;01110:ICND2018;其他:保留; - unsigned char b0_0 = 0b0; //0 :全色;1 :单双色; - unsigned char b0 = (b0_7 << 7 & 0b10000000)| (b0_6 << 6 & 0b01000000)| (b0_5 << 5 & 0b00100000)| (b0_4 << 4 & 0b00010000)| (b0_3_1 << 1 & 0b00001110) | (b0_0 & 0b00000001); + unsigned char b0_0 = 0b0; //0 :全色;1 :单双色; +// unsigned char b0 = (b0_7 << 7 & 0b10000000)| (b0_6 << 6 & 0b01000000)| (b0_5 << 5 & 0b00100000)| (b0_4 << 4 & 0b00010000)| (b0_3_1 << 1 & 0b00001110) | (b0_0 & 0b00000001); unsigned char b1_7_6 = 0b00; //行译码方式 bit4~bit3 unsigned char b1_5 = 0b0; //消影控制电平0:高有效;1:低有效 @@ -60,7 +72,7 @@ public: unsigned char b1_3_2 = 0b00; //颜色深度00:8bit;01:10bit;10:12bit unsigned char b1_1 = 0b0; //D信号扩展为第二时钟0:关闭;1:启用 unsigned char b1_0 = 0b0; //上电渐亮0:启用;1:关闭 - unsigned char b1 = (b1_7_6<< 6 & 0b11000000) | (b1_5<<5 & 0b00100000) | (b1_4<<4 & 0b00010000) | (b1_3_2<<2 & 0b00001100) | (b1_1<<1 & 0b00000010) |(b1_0&0b00000001); +// unsigned char b1 = (b1_7_6<< 6 & 0b11000000) | (b1_5<<5 & 0b00100000) | (b1_4<<4 & 0b00010000) | (b1_3_2<<2 & 0b00001100) | (b1_1<<1 & 0b00000010) |(b1_0&0b00000001); unsigned char b2 = 0x5; //实际消影时间为:(输入值 * 2 + 1) * 48ns unsigned char b3 = 0x8; //一组数据控制模组的行数:1~64;其他无效; @@ -72,14 +84,14 @@ public: unsigned char b7_5_4 = 0b10; //输出数据线3,00:红;01:绿;10:蓝;11:黑; unsigned char b7_3_2 = 0b01; //输出数据线2,00:红;01:绿;10:蓝;11:黑; unsigned char b7_1_0 = 0b00; //输出数据线1,00:红;01:绿;10:蓝;11:黑; - unsigned char b7 = (b7_7_6 << 6 & 0b11000000) | (b7_5_4<<4 & 0b00110000) | (b7_3_2 << 2 & 0b00001100) | (b7_1_0 & 0b00000011) ; +// unsigned char b7 = (b7_7_6 << 6 & 0b11000000) | (b7_5_4<<4 & 0b00110000) | (b7_3_2 << 2 & 0b00001100) | (b7_1_0 & 0b00000011) ; //数据传输方向及数据输出模式 unsigned char b8_7 = 0b0; //多种描点数据 :0,关闭;1,启用 unsigned char b8_6 = 0b0; //扫描复用模式:0,行扫;1,列扫; unsigned char b8_5_4 = 0b00; //模组级联方向:00:从右往左;01:从上往下;10:从左往右;11:从下往上; unsigned char b8_3_0 = 0b0000; //数据输出模式:0000:标准16组并行数据输出,0001:增强20组并行数据输出,0010:增强24组并行数据输出,0101:串行16组数据输出,0100:串行32组数据输出,0011:串行 64 组数据输出,0110:增强32组并行数据输出,0111:串行 128 组数据,1000:串行 96 组数据,1001~1111:保留 - unsigned char b8 = (b8_7<<7 &0b10000000) | (b8_6<<6 & 0b01000000) | (b8_5_4<<4 & 0b00110000) | (b8_3_0 & 0b00001111) ; +// unsigned char b8 = (b8_7<<7 &0b10000000) | (b8_6<<6 & 0b01000000) | (b8_5_4<<4 & 0b00110000) | (b8_3_0 & 0b00001111) ; unsigned char b9 = 0xFF; //静态亮度 0:最暗,ff:最亮;区别于帧同步包中的动态亮度; unsigned char b10 = 0xFF; //红亮度0:最暗,ff:最亮 @@ -97,36 +109,36 @@ public: //数据时钟频率 unsigned char b18_7_4 = 0x0; //保留 unsigned char b18_3_0 = 0x5; //输出数据时钟频率选择:0:31.25M; 1:25M; 2:20.83M; 3:17.8M 4:15.625M; 5:12.5M; 6:10.4M; 7:8.9M; 8:7.8M; 9:6.25M; 10:5.2M; 11:4.5M; 12:3.9M; 13:3.125M; 14:1.9M; 15:1M; - unsigned char b18 = (b18_7_4<<4 & 0b11110000) | (b18_3_0 & 0b00001111); + // unsigned char b18 = (b18_7_4<<4 & 0b11110000) | (b18_3_0 & 0b00001111); //数据时钟相位及占空比 unsigned char b19_7_4 = 0b0000; //输出数据时钟相位:0000:0 度; 0001:- 90 度; 0010:+90 度; 其他暂时保留; unsigned char b19_3_0 = 0b0101; //输出数据时钟占空比:0000:50%; 0001:25%; 0010:75%; 其他暂时保留; - unsigned char b19 = (b19_7_4<<4 & 0b11110000) | (b19_3_0 & 0b00001111); +// unsigned char b19 = (b19_7_4<<4 & 0b11110000) | (b19_3_0 & 0b00001111); //PWM芯片灰度时钟周期 unsigned char b20 = 0x20; //PWM 类智能芯片的灰度时钟周期设定:MBI5042 芯片,软件计算; MY9268,MBI5050,用户设定;设定有效值范围 4~128, 其他不支持; //灰度等级及倍频模式 unsigned char b21_7_5 = 0b000; //输出数据时钟相位:0000:0 度; 0001:- 90 度; 0010:+90 度; 其他暂时保留; unsigned char b21_4_0 = 0b10111; //输出数据时钟占空比:0000:50%; 0001:25%; 0010:75%; 其他暂时保留; - unsigned char b21 = (b21_7_5 << 5 & 0b11100000) | (b21_4_0 & 0b00011111); +// unsigned char b21 = (b21_7_5 << 5 & 0b11100000) | (b21_4_0 & 0b00011111); //倍频模式 、低灰优化 unsigned char b22_7_6 = 0b00; //倍频模式:00:无倍频;01:VPWM;10:VPWM2;11:VPWM3; unsigned char b22_5_2 = 0b0000; //补偿等级:暂未定义:0000~1111 unsigned char b22_1_0 = 0b00; //低辉补偿:00:普通模式, 01:合并补偿, 10:累加补偿 - unsigned char b22 = (b22_7_6 << 6 & 0b11000000) | (b22_5_2<<2 & 0b00111100) | (b22_1_0 & 0b00000011); + // unsigned char b22 = (b22_7_6 << 6 & 0b11000000) | (b22_5_2<<2 & 0b00111100) | (b22_1_0 & 0b00000011); unsigned char b23 = 0x00; //保留 //画面刷新频率 unsigned char b24_7_5 = 0b000; //图像帧频率000:60Hz;001:50Hz;010:75Hz;011:30Hz;100:120Hz;其他保留 unsigned char b24_4_0 = 0b00000; //画面刷新频率 ,高 5bit - unsigned char b24 = (b24_7_5<<5 & 0b11100000) | (b24_4_0 & 0b00011111); + // unsigned char b24 = (b24_7_5<<5 & 0b11100000) | (b24_4_0 & 0b00011111); unsigned char b25 = 0xF0; //画面刷新频率 ,低 8bit //与显卡同步 unsigned char b26_7 = 0b1; //0:与显卡同步;1:不同步 unsigned char b26_6 = 0b0; //低于 120hz时,该位置1,选择为行外扫描灰度 unsigned char b26_5_0 = 0b000000; //显卡同步时,帧频倍数 - unsigned char b26 = (b26_7<<7 & 0b10000000) | (b26_6<<6 & 0b01000000) | (b26_5_0 & 0b00111111); + // unsigned char b26 = (b26_7<<7 & 0b10000000) | (b26_6<<6 & 0b01000000) | (b26_5_0 & 0b00111111); unsigned char b27_28[2] = { 0x01,0x33}; //非 5030/5042 时:ldq 值 = 166M/场频/扫描方式/遍数, 此数据必须小于 65535,当帧频不准时,利用微调选项调整 //5030/5042 时:ldq 值 = 166M/场频/扫描方式/19/遍数, 此数据必须小于 65535,此处遍数为:4096 级时:5, 8192 级时:9 , 16384级时:17 此值最小为 485. @@ -138,7 +150,7 @@ public: unsigned char b29_7_4 = 0b0000; //0:与显卡同步;1:不同步 unsigned char b29_3_2 = 0b00; //低于 120hz时,该位置1,选择为行外扫描灰度 unsigned char b29_1_0 = 0b00; //显卡同步时,帧频倍数 - unsigned char b29 = (b29_7_4<<4 & 0b11110000) | (b29_3_2<<2 &0b00001100) | (b29_1_0 & 0b00000011); + // unsigned char b29 = (b29_7_4<<4 & 0b11110000) | (b29_3_2<<2 &0b00001100) | (b29_1_0 & 0b00000011); unsigned char b30 = 0x00; //DPWM 芯片刷新倍频数 ICND2055/ICND2065 刷新倍频数 b7~b0 unsigned char b31 = 0x00; //接收卡带载列数低字节 @@ -147,19 +159,19 @@ public: //空行模式 unsigned char b33_7_4 = 0b0000; //偶数图像区空行4bit unsigned char b33_3_0 = 0b0000; //奇数图像区空行 4bit - unsigned char b33 = (b33_7_4<<4 & 0b11110000) | (b33_3_0 & 0b00001111); + // unsigned char b33 = (b33_7_4<<4 & 0b11110000) | (b33_3_0 & 0b00001111); //模组端口空行位置 unsigned char b34_7_4 = 0b0000; //1~14 表示第1到15组数据;0 保留;15 表示所有数据组都有空行 unsigned char b34_3_0 = 0b0000; //1~15,表示1到15组数据;0 保留 - unsigned char b34 = (b34_7_4<<5 & 0b11110000) | (b34_3_0 & 0b00001111); +// unsigned char b34 = (b34_7_4<<5 & 0b11110000) | (b34_3_0 & 0b00001111); unsigned char b35 = 0x00; //消隐控制结束时刻 //行驱动芯片参数 unsigned char b36_7_6 = 0b00; //保留 unsigned char b36_5_0 = 0b000000; //详见说明3 - unsigned char b36 = (b36_7_6<<6 & 0b11000000) | (b36_5_0 & 0b00111111); + // unsigned char b36 = (b36_7_6<<6 & 0b11000000) | (b36_5_0 & 0b00111111); //行驱动芯片参数 unsigned char b37_7_5 = 0b000; //保留 @@ -167,7 +179,7 @@ public: unsigned char b37_2 = 0b0; //UD口交换 unsigned char b37_1 = 0b0; //逆序 unsigned char b37_0 = 0b0; //奇偶交换 - unsigned char b37 = (b37_7_5<<5 & 0b11100000) | (b37_4_3<<3 & 0b00011000) | (b37_2<<2 & 0b00000100) | (b37_1 <<1 & 0b00000010) | (b37_0 & 0b00000001); + // unsigned char b37 = (b37_7_5<<5 & 0b11100000) | (b37_4_3<<3 & 0b00011000) | (b37_2<<2 & 0b00000100) | (b37_1 <<1 & 0b00000010) | (b37_0 & 0b00000001); unsigned char b38_69[32] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f}; //端口1~31输出图像区 @@ -177,7 +189,7 @@ public: unsigned char b70_5_2 = 0b0; //对折模式: 0:正常模式; 1:两折; 2:镜像对折; 3:3折; 4:4折; 5:5折; 6:6折; 7:8折;其他:保留 unsigned char b70_1 = 0b0; //空列模式: 0:禁止; 1:允许 unsigned char b70_0 = 0b1; //bit0 图像区偏移: 0:菱形偏移模式; 1:梯形 偏移模式 - unsigned char b70 = (b70_7<<7 & 0b10000000) | (b70_6<<6 & 0b01000000) | (b70_5_2<<2 & 0b00111100) | (b70_1<<1 & 0b00000010) | (b70_0 & 0b00000001); +// unsigned char b70 = (b70_7<<7 & 0b10000000) | (b70_6<<6 & 0b01000000) | (b70_5_2<<2 & 0b00111100) | (b70_1<<1 & 0b00000010) | (b70_0 & 0b00000001); //{0x00,0x00,0x00}图像区1列偏移低8bit,图像区1行偏移低8bit,图像区1列偏移低4bit+行偏移高4bit unsigned char b71_166[32][3] = {{0x00,0x00,0x00},{0x00,0x01,0x00},{0x00,0x02,0x00},{0x00,0x03,0x00},{0x00,0x04,0x00},{0x00,0x05,0x00},{0x00,0x06,0x00},{0x00,0x07,0x00}, @@ -188,7 +200,7 @@ public: unsigned char b168_7_5 = 0b000; //保留 unsigned char b168_4_0 = 0b00000; //消隐延迟时间:(输入值+1)*48ns - unsigned char b168 = (b168_7_5<<5 & 0b11100000) | (b168_4_0 & 0b00011111); + // unsigned char b168 = (b168_7_5<<5 & 0b11100000) | (b168_4_0 & 0b00011111); unsigned short b169_192[12] = {0x0000,//红芯片参数 1 高字节,红芯片参数 1 低字节 0x0000,//红芯片参数 2 高字节,红芯片参数 2 低字节 @@ -205,11 +217,48 @@ public: }; unsigned char b193 = 0x00; //保留 - }; - zrf_base_param zrfBaseParam; - void claseToStruct(); - //added by alahover -o 20230817 + /////////////////描点参数成员变量//////////////// + unsigned char m_scanIndex[64]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F}; + unsigned char m_pixelPos[1024][2];//描点参数中一点占用 2字节(8bit 列 + 8 bit 行) + /////////////////排序参数成员变量//////////////// + unsigned char p0_cardIndexInNet;//当前卡在网线内的序号 + unsigned char p1_SendCardCode;//当前网线所在的发送卡编号 + unsigned char p2_netIndexInSendCard;//当前网线所在发送卡输出口编号 + unsigned char p3_fenXianNum;//当前分线号 + unsigned char p4_rcvCardsNumInNet;//当前网线内接收卡总数 + unsigned char p5_netScreenIndex;//当前网线所在屏号 + unsigned char p6_reserve;//保留 + unsigned char p7_reserve1;//保留 + St_Rcv_Pos p8_st_rcv_pos[256]; + + unsigned short p_x[256]; + unsigned short p_y[256]; + unsigned short p_w[256]; + unsigned short p_h[256]; + unsigned short p_posNum[256]; + + /////////////////gamma参数成员变量//////////////// + unsigned short g_all[256]; + unsigned short g_red[256]; + unsigned short g_green[256]; + unsigned short g_blue[256]; + }; + + zrf_rcv_card zrf_rcv_obj; + + void classToBaseMsg(); + void classToGammaMsg(int iColorType,quint8 flashPage); + void classToPaiXuSMsg(quint8 flashPage,bool bInitP8_st_rcv_pos); + void classToMiaoDianMsg(quint8 flashPage); + void baseMsgToClass(quint8 * data); + void gammaMsgToClass(quint8 * data , quint8 flashPage); + void paiXuMsgToClass(quint8 * data , quint8 flashPage,bool bInitFromP8_st_rcv_pos); + void miaoDianMsgToClass(quint8 * data); + //added by alahover -o 20230823 protected: void closeEvent(QCloseEvent *) override; diff --git a/ledset/globalfunc.cpp b/ledset/globalfunc.cpp index e9c952d..a72c079 100644 --- a/ledset/globalfunc.cpp +++ b/ledset/globalfunc.cpp @@ -10,6 +10,9 @@ QString gFileHome; HeadMap headMap; HeadMap_ZRF headMap_zrf; //added by alahover 20230822 +St_Zrf_Base_Param st_zrf_base_param; //added by alahover 20230823 +St_Zrf_Cmd_Param st_zrf_cmd_param; //added by alahover 20230823 +St_MiaoDian_Param st_miaodian_param; //added by alahover 20230823 byte *getSepas() { auto sepas = new byte[headMap.end+4]{0}; diff --git a/ledset/globalfunc.h b/ledset/globalfunc.h index 087abf1..bcfbf8b 100644 --- a/ledset/globalfunc.h +++ b/ledset/globalfunc.h @@ -20,12 +20,12 @@ struct Head { struct Msg1024 : Head { byte body[1024-sizeof(Head)]{0}; }; -static byte fi = 0; -inline byte ie(byte size = 1) { +static int fi = 0; +inline int ie(int size = 1) { fi = size; return 0; } -inline byte ipp(byte size = 1) { +inline int ipp(int size = 1) { auto rtn = fi; fi += size; return rtn; @@ -37,34 +37,112 @@ enum enum_rcvCardType{ enum_mxe }; struct HeadMap { - byte pre{ipp(2)}; - byte ver{fi++}; - byte srv{fi++}; - byte len{ipp(2)}; - byte tgtAddr{ipp(4)}; - byte srcAddr{ipp(4)}; - byte ptr{ipp(4)}; - byte ans{ipp(2)}; - byte chk{ipp(4)}; - byte body{ipp(4)}; - byte bodylen{ipp(2)}; - byte end{fi}; + byte pre = ipp(2); + byte ver = fi++; + byte srv = fi++; + byte len = ipp(2); + byte tgtAddr = ipp(4); + byte srcAddr = ipp(4); + byte ptr = ipp(4); + byte ans = ipp(2); + byte chk = ipp(4); + byte body = ipp(4); + byte bodylen = ipp(2); + byte end = fi; }; //added by alahover -s 20230822 struct HeadMap_ZRF { - byte pre{ie(2)}; - byte tgtAddr{ipp(6)}; - byte srcAddr{ipp(6)}; - byte protcolFlag{ipp(2)}; - byte pkgType{fi++}; - byte reserve{fi++}; - byte netPort{ipp(4)}; - byte rcvIndex{ipp(2)}; - byte end{fi}; + quint16 pre = ie(2); + quint16 tgtAddr = ipp(6); + quint16 srcAddr = ipp(6); + quint16 protcolFlag = ipp(2); + quint16 pkgType = fi++; + quint16 reserve = fi++; + quint16 netPort = fi++; + quint16 rcvIndex = fi++; + quint16 reserve1 = fi++; + quint16 end = fi; +}; +struct St_Zrf_Cmd_Param{ + quint16 paramType = ie(19); + quint16 rcvCardPosH = fi++; + quint16 rcvCardPosL = fi++; + quint16 reserve2 = fi++; + quint16 cmd = ipp(4); + quint16 flashSentor = ipp(4); + quint16 flashPage = ipp(4); + quint16 reserve3 = ipp(4); + quint16 paramData = ipp(256); + quint16 end = fi; }; +struct St_Zrf_Base_Param{ + quint16 b0_RP = ie(0); //模组信号极性 + quint16 b1_xiaoyingTime = ipp(1); //行消影时间 + quint16 b2_line_xytime = ipp(1); //行消影时间 + quint16 b3_rows1Group = ipp(1); // + quint16 b4_cols1Group = fi++; + quint16 b5_scanNum = fi++; + quint16 b6_emptyPointNum = fi++; + quint16 b7_colorIndex = fi++; + quint16 b8_dataOutModle = fi++; + quint16 b9_brightStatic = fi++; + quint16 b10_brightRed = fi++; + quint16 b11_brightGreen = fi++; + quint16 b12_brightBlue = fi++; + quint16 b13_icType = fi++; + quint16 b14_icParma = fi++; + quint16 b15_redIgain = fi++; + quint16 b16_greenIgain = fi++; + quint16 b17_blueIgain = fi++; + quint16 b18_clkFreq = fi++; + quint16 b19_clkDutyCycle = fi++; + quint16 b20_pwmIcGrayClk = fi++; + quint16 b21_grayLevelMultFreq = fi++; + quint16 b22_MultFreqMode = fi++; + quint16 b23_reserve = fi++; + quint16 b24_freshRate = ipp(2); + quint16 b26_syncGraphicsCard = fi++; + quint16 b27_Ldq = ipp(2); + quint16 b29_reserve = fi++; + quint16 b30_pwmMultFreq = fi++; + quint16 b31_rcvCardCols = ipp(2); + quint16 b33_emptyRowMode = fi++; + quint16 b34_emptyRowPos = fi++; + quint16 b35_xiaoYingEndTime = fi++; + quint16 b36_RowIcParam = fi++; + quint16 b37_reserve = fi++; + quint16 b38_hub1to32Area = ipp(32); + quint16 b70_reserve = fi++; + quint16 b71_imgArea1to32Param = ipp(96); + quint16 b167_syncPreTime = fi++; + quint16 b168_reserve = fi++; + quint16 b169_redIcParam1 = ipp(2); + quint16 b171_redIcParam2 = ipp(2); + quint16 b173_redIcParam3 = ipp(2); + quint16 b175_greenIcParam1 = ipp(2); + quint16 b177_greenIcParam2 = ipp(2); + quint16 b179_greenIcParam3 = ipp(2); + quint16 b181_blueIcParam1 = ipp(2); + quint16 b183_blueIcParam2 = ipp(2); + quint16 b185_blueIcParam3 = ipp(2); + quint16 b187_redIcParam4 = ipp(2); + quint16 b189_greenIcParam4 = ipp(2); + quint16 b191_blueIcParam4 = ipp(2); + quint16 b193_reserve = fi++; + quint16 end = fi; +}; + +struct St_MiaoDian_Param{ + quint16 scanIndex = ie(64); //模组信号极性 + quint16 PixelPos = ipp(448); //行消影时间 + quint16 end = fi; //行消影时间 +}; extern HeadMap headMap; extern HeadMap_ZRF headMap_zrf; +extern St_Zrf_Base_Param st_zrf_base_param; +extern St_Zrf_Cmd_Param st_zrf_cmd_param; +extern St_MiaoDian_Param st_miaodian_param; extern byte *sepas; extern pcap *pcapSend; class PcapReThread; diff --git a/ledset/mainwin.cpp b/ledset/mainwin.cpp index 0edf14b..fd65f4f 100644 --- a/ledset/mainwin.cpp +++ b/ledset/mainwin.cpp @@ -1,6 +1,7 @@ #include "mainwin.h" #include "gutil/qjson.h" #include "pcaprethread.h" +#include "pcap.h" #include "fast.h" #include "expertwin.h" #include "brightwin.h" @@ -232,6 +233,20 @@ MainWin::MainWin() { end:; } }); + reThd->addMultiCallback(0x105B14, [=](int, const QByteArray data) { + auto rr = table->rowCount(); + table->setRowCount(rr+1); + int virtualVCM = *(quint8*)(data.data()+headMap_zrf.netPort); + unsigned short ver = *(quint16_be *)(data.data()+headMap_zrf.protcolFlag); + unsigned char pkgType = *(quint8 *)(data.data()+headMap_zrf.pkgType); + if(ver!=0x105B || pkgType != 0x14) return; + table->setData(rr, "type", enum_zrf)->setText(tr("PC虚拟卡V1.0")); + table->setText(rr, "name", tr("网口:")+QString::number(virtualVCM)); + table->setText(rr, "link", "千兆网直连"); + table->setText(rr, "vcsNum", QString::number(*(quint8*)(data.data()+headMap_zrf.rcvIndex))); + table->setText(rr, "netPorts", "P:"+QString::number(virtualVCM)); + table->setText(rr, "info", "备注:可直接配屏,无需发送卡"); + }); getCard(); } MainWin::~MainWin() { @@ -250,8 +265,8 @@ void MainWin::getCard() { int virtualVCM = *(quint16_be*)(data.data()+headMap.srcAddr); //modified by alahover -s 20230822 auto ver = *(byte*)(data.data()+headMap.ver); - if(ver==0x58) table->setData(rr, "type", enum_zrf)->setText(tr("PC虚拟卡V1.0")); - else if(ver==0x01) table->setData(rr, "type", enum_xixun_sync)->setText(tr("PC虚拟卡V0.0")); + if(ver==0x01) table->setData(rr, "type", enum_xixun_sync)->setText(tr("PC虚拟卡V0.0")); + else if(ver==0x58) table->setData(rr, "type", enum_zrf)->setText(tr("PC虚拟卡V1.0")); table->setText(rr, "name", tr("网口:")+QString::number(virtualVCM)); table->setText(rr, "link", "千兆网直连"); table->setText(rr, "vcsNum", QString::number(*(quint32_be*)(data.data()+headMap.body))); @@ -263,20 +278,9 @@ void MainWin::getCard() { if(! err.endsWith("(2150891551)")) QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend))); } //modified by alahover -s 20230822 - msg = QByteArray::fromHex("5555 001122334455 001122334455 105a 13 00 00 00 00 e0 ff ff 00 f2 f2 f2 f2 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 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 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 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); - res = sendMsg(msg, 0x1E0, 10000, [=](int, const QByteArray data) { - auto rr = table->rowCount(); - table->setRowCount(rr+1); - int virtualVCM = *(quint8*)(data.data()+headMap_zrf.netPort); - unsigned short ver = *(quint16_be *)(data.data()+headMap_zrf.protcolFlag); - if(ver==0x58 || ver==0x00 || ver==0x22) table->setData(rr, "type", enum_zrf)->setText(tr("PC虚拟卡V1.0")); - else if(ver==0x01) table->setData(rr, "type", enum_xixun_sync)->setText(tr("PC虚拟卡V0.0")); - table->setText(rr, "name", tr("网口:")+QString::number(virtualVCM)); - table->setText(rr, "link", "千兆网直连"); - table->setText(rr, "vcsNum", QString::number(*(quint32_be*)(data.data()+17))); - table->setText(rr, "netPorts", "P:"+QString::number(virtualVCM)); - table->setText(rr, "info", "备注:可直接配屏,无需发送卡"); - }); + //查询105B协议类型ZRF版本fpga的接收卡, 0x105B14 表示是zrf协议类型并且是回读数据包 + msg = QByteArray::fromHex("5555 001122334455 001122334455 105A 13 00 00 00 00 e0 ff ff 00 f2 f2 f2 f2 00 00 00 00 20 20 20 20 00 00 00 00"); + res = pcap_sendpacket(pcapSend, (const u_char *)msg.data(), msg.size()); if(res) { QString err = pcap_geterr(pcapSend); if(! err.endsWith("(2150891551)")) QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend))); diff --git a/ledset/pcaprethread.cpp b/ledset/pcaprethread.cpp index 1a50d7c..a14b866 100644 --- a/ledset/pcaprethread.cpp +++ b/ledset/pcaprethread.cpp @@ -40,7 +40,10 @@ int PcapReThread::sendMsgNet(const byte *msg, int size, int id, qint64 timeout, } return res; } - +void PcapReThread::addMultiCallback(int id, FuncIntByte callback) { + std::lock_guard lock(mtx); + resps.append(new PcapResp{callback, id, 0, true}); +} void PcapReThread::run() { pcap_pkthdr *header; const uchar *data; @@ -49,12 +52,27 @@ void PcapReThread::run() { if(! resps.isEmpty()) { std::lock_guard lock(mtx); if(cnt && data[0]==0x55 && data[1]==0x55) { - int id = data[2]<<8 | data[3]; - for(int i=0; iid==id) { - auto resp = resps.takeAt(i); - if(resp->notCancelled) emit onCallback(resp->callback, 0, QByteArray((char*)data, header->caplen)); - delete resp; - break; + //modified by alahover -s 20230823 + if(data[2]==0x00 && data[3]==0x11 && data[4]==0x22 && data[5]==0x33 && data[6]==0x44 && data[7]==0x55 ) { + int id = data[headMap_zrf.protcolFlag]<<16 | data[headMap_zrf.protcolFlag+1]<<8 | data[headMap_zrf.pkgType]; + //qDebug()<<"id="<id==id) { + auto resp = resps[i]; + if(resp->notCancelled) emit onCallback(resp->callback, 0, QByteArray((char*)data, header->caplen)); + if(! resp->isMulti) { + resps.removeAt(i); + delete resp; + } + break; + } + } else { + int id = data[2]<<8 | data[3]; + for(int i=0; iid==id) { + auto resp = resps.takeAt(i); + if(resp->notCancelled) emit onCallback(resp->callback, 0, QByteArray((char*)data, header->caplen)); + delete resp; + break; + } } } auto now = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); diff --git a/ledset/pcaprethread.h b/ledset/pcaprethread.h index 299b518..d2543a6 100644 --- a/ledset/pcaprethread.h +++ b/ledset/pcaprethread.h @@ -12,7 +12,8 @@ struct PcapResp { FuncIntByte callback; int id; qint64 timeout; - bool notCancelled{true}; + bool isMulti = false; + bool notCancelled = true; }; class PcapReThread : public QThread { Q_OBJECT @@ -21,6 +22,7 @@ public: ~PcapReThread(); int sendMsgNet(const byte *msg, int size, int id, qint64 timeout, FuncIntByte callback, WaitingDlg *waitingDlg = 0); + void addMultiCallback(int id, FuncIntByte callback); QList resps; std::mutex mtx; pcap *pcap;