Browse Source

V0.6.2
1、完成了示波器数据部分的初始化工作
2、完成了眼图和颜色矩阵的关联
3、修复了部分UI的问题

Apple 2 months ago
parent
commit
8c0000373b

+ 5 - 0
EyeMap/EyeMapWidget/eyemapwidget.cpp

@@ -11,6 +11,9 @@
 #include "paramconfig.h"
 #include "warning.h"
 
+#include "OscDataInfo.h"
+#include "OneOscData.h"
+
 EyeMapWidget::EyeMapWidget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::EyeMapWidget)
@@ -158,6 +161,8 @@ void EyeMapWidget::initEyeMap()
         oneEyeMap->setVoltageRange(it.voltageRange);
         oneEyeMap->setChannelInfo(it.channelInfo);
         oneEyeMap->setTimeGridValue(it.tGridValue);
+
+        oneEyeMap->setEyeDataPtrFromOscData(it.channelInfo.channel);
         oneEyeMap->hide();
         GEyeMapInfo.addEyeMapPtr(oneEyeMap);
     }

+ 33 - 23
EyeMap/GlobalInfo/EyeMapInfo.cpp

@@ -33,12 +33,13 @@ void AllEyeMapInfo::initEyeMapInfo()
     {
         readSaveFile(m_saveFileName);
     }
+
     /* 设置可用通道,实际需要根据连接到的示波器个数来设置 */
     for(int i = 1; i <= 8; i++)
     {
         OneChannelInfo info;
-        info.channel = i;
-        info.channelName = "通道" + QString::number(i);
+        info.channel = static_cast<OscChnNum>(i);
+        info.channelName = getChannelName(static_cast<OscChnNum>(i));
         GEyeMapInfo.appendChannelInfo(info);
     }
 }
@@ -64,11 +65,12 @@ void AllEyeMapInfo::readSaveFile(const QString& fileName)
         for(const auto& it : jsonArray)
         {
             OneEyeMapInfo info;
+            info.uid = static_cast<EyeMapUID>(it["uid"].is_null() ? 0 : it["uid"].get<int>());
             info.num = it["num"];
             info.title = QString::fromStdString(it["title"].get<std::string>());
             info.titleBarColor = QColor(QString::fromStdString(it["titleBarColor"].get<std::string>()));
             info.isShow = it["isShow"];
-            info.channelInfo.channel = it["OscChannelNum"].get<int>();
+            info.channelInfo.channel = static_cast<OscChnNum>(it["OscChannelNum"].get<int>());
             info.channelInfo.channelName = QString::fromStdString(it["OscChannelName"]);
             info.voltageRange = static_cast<OscVoltageRange>(it["voltageRange"]);
             info.tGridValue = static_cast<OscTimeGridValue>(it["timeGridValue"]);
@@ -86,6 +88,11 @@ void AllEyeMapInfo::readSaveFile(const QString& fileName)
         SPDLOG_ERROR("解析json文件失败, 错误信息:{}, 文件路径: {}", e.what(), filePath.toStdString());
         createSaveFile(m_saveFileName);
     }
+    catch(...)
+    {
+        SPDLOG_ERROR("解析json文件失败, 文件路径: {}", filePath.toStdString());
+        createSaveFile(m_saveFileName);
+    }
 }
 
 /* 写入保存的文件 */
@@ -104,12 +111,13 @@ void AllEyeMapInfo::createSaveFile(const QString& fileName)
     for(int i = 0; i < 8; i++)
     {
         OneEyeMapInfo info;
+        info.uid = static_cast<EyeMapUID>(i + 1);
         info.num = i + 1;
         info.title = "通道" + QString::number(i + 1);
         info.titleBarColor = QColor("#2D2D31");
         info.isShow = false;
-        info.channelInfo.channel = 0;
-        info.channelInfo.channelName = getChannelName(0);
+        info.channelInfo.channel = static_cast<OscChnNum>(i + 1);
+        info.channelInfo.channelName = getChannelName(static_cast<OscChnNum>(i + 1));
         info.voltageRange = OscVoltageRange::CR_2V5;
         info.tGridValue = OscTimeGridValue::TGV_200NS;
         listInitEyeMapInfo.append(info);
@@ -122,6 +130,7 @@ void AllEyeMapInfo::createSaveFile(const QString& fileName)
     for(const auto& it : listInitEyeMapInfo)
     {
         nJson json2;
+        json2["uid"] = static_cast<int>(it.uid);
         json2["num"] = it.num;
         json2["title"] = it.title.toStdString();
         json2["titleBarColor"] = it.titleBarColor.name().toStdString();
@@ -159,6 +168,7 @@ void AllEyeMapInfo::updateSaveFile()
     for(const auto& it : listInitEyeMapInfo)
     {
         nJson json2;
+        json2["uid"] = static_cast<int>(it.uid);
         json2["num"] = it.num;
         json2["title"] = it.title.toStdString();
         json2["titleBarColor"] = it.titleBarColor.name().toStdString();
@@ -294,28 +304,28 @@ void AllEyeMapInfo::updateInitEyeMapInfo()
 }
 
 /* 获取通道号对应的通道名称 */
-QString AllEyeMapInfo::getChannelName(int channel)
+QString AllEyeMapInfo::getChannelName(OscChnNum channel)
 {
     switch (channel) 
     {
-        case 0:
+        case OscChnNum::Osc_None:
             return QString("请选择通道");
-        case 1:
-            return QString("通道1");
-        case 2:
-            return QString("通道2");
-        case 3:
-            return QString("通道3");
-        case 4:
-            return QString("通道4");
-        case 5:
-            return QString("通道5");
-        case 6:
-            return QString("通道6");
-        case 7:
-            return QString("通道7");
-        case 8:
-            return QString("通道8");
+        case OscChnNum::Osc1_CHA:
+            return QString("示波器1通道A");
+        case OscChnNum::Osc1_CHB:
+            return QString("示波器1通道B");
+        case OscChnNum::Osc2_CHA:
+            return QString("示波器2通道A");
+        case OscChnNum::Osc2_CHB:
+            return QString("示波器2通道B");
+        case OscChnNum::Osc3_CHA:
+            return QString("示波器3通道A");
+        case OscChnNum::Osc3_CHB:
+            return QString("示波器3通道B");
+        case OscChnNum::Osc4_CHA:
+            return QString("示波器4通道A");
+        case OscChnNum::Osc4_CHB:
+            return QString("示波器4通道B");
         default:
             return QString("请选择通道");
     }

+ 6 - 18
EyeMap/GlobalInfo/EyeMapInfo.h

@@ -4,33 +4,19 @@
 #include <QList>
 #include <QColor>
 #include "GlobalInfo.h"
-#include "OscDataInfo.h"
 
 
 class OneEyeMap;
 
 
-/* 示波器通道枚举值 */
-// enum class enum_OSCChannel
-// {
-//     Osc1_CHA = 1,
-//     Osc1_CHB,
-//     Osc2_CHA,
-//     Osc2_CHB,
-//     Osc3_CHA,
-//     Osc3_CHB,
-//     Osc4_CHA,
-//     Osc4_CHB,
-// };
-
 /* 保存实际可用的示波器通道信息
  * 通道号从1开始,0是未选择通道 */
 struct OneChannelInfo
 {
-    int channel;                            /* 通道号 */
+    OscChnNum channel;                      /* 通道号 */
     QString channelName;                    /* 通道名 */
 
-    OneChannelInfo() : channel(0), channelName("") {}
+    OneChannelInfo() : channel(OscChnNum::Osc_None), channelName("") {}
     OneChannelInfo& operator=(const OneChannelInfo& info)
     {
         channel = info.channel;
@@ -46,6 +32,7 @@ struct OneChannelInfo
 struct OneEyeMapInfo
 {
     bool isShow;                    /* 是否显示 */
+    EyeMapUID uid;                  /* 唯一标识符 */
     int num;                        /* 序号 */
     QString title;                  /* 标题 */
     QColor titleBarColor;           /* 颜色 */
@@ -53,11 +40,12 @@ struct OneEyeMapInfo
     OscVoltageRange voltageRange;   /* 电压范围 */
     OscTimeGridValue tGridValue;    /* 时间刻度 */
 
-    OneEyeMapInfo() : isShow(false), num(0), title(""), titleBarColor(QColor()), channelInfo(), 
+    OneEyeMapInfo() : isShow(false),uid(EyeMapUID::EMUID_1), num(0), title(""), titleBarColor(QColor()), channelInfo(), 
                     voltageRange(OscVoltageRange::CR_2V5), tGridValue(OscTimeGridValue::TGV_200NS) {}
     OneEyeMapInfo& operator=(const OneEyeMapInfo& info)
     {
         isShow = info.isShow;
+        uid = info.uid;
         num = info.num;
         title = info.title;
         titleBarColor = info.titleBarColor;
@@ -120,7 +108,7 @@ public:
     /* 更新初始化数组 */
     void updateInitEyeMapInfo();
     /* 获取通道号对应的通道名称 */
-    static QString getChannelName(int channel);
+    static QString getChannelName(OscChnNum channel);
 
 public:
     QList<OneEyeMap*> listEyeMapPtr;                    /* 保存8个眼图的指针 */

+ 5 - 0
EyeMap/GlobalInfo/GlobalInfo.cpp

@@ -1,5 +1,10 @@
 #include "GlobalInfo.h"
 
+
+/*********************** 全局变量 ************************/
+const int g_HorPixel = 1000;       /* 矩阵的水平像素数目 */
+const int g_VerPixel = 256;        /* 矩阵的垂直像素数目 */
+
 /*********************** 全局配置 ************************/
 GlobalConfig::~GlobalConfig()
 {

+ 107 - 0
EyeMap/GlobalInfo/GlobalInfo.h

@@ -8,7 +8,114 @@
 #define nJson nlohmann::json
 
 
+/*********************** 全局枚举值 ************************/
 
+/**
+ * @brief 眼图模块的唯一标识符,用这个为识别方式
+ * 
+ */
+enum class EyeMapUID
+{
+    EMUID_0 = 0,
+    EMUID_1 = 1,
+    EMUID_2,
+    EMUID_3,
+    EMUID_4,
+    EMUID_5,
+    EMUID_6,
+    EMUID_7,
+    EMUID_8,
+};
+
+/* 示波器通道枚举值 */
+enum class OscChnNum
+{
+    Osc_None = 0,
+    Osc1_CHA = 1,
+    Osc1_CHB,
+    Osc2_CHA,
+    Osc2_CHB,
+    Osc3_CHA,
+    Osc3_CHB,
+    Osc4_CHA,
+    Osc4_CHB,
+};
+
+
+
+
+/* 示波器通道 */
+enum class OscChannel
+{
+    CH_A = 0,
+    CH_B,
+};
+
+/* 示波器通道耦合方式 */
+enum class OscChannelCoupling
+{
+    AC = 0,
+    DC,
+};
+
+/* 示波器采样率,目前就只要这些 */
+enum class OscSampleRate
+{
+    SR_49KHZ = 0,
+    SR_96KHZ,
+    SR_781KHZ,
+    SR_12_5MHZ,
+    SR_100MHZ,
+};
+
+/* 示波器通道的输入档位 */
+// enum class OscVoltageRange
+enum class OscVoltageRange
+{
+    CR_100MV = 0,
+    CR_250MV,
+    CR_500MV,
+    CR_1V,
+    CR_2V5,
+    CR_5V,
+    CR_8V,
+};
+
+/* 触发方式 */
+enum class OscTriggerMode
+{
+    TM_RISE = 0,    /* 上升沿触发 */
+    TM_DOWN,        /* 下降沿触发 */
+    TM_DOUBLE,      /* 双边沿触发 */
+};
+
+/* 触发灵敏度 */
+enum class OscTriggerSensitivity
+{
+    TS_LOW = 0,     /* 低灵敏度 */
+    TS_HIGH,        /* 高灵敏度 */
+};
+
+/* 一个格子的时间刻度值单位 */
+enum class OscTimeGridValue
+{
+    TGV_20NS = 20,          /* 0.02us */
+    TGV_50NS = 50,          /* 0.05us */
+    TGV_100NS = 100,        /* 0.1us */
+    TGV_200NS = 200,        /* 0.2us */
+    TGV_500NS = 500,        /* 0.5us */
+    TGV_1US = 1000,         /* 1us */
+    TGV_2US = 2000,         /* 2us */
+    TGV_5US = 5000,         /* 5us */
+    TGV_10US = 10000,       /* 10us */
+    TGV_20US = 20000,       /* 20us */
+    TGV_100US = 100000,     /* 100us */
+};
+
+
+/*********************** 全局变量 ************************/
+extern const int g_HorPixel;      /* 矩阵的水平像素数目 */
+extern const int g_VerPixel;      /* 矩阵的垂直像素数目 */
 
 
 /*********************** 全局配置 ************************/

+ 140 - 27
EyeMap/GlobalInfo/OscDataInfo.cpp

@@ -1,13 +1,13 @@
 #include "OscDataInfo.h"
 
 #include "EyeMapInfo.h"
-
+#include "OneOscData.h"
 
 
 /* OscData使用的眼图矩阵 */
-EyeDataMatrix g_eyeDataMatrix;
+// EyeDataMatrix g_eyeDataMatrix;
 /* OscWidget使用的眼图矩阵 */
-EyeMapMatrix g_eyeMapMatrix;
+// EyeMapMatrix g_eyeMapMatrix;
 
 
 
@@ -16,11 +16,11 @@ EyeMapMatrix g_eyeMapMatrix;
 void EyeDataMatrix::initEyeData()
 {
     mutexEyeData.lock();
-    dataMatrix.clear();
+    // dataMatrix.clear();
 
-    for(int i = 0; i < 1000; i++)
+    for(int i = 0; i < g_HorPixel; i++)
     {
-        for(int j = 0; j < 256; j++)
+        for(int j = 0; j < g_VerPixel; j++)
         {
             dataMatrix[i][j].fCnt = 0.0;
             dataMatrix[i][j].data = 0;
@@ -55,9 +55,9 @@ void EyeDataMatrix::eyeStatisticalWeight()
     int num2 = 0;           /* 点数大于79999的个数 */
     double num3 = 0.0;
     int numMax = 79999;
-    for (int i = 0; i < 1000; i++)
+    for (int i = 0; i < g_HorPixel; i++)
     {
-        for (int j = 0; j < 256; j++)
+        for (int j = 0; j < g_VerPixel; j++)
         {
             if (dataMatrix[i][j].fCnt > 0.0)
             {
@@ -90,9 +90,9 @@ void EyeDataMatrix::eyeLessenTheBurden()
 		return;
 	}
 	int num = 0;
-	for (int i = 0; i < 1000; i++)
+	for (int i = 0; i < g_HorPixel; i++)
 	{
-		for (int j = 0; j < 256; j++)
+		for (int j = 0; j < g_VerPixel; j++)
 		{
 			if (dataMatrix[i][j].fCnt > 0.0)
 			{
@@ -107,10 +107,10 @@ void EyeDataMatrix::eyeLessenTheBurden()
 
 std::shared_ptr<Vec2D> EyeDataMatrix::eyeZoomOut()
 {
-	std::shared_ptr<Vec2D> array = std::make_shared<Vec2D>(1000, std::vector<EyeDataSample>(256));
-	for (int i = 0; i < 1000; i++)
+	std::shared_ptr<Vec2D> array = std::make_shared<Vec2D>(g_HorPixel, std::vector<EyeDataSample>(g_VerPixel));
+	for (int i = 0; i < g_HorPixel; i++)
 	{
-		for (int j = 0; j < 256; j++)
+		for (int j = 0; j < g_VerPixel; j++)
 		{
 			EyeDataSample pEyeData2;
 			pEyeData2.x = dataMatrix[i][j].x;
@@ -133,13 +133,13 @@ void EyeMapMatrix::initEyeMapData(int width, int height)
 {
     mutexEyeData.lock();
     /*先清空 */
-    dataMatrix.clear();
+    // dataMatrix.clear();
 
-    double saH = height / 256.0;
-    double saW = width / 1000.0;
-    for(int i = 0; i < 1000; i++)
+    double saH = height * 1.0 / g_VerPixel;
+    double saW = width * 1.0 / g_HorPixel;
+    for(int i = 0; i < g_HorPixel; i++)
     {
-        for(int j = 0; j < 256; j++)
+        for(int j = 0; j < g_VerPixel; j++)
         {
             dataMatrix[i][j].x = (int)(i * saW);
             dataMatrix[i][j].y = (int)(j * saH);
@@ -153,9 +153,9 @@ void EyeMapMatrix::initEyeMapData(int width, int height)
 /* 拷贝数据到数组中 */
 void EyeMapMatrix::copyDataMatrix(Vec2D& data)
 {
-    for (int i = 0; i < 1000; i++)
+    for (int i = 0; i < g_HorPixel; i++)
     {
-        for (int j = 0; j < 256; j++)
+        for (int j = 0; j < g_VerPixel; j++)
         {
             if (dataMatrix[i][j].Count != data[i][j].fCnt)
             {
@@ -180,9 +180,9 @@ void EyeMapMatrix::addColorBySample()
     int g = 0;
     int b = 0;
     double dec = 255 / 100.0;
-    for(int i = 0; i < 1000; i++)
+    for(int i = 0; i < g_HorPixel; i++)
     {
-        for(int j = 0; j < 256; j++)
+        for(int j = 0; j < g_VerPixel; j++)
         {
             if(dataMatrix[i][j].isDraw == false)
             {
@@ -259,6 +259,25 @@ void EyeMapMatrix::addColorBySample()
     }
 }
 
+/**
+ * @brief Destroy the Oscilloscope Data:: Oscilloscope Data object
+ * 
+ */
+OscilloscopeData::~OscilloscopeData()
+{
+    for(auto it = mapEyeDataMatrix.begin(); it != mapEyeDataMatrix.end(); ++it)
+    {
+        delete it.value();
+    }
+    for(auto it = mapEyeMapMatrix.begin(); it != mapEyeMapMatrix.end(); ++it)
+    {
+        delete it.value();
+    }
+    for(auto it = mapOscData.begin(); it != mapOscData.end(); ++it)
+    {
+        delete it.value();
+    }
+}
 
 
 /* 初始化示波器参数 */
@@ -271,16 +290,51 @@ void OscilloscopeData::initOscData()
     {
         EyeDataMatrix* pEyeDataMatrix = new EyeDataMatrix();
         pEyeDataMatrix->initEyeData();
-        mapEyeDataMatrix[chn.channel] = pEyeDataMatrix;
+        mapEyeDataMatrix.insert(chn.channel, pEyeDataMatrix);
 
         EyeMapMatrix* pEyeMapMatrix = new EyeMapMatrix();
-        pEyeMapMatrix->initEyeMapData(1000, 256);
-        mapEyeMapMatrix[chn.channel] = pEyeMapMatrix;
+        pEyeMapMatrix->initEyeMapData(g_HorPixel, g_VerPixel);
+        mapEyeMapMatrix.insert(chn.channel, pEyeMapMatrix);
+    }
+
+    /* 加载示波器动态库,初始化示波器相关内容,这里只是初始化完成了,并为开始采集 */
+    for(int i = 1; i <= 4; i++)
+    {
+        OneOscilloscopeData* pOscData = new OneOscilloscopeData();
+        pOscData->initOSC(i);
+        if(!pOscData->openOSC())
+        {
+            continue;
+        }
+        /* 获取零电压值 */
+        pOscData->getZeroVoltage();
+        /* 获取电压校准系数 */
+        pOscData->getVoltageCalibration();
+
+        mapOscData.insert(i, pOscData);
+    }
+    /* 设置示波器参数 */
+    for(const auto &it : GEyeMapInfo.listInitEyeMapInfo)
+    {
+        auto pOsc = GOscDataInfo.findOscData(it.channelInfo.channel);
+        if(pOsc == nullptr)
+        {
+            continue;
+        }
+        /* 设置采样率 */
+        pOsc->setSampleRate(OscSampleRate::SR_100MHZ);
+        /* 设置电压等级 */
+        if(static_cast<int>(it.channelInfo.channel) % 2 == 1)
+        {
+            pOsc->setChannelARange(it.voltageRange);
+        } else {
+            pOsc->setChannelBRange(it.voltageRange);
+        }
     }
 }
 
 /* 查找EyeDataMatrix */
-EyeDataMatrix* OscilloscopeData::findEyeDataMatrix(int channel)
+EyeDataMatrix* OscilloscopeData::findEyeDataMatrix(OscChnNum channel)
 {
     auto it = mapEyeDataMatrix.find(channel);
     if(it != mapEyeDataMatrix.end())
@@ -291,7 +345,7 @@ EyeDataMatrix* OscilloscopeData::findEyeDataMatrix(int channel)
 }
 
 /* 查找EyeMapMatrix */
-EyeMapMatrix* OscilloscopeData::findEyeMapMatrix(int channel)
+EyeMapMatrix* OscilloscopeData::findEyeMapMatrix(OscChnNum channel)
 {
     auto it = mapEyeMapMatrix.find(channel);
     if(it != mapEyeMapMatrix.end())
@@ -301,3 +355,62 @@ EyeMapMatrix* OscilloscopeData::findEyeMapMatrix(int channel)
     return nullptr;
 }
 
+/* 根据通道号查找示波器 */
+OneOscilloscopeData* OscilloscopeData::findOscData(OscChnNum oscNum)
+{
+    int num = 0;
+    switch (oscNum)
+    {
+        case OscChnNum::Osc1_CHA:
+            num = 1;
+            break;
+        case OscChnNum::Osc1_CHB:
+            num = 1;
+            break;
+        case OscChnNum::Osc2_CHA:
+            num = 2;
+            break;
+        case OscChnNum::Osc2_CHB:
+            num = 2;
+            break;
+        case OscChnNum::Osc3_CHA:
+            num = 3;
+            break;
+        case OscChnNum::Osc3_CHB:
+            num = 3;
+            break;
+        case OscChnNum::Osc4_CHA:
+            num = 4;
+            break;
+        case OscChnNum::Osc4_CHB:
+            num = 4;
+            break;
+        default:
+            break;
+    }
+    auto it = mapOscData.find(num);
+    if(it != mapOscData.end())
+    {
+        return it.value();
+    }
+    return nullptr;
+}
+
+/* 根据通道号设置电压范围 */
+void OscilloscopeData::setVoltageRange(OscChnNum oscNum, OscVoltageRange range)
+{
+    auto pOsc = findOscData(oscNum);
+    if(pOsc == nullptr)
+    {
+        return;
+    }
+    if(static_cast<int>(oscNum) % 2 == 1)
+    {
+        pOsc->setChannelARange(range);
+    }
+    else
+    {
+        pOsc->setChannelBRange(range);
+    }
+}
+

+ 21 - 78
EyeMap/GlobalInfo/OscDataInfo.h

@@ -8,74 +8,10 @@
 #include <QBrush>
 #include <QMap>
 
+#include "GlobalInfo.h"
 
-/* 示波器通道 */
-enum class OscChannel
-{
-    CH_A = 0,
-    CH_B,
-};
-
-/* 示波器通道耦合方式 */
-enum class OscChannelCoupling
-{
-    AC = 0,
-    DC,
-};
-
-/* 示波器采样率,目前就只要这些 */
-enum class OscSampleRate
-{
-    SR_49KHZ = 0,
-    SR_96KHZ,
-    SR_781KHZ,
-    SR_12_5MHZ,
-    SR_100MHZ,
-};
-
-/* 示波器通道的输入档位 */
-// enum class OscVoltageRange
-enum class OscVoltageRange
-{
-    CR_100MV = 0,
-    CR_250MV,
-    CR_500MV,
-    CR_1V,
-    CR_2V5,
-    CR_5V,
-    CR_8V,
-};
-
-/* 触发方式 */
-enum class OscTriggerMode
-{
-    TM_RISE = 0,    /* 上升沿触发 */
-    TM_DOWN,        /* 下降沿触发 */
-    TM_DOUBLE,      /* 双边沿触发 */
-};
-
-/* 触发灵敏度 */
-enum class OscTriggerSensitivity
-{
-    TS_LOW = 0,     /* 低灵敏度 */
-    TS_HIGH,        /* 高灵敏度 */
-};
+class OneOscilloscopeData;
 
-/* 一个格子的时间刻度值单位 */
-enum class OscTimeGridValue
-{
-    TGV_20NS = 20,          /* 0.02us */
-    TGV_50NS = 50,          /* 0.05us */
-    TGV_100NS = 100,        /* 0.1us */
-    TGV_200NS = 200,        /* 0.2us */
-    TGV_500NS = 500,        /* 0.5us */
-    TGV_1US = 1000,         /* 1us */
-    TGV_2US = 2000,         /* 2us */
-    TGV_5US = 5000,         /* 5us */
-    TGV_10US = 10000,       /* 10us */
-    TGV_20US = 20000,       /* 20us */
-    TGV_100US = 100000,     /* 100us */
-};
 
 
 struct EyeDataT
@@ -125,11 +61,11 @@ class EyeDataMatrix
 {   
 
 public:
-    EyeDataMatrix() : dataMatrix(1000, std::vector<EyeDataSample>(256)) {}
+    EyeDataMatrix() : dataMatrix(g_HorPixel, std::vector<EyeDataSample>(g_VerPixel)) {}
     ~EyeDataMatrix() {}
 
     Vec2D dataMatrix;
-    // EyeDataSample dataMatrix[1000][256];
+    // EyeDataSample dataMatrix[g_HorPixel][256];
     std::mutex mutexEyeData;
     
     void initEyeData();
@@ -148,7 +84,7 @@ private:
 
 /**
  * @brief 绘制到窗口的眼图数据
- *        总共有1000 * 245个数据点充满屏幕,每个数据点是个矩形
+ *        总共有g_HorPixel * 245个数据点充满屏幕,每个数据点是个矩形
  *        每个数据点的颜色深浅由fCnt决定,该点的数据越多,像素颜色越深
  * 
  */
@@ -186,7 +122,7 @@ using Vec2DMap = std::vector<std::vector<EyeMapDataSample>>;
 class EyeMapMatrix
 {
 public:
-    EyeMapMatrix() : dataMatrix(1000, std::vector<EyeMapDataSample>(256)) {}
+    EyeMapMatrix() : dataMatrix(g_HorPixel, std::vector<EyeMapDataSample>(g_VerPixel)) {}
     ~EyeMapMatrix() {}
 
     Vec2DMap dataMatrix;
@@ -229,7 +165,7 @@ public:
     /* 其他参数 */
     const int dataNumPerPixar = 1;  /* 这个是SetInfo的第一个参数,固定是1,在眼图中会使用 */
     /* 眼图参数 */
-    int eyeMapWidth = 1000;         /* 眼图x轴宽度(像素矩形的个数) */
+    int eyeMapWidth = g_HorPixel;         /* 眼图x轴宽度(像素矩形的个数) */
 
     
 
@@ -245,14 +181,14 @@ public:
  * 
  */
 
-#define OscDataInfo OscilloscopeData::getInstance()
+#define GOscDataInfo OscilloscopeData::getInstance()
 class OscilloscopeData
 {
     OscilloscopeData() {}
     OscilloscopeData(const OscilloscopeData&) = delete;
     OscilloscopeData& operator=(const OscilloscopeData&) = delete;
 public:
-    ~OscilloscopeData() {}
+    ~OscilloscopeData();
 
     static OscilloscopeData& getInstance()
     {
@@ -264,17 +200,24 @@ public:
     void initOscData();
 
     /* 查找EyeDataMatrix */
-    EyeDataMatrix* findEyeDataMatrix(int channel);
+    EyeDataMatrix* findEyeDataMatrix(OscChnNum channel);
     /* 查找EyeMapMatrix */
-    EyeMapMatrix* findEyeMapMatrix(int channel);
+    EyeMapMatrix* findEyeMapMatrix(OscChnNum channel);
+    /* 获取示波器列表 */
+    QMap<int, OneOscilloscopeData*>& getOscData() { return mapOscData; }
+    /* 根据通道号查找示波器 */
+    OneOscilloscopeData* findOscData(OscChnNum oscNum);
+    /* 根据通道号设置电压范围 */
+    void setVoltageRange(OscChnNum oscNum, OscVoltageRange range);
 
 private:
     /************ 数据相关 ************/
     /* 眼图数据矩阵 */
-    QMap<int, EyeDataMatrix*> mapEyeDataMatrix;
+    QMap<OscChnNum, EyeDataMatrix*> mapEyeDataMatrix;
     /* 眼图颜色矩阵 */
-    QMap<int, EyeMapMatrix*> mapEyeMapMatrix;
-
+    QMap<OscChnNum, EyeMapMatrix*> mapEyeMapMatrix;
+    /* 示波器类指针,int是示波器编号 */
+    QMap<int, OneOscilloscopeData*> mapOscData;
 };
 
 

+ 32 - 6
EyeMap/OneEyeMap/OneEyeMap.cpp

@@ -49,6 +49,12 @@ OneEyeMap::OneEyeMap(QWidget *parent) :
     m_rectScaleValue.setY(ui->widget_title->height());
     m_rectScaleValue.setWidth(this->width());
     m_rectScaleValue.setHeight(this->height() - ui->widget_title->height());
+    /* 设置参考颜色区域 */
+    m_rectRefColor.setX(m_rectScaleValue.width() - m_rightMargin - 60);
+    m_rectRefColor.setY(m_rectScaleValue.y() + 7);
+    m_rectRefColor.setWidth(60);
+    m_rectRefColor.setHeight(10);
+
     /* 设置眼图区域 */
     m_rectEyeMap.setX(m_leftMargin);
     m_rectEyeMap.setY(m_rectScaleValue.y() + m_topMargin);
@@ -60,7 +66,7 @@ OneEyeMap::OneEyeMap(QWidget *parent) :
     /* 设置定时器 */
     m_timer.setTimerType(Qt::PreciseTimer);
     m_timer.setSingleShot(false);
-    // m_timer.start(16);      /* 16ms刷新一次,大约60帧 */
+    m_timer.start(100);      /* 100ms刷新一次,大约10帧 */
 
     connect(this, &OneEyeMap::signal_update, this, &OneEyeMap::do_update);
     connect(&m_timer, &QTimer::timeout, this, &OneEyeMap::do_update);
@@ -76,12 +82,12 @@ OneEyeMap::~OneEyeMap()
 }
 
 /* 根据通道号获取数据指针 */
-void OneEyeMap::getEyeDataPtrFromOscData(int channel)
+void OneEyeMap::setEyeDataPtrFromOscData(OscChnNum channel)
 {
-    m_eyeMapMatrix = OscDataInfo.findEyeMapMatrix(channel);
+    m_eyeMapMatrix = GOscDataInfo.findEyeMapMatrix(channel);
     if(m_eyeMapMatrix == nullptr)
     {
-        SPDLOG_LOGGER_ERROR(m_logger, "获取颜色矩阵错误! 通道号: {}", channel);
+        SPDLOG_LOGGER_ERROR(m_logger, "获取颜色矩阵错误! 通道号: {}", static_cast<int>(channel));
         return;
     }
     m_eyeMapMatrix->initEyeMapData(this->width(), this->height());
@@ -158,6 +164,10 @@ void OneEyeMap::do_update()
  */
 void OneEyeMap::paintEvent(QPaintEvent *event)
 {
+    if(m_eyeMapMatrix == nullptr)
+    {
+        return;
+    }
     m_eyeMapMatrix->mutexEyeData.lock();
     QPainter painter(this);
     
@@ -191,6 +201,11 @@ void OneEyeMap::resizeEvent(QResizeEvent *event)
     m_rectScaleValue.setY(ui->widget_title->height());
     m_rectScaleValue.setWidth(this->width());
     m_rectScaleValue.setHeight(this->height() - ui->widget_title->height());
+    /* 设置参考颜色区域 */
+    m_rectRefColor.setX(m_rectScaleValue.width() - m_rightMargin - 60);
+    m_rectRefColor.setY(m_rectScaleValue.y() + 7);
+    m_rectRefColor.setWidth(60);
+    m_rectRefColor.setHeight(10);
     /* 设置眼图区域 */
     m_rectEyeMap.setX(m_leftMargin);
     m_rectEyeMap.setY(m_rectScaleValue.y() + m_topMargin);
@@ -239,6 +254,17 @@ void OneEyeMap::drawScaleValue(QPainter &painter)
         painter.drawText(rectText, Qt::AlignCenter, getTimeValue(i));
     }
 
+    /* 绘制参渐变考颜色 */
+    QLinearGradient linearGradient(m_rectRefColor.topLeft(), m_rectRefColor.bottomRight());
+    linearGradient.setColorAt(0, QColor("#003590"));
+    linearGradient.setColorAt(0.4, QColor(0, 255, 255));
+    linearGradient.setColorAt(0.6, QColor(0, 255, 0));
+    linearGradient.setColorAt(0.8, QColor(255, 255, 0));
+    linearGradient.setColorAt(1, QColor("#FF4123"));
+    painter.setBrush(linearGradient);
+    painter.setPen(Qt::NoPen);
+    painter.drawRect(m_rectRefColor);
+
 }
 
 /* 绘制刻度 */
@@ -360,9 +386,9 @@ void OneEyeMap::drawEyeMap(QPainter &painter)
 {
     /* 绘制眼图,就是绘制 1000 * 256 个矩形 */
     painter.setPen(Qt::NoPen);
-    for(int i = 0; i < 1000; i++)
+    for(int i = 0; i < g_HorPixel; i++)
     {
-        for(int j = 0; j < 256; j++)
+        for(int j = 0; j < g_VerPixel; j++)
         {
             if(m_eyeMapMatrix->dataMatrix[i][j].isDraw == false)
             {

+ 5 - 2
EyeMap/OneEyeMap/OneEyeMap.h

@@ -8,6 +8,8 @@
 #include "spdlog/spdlog.h"
 
 #include "EyeMapInfo.h"
+#include "OscDataInfo.h"
+
 
 namespace Ui {
 class OneEyeMap;
@@ -22,7 +24,7 @@ public:
     ~OneEyeMap();
 
     /* 根据通道号获取数据指针 */
-    void getEyeDataPtrFromOscData(int channel);
+    void setEyeDataPtrFromOscData(OscChnNum channel);
 
     /* 设置序号 */
     void setNum(int num) { m_info.num = num; }
@@ -96,8 +98,9 @@ private:
 
     QTimer m_timer;
     /* 眼图显示布局 */
-    QRect m_rectScaleValue;             /* 刻度值区域 */
+    QRect m_rectScaleValue;             /* 刻度值区域,除了标题栏之外的其他区域,包括下面的眼图区域 */
     QRect m_rectEyeMap;                 /* 眼图区域 */
+    QRect m_rectRefColor;               /* 参考颜色区域 */
     int m_leftMargin = 0;               /* 眼图距离刻度区域的左边距 */
     int m_topMargin = 0;                /* 眼图距离刻度区域的上边距 */
     int m_rightMargin = 0;              /* 眼图距离刻度区域的右边距 */

+ 80 - 7
EyeMap/OscData/OneOscData.cpp

@@ -34,8 +34,13 @@ OneOscilloscopeData::~OneOscilloscopeData()
     }
 }
 
-/* 初始化示波器 */
-void OneOscilloscopeData::initOsc()
+/**
+ * @brief 初始化示波器,传入通道A和B的通道号,1和2是主设备,其他都是从设备
+ * 
+ * @param chA 
+ * @param chB 
+ */
+void OneOscilloscopeData::initOSC(int oscNum)
 {
     m_logger = spdlog::get("OscData");
     if(m_logger == nullptr)
@@ -43,9 +48,34 @@ void OneOscilloscopeData::initOsc()
         SPDLOG_ERROR("获取 OscData logger 失败");
         return;
     }
+    m_oscNum = oscNum;
+    QString libName = QApplication::applicationDirPath();
+    if(oscNum == 1)
+    {
+        libName = libName + QString("/USBInterFace.dll");
+    }
+    else if(oscNum == 2)
+    {
+        libName = libName + QString("/USBInterFace2.dll");
+    }
+    else if (oscNum == 3)
+    {
+        libName = libName + QString("/USBInterFace3.dll");
+    }
+    else if (oscNum == 4)
+    {
+        libName = libName + QString("/USBInterFace4.dll");
+    }
+    else
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "示波器编号错误!");
+        return;
+    }
+
     m_usbInterface = std::make_shared<USBInterface>();
-    if(!m_usbInterface->loadLib(QApplication::applicationDirPath()))
+    if(!m_usbInterface->loadLib(libName))
     {
+        SPDLOG_LOGGER_ERROR(m_logger, "加载USBInterFace库失败! 路径:{}", libName.toStdString());
         return;
     }
     /* 分配缓冲区内存 */
@@ -64,7 +94,8 @@ bool OneOscilloscopeData::openOSC()
     }
     /* 指定示波器设备型号,OSCA02是6 */
     m_usbInterface->specifyDevId(6);
-    auto ret = m_usbInterface->devOpen();
+    // auto ret = m_usbInterface->devOpen();
+    auto ret = m_usbInterface->devOpenWithID(m_oscNum);
     if(ret != 0)
     {
         SPDLOG_LOGGER_ERROR(m_logger, "打开示波器失败!");
@@ -91,6 +122,12 @@ bool OneOscilloscopeData::openOSC()
     /* 获取电压校准系数 */
     getVoltageCalibration();
 
+    /* 获取内存指针 */
+    if(!getEyeDataMatrixPtr())
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "获取眼图数据矩阵指针失败!");
+        return false;
+    }
 
     m_isOpen = true;
     return true;
@@ -672,7 +709,6 @@ void OneOscilloscopeData::threadCaptureData()
         }
         // SPDLOG_LOGGER_DEBUG(m_logger, "数据通过USB传输完成");
         /* 取出数据 */
-        // buffer = m_ringQueue.back();
         m_mutexBuffer.lock();
         std::memcpy(m_buffer, m_devBuffer, BUFFER_SIZE);
         m_mutexBuffer.unlock();
@@ -871,7 +907,7 @@ void OneOscilloscopeData::parseEyeMapData(OscChannel chn, unsigned char* buffer,
 
         /* 进行插值,每个采样点之间插值根据实际的采样点来计算,插值后的采样点个数比1000略大 */
         int numMulti2 = 0;
-        double numMulti1 = 1000.0 / saTotal;
+        double numMulti1 = g_HorPixel * 1.0 / saTotal;
         if(numMulti1 > 1.0 && numMulti1 < 2.0)
         {
             numMulti2 = 1;
@@ -1026,7 +1062,7 @@ void OneOscilloscopeData::parseEyeMapData(OscChannel chn, unsigned char* buffer,
         /* 取出一个跳变沿,将其分布在整个 1000 * 256像素的矩阵中 */
         std::vector<EyeDataT>& vecTmp = vec2DEyeData[i];
         numTmp = vecTmp.size();
-        num20 = numTmp / 1000.f;    /* x轴方向1000分 */
+        num20 = numTmp * 1.0 / g_HorPixel;    /* x轴方向1000分 */
         for (int i = 0; i < numTmp; i++)
         {
             if (vecTmp[i].isEyeData)
@@ -1162,3 +1198,40 @@ double OneOscilloscopeData::calibrationVoltageB(uint8_t& data)
     return m_voltageCalibrationB * m_rangeRatioB * (data - m_zeroVoltageB);
 }
 
+
+/* 根据示波器编号获取示波器的数据矩阵指针 */
+bool OneOscilloscopeData::getEyeDataMatrixPtr()
+{
+    int chnA = m_oscNum * 2 - 1;
+    int chnB = m_oscNum * 2;
+    OscChnNum chnNumA = static_cast<OscChnNum>(chnA);
+    OscChnNum chnNumB = static_cast<OscChnNum>(chnB);
+
+    bool ret = true;
+    m_eyeDataMatrix_A = GOscDataInfo.findEyeDataMatrix(chnNumA);
+    if(m_eyeDataMatrix_A == nullptr)
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "示波器{} 通道A数据矩阵指针为空!", m_oscNum);
+        ret = false;
+    }
+    m_eyeDataMatrix_B = GOscDataInfo.findEyeDataMatrix(chnNumB);
+    if(m_eyeDataMatrix_B == nullptr)
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "示波器{} 通道B数据矩阵指针为空!", m_oscNum);
+        ret = false;
+    }
+
+    m_eyeMapMatrix_A = GOscDataInfo.findEyeMapMatrix(chnNumA);
+    if(m_eyeMapMatrix_A == nullptr)
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "示波器{} 通道A眼图矩阵指针为空!", m_oscNum);
+        ret = false;
+    }
+    m_eyeMapMatrix_B = GOscDataInfo.findEyeMapMatrix(chnNumB);
+    if(m_eyeMapMatrix_B == nullptr)
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "示波器{} 通道B眼图矩阵指针为空!", m_oscNum);
+        ret = false;
+    }
+    return ret;
+}

+ 15 - 8
EyeMap/OscData/OneOscData.h

@@ -10,7 +10,7 @@
 #include "OscDataInfo.h"
 #include "RingQueue/RingQueue.hpp"
 
-#define OneOscData OneOscilloscopeData::getInstance()
+#define OneOscData OneOscilloscopeData
 
 class OneOscilloscopeData : public QObject
 {
@@ -26,13 +26,13 @@ public:
     OneOscilloscopeData();
     ~OneOscilloscopeData();
 
-    static OneOscilloscopeData& getInstance()
-    {
-        static OneOscilloscopeData instance;
-        return instance;
-    }
+    // static OneOscilloscopeData& getInstance()
+    // {
+    //     static OneOscilloscopeData instance;
+    //     return instance;
+    // }
     /* 初始化示波器 */
-    void initOsc();
+    void initOSC(int oscNum);
     /* 打开示波器 */
     bool openOSC();
     /* 关闭示波器 */
@@ -97,6 +97,9 @@ public:
     inline double calibrationVoltageA(uint8_t& data);
     inline double calibrationVoltageB(uint8_t& data);
 
+    /* 根据示波器编号获取示波器的数据矩阵指针 */
+    bool getEyeDataMatrixPtr();
+
 private:
     std::shared_ptr<spdlog::logger> m_logger = nullptr;
     std::shared_ptr<USBInterface> m_usbInterface = nullptr;
@@ -114,8 +117,11 @@ private:
     unsigned char* m_buffer = nullptr;                      /* 缓冲区指针,用于存储拷贝出来的数据 */
     unsigned char* m_bufferChnA = nullptr;                  /* 通道A的缓冲区指针 */
     unsigned char* m_bufferChnB = nullptr;                  /* 通道B的缓冲区指针 */
-    RingQueue<unsigned char*> m_ringQueue;                  /* 环形队列,用于存储示波器采集到的数据 */
+    // RingQueue<unsigned char*> m_ringQueue;                  /* 环形队列,用于存储示波器采集到的数据 */
+
+    int m_oscNum = 0;                                       /* 示波器编号 */
 
+    /************* 示波器控制相关 *************/
     unsigned char m_ctrlByte0 = 0;                          /* 控制字节0 */
     unsigned char m_ctrlByte1 = 0;                          /* 控制字节1 */
 
@@ -138,6 +144,7 @@ private:
     EyeDataMatrix* m_eyeDataMatrix_B = nullptr;               /* 眼图数据矩阵,B通道 */
     EyeMapMatrix* m_eyeMapMatrix_A = nullptr;                 /* 眼图矩阵,A通道 */
     EyeMapMatrix* m_eyeMapMatrix_B = nullptr;                 /* 眼图矩阵,B通道 */
+
 };
 
 

+ 17 - 0
EyeMap/ParameterConfig/OneParamItem/oneparamitem.cpp

@@ -19,6 +19,9 @@ OneParamItem::OneParamItem(QWidget *parent) :
         return;
     }
 
+    /* 注册事件过滤器 */
+    ui->comboBox_voltage->installEventFilter(this);
+
     /* 加载QSS */
     QFile fileQss(":/qss/ParameterConfig/OneParamItem/OneParamItem.qss");
     if(fileQss.open(QFile::ReadOnly))
@@ -63,6 +66,20 @@ void OneParamItem::setInfo(const OneEyeMapInfo &info)
     ui->comboBox_voltage->setCurrentText(getVoltageRangeStr(info.voltageRange));
 }
 
+/* 事件过滤器 */
+bool OneParamItem::eventFilter(QObject *watched, QEvent *event)
+{
+    if(watched == ui->comboBox_voltage)
+    {
+        if(event->type() == QEvent::Wheel)
+        {
+            return true;
+        }
+    }
+    return QWidget::eventFilter(watched, event);
+}
+
+
 /* 选择了电压值 */
 void OneParamItem::do_selectVoltage(int index)
 {

+ 3 - 0
EyeMap/ParameterConfig/OneParamItem/oneparamitem.h

@@ -20,6 +20,9 @@ public:
     /* 设置信息 */
     void setInfo(const OneEyeMapInfo &info);
 
+protected:
+    /* 事件过滤器 */
+    bool eventFilter(QObject *watched, QEvent *event) override;
     
 private slots:
     /* 选择了电压值 */

+ 16 - 0
EyeMap/ParameterConfig/paramconfig.cpp

@@ -35,6 +35,9 @@ ParamConfig::ParamConfig(QWidget *parent) :
     /* 设置背景透明 */
     this->setAttribute(Qt::WA_TranslucentBackground);
 
+    /* 设置事件过滤器 */
+    ui->comboBox_time->installEventFilter(this);
+
     /* 设置tableView */
     // initTable();
 
@@ -99,6 +102,19 @@ void ParamConfig::createItem(const QList<OneEyeMapInfo> &listInfo)
     layoutItem();
 }
 
+/* 事件过滤器 */
+bool ParamConfig::eventFilter(QObject *watched, QEvent *event)
+{
+    if(watched == ui->comboBox_time)
+    {
+        if(event->type() == QEvent::Wheel)
+        {
+            return true;
+        }
+    }
+    return QWidget::eventFilter(watched, event);
+}
+
 
 // /* 初始化表格 */
 // void ParamConfig::initTable()

+ 3 - 0
EyeMap/ParameterConfig/paramconfig.h

@@ -26,6 +26,9 @@ public:
     /* 创建项 */
     void createItem(const QList<OneEyeMapInfo> &listInfo);
 
+protected:
+    /* 事件过滤器 */
+    bool eventFilter(QObject *watched, QEvent *event) override;
 
 private:
     // /* 初始化表格 */

+ 24 - 4
EyeMap/SettingNum/OneItem/onesettingitem.cpp

@@ -3,6 +3,7 @@
 
 #include <QDebug>
 #include <QFile>
+#include <QEvent>
 #include "colordialogapi.h"
 
 OneSettingItem::OneSettingItem(QWidget *parent) :
@@ -82,10 +83,10 @@ void OneSettingItem::setItemInfo(const OneEyeMapInfo& info)
 void OneSettingItem::setChannelList(const QList<OneChannelInfo>& list)
 {
     ui->comboBox->clear();
-    ui->comboBox->addItem(GEyeMapInfo.getChannelName(0), 0);
+    ui->comboBox->addItem(GEyeMapInfo.getChannelName(OscChnNum::Osc_None), 0);
     for(const auto &it : list)
     {
-        ui->comboBox->addItem(it.channelName, it.channel);
+        ui->comboBox->addItem(it.channelName, static_cast<int>(it.channel));
     }
     /* 设置当前选项 */
     ui->comboBox->setCurrentText(eyeMapInfo.channelInfo.channelName);
@@ -102,11 +103,30 @@ void OneSettingItem::setCurrentChannel(const QString& channelName)
 OneChannelInfo OneSettingItem::getCurrentChannel()
 {
     OneChannelInfo info;
-    info.channel = ui->comboBox->currentData().toInt();
+    info.channel = static_cast<OscChnNum>(ui->comboBox->currentData().toInt());
     info.channelName = ui->comboBox->currentText();
     return info;
 }
 
+/* 滚轮事件,禁止选择栏滚动 */
+// void OneSettingItem::wheelEvent(QWheelEvent *event)
+// {
+//     event->ignore();
+// }
+
+/* 事件过滤器 */
+bool OneSettingItem::eventFilter(QObject *watched, QEvent *event)
+{
+    if(watched == ui->comboBox)
+    {
+        if(event->type() == QEvent::Wheel)
+        {
+            return true;
+        }
+    }
+    return QWidget::eventFilter(watched, event);
+}
+
 /* 设置颜色 */
 void OneSettingItem::do_pBtn_background()
 {
@@ -128,6 +148,6 @@ void OneSettingItem::do_select_channel(int index)
     {
         return;
     }
-    emit signal_select_channel(ui->comboBox->currentData().toInt(), ui->comboBox->currentText());
+    emit signal_select_channel(static_cast<OscChnNum>(ui->comboBox->currentData().toInt()), ui->comboBox->currentText());
 }
 

+ 8 - 1
EyeMap/SettingNum/OneItem/onesettingitem.h

@@ -36,7 +36,14 @@ public:
 
 signals:
     /* 选择了通道号信号 */
-    void signal_select_channel(const int channel, const QString& channelName);
+    void signal_select_channel(const OscChnNum channel, const QString& channelName);
+
+protected:
+    /* 滚轮事件 */
+    // void wheelEvent(QWheelEvent *event) override;
+    /* 事件过滤器 */
+    bool eventFilter(QObject *watched, QEvent *event) override;
+
 private slots:
     /* 设置颜色 */
     void do_pBtn_background();

+ 19 - 2
EyeMap/SettingNum/settingnum.cpp

@@ -21,6 +21,10 @@ SettingNum::SettingNum(QDialog *parent) :
         qDebug() << "获取 EyeMap logger 失败";
         return;
     }
+    /* 注册事件过滤,主要是消除滚轮对comboBox的影响 */
+    ui->comboBox_rowNum->installEventFilter(this);
+    ui->comboBox_columnNum->installEventFilter(this);
+
     /* 设置无边框和背景透明 */
     this->setWindowFlags(Qt::FramelessWindowHint);
     this->setAttribute(Qt::WA_TranslucentBackground);
@@ -136,6 +140,19 @@ void SettingNum::paintEvent(QPaintEvent *event)
     // painter.drawImage(QPoint(0,0),m_shadow->image());
 }
 
+/* 事件过滤器 */
+bool SettingNum::eventFilter(QObject *watched, QEvent *event)
+{
+    if(watched == ui->comboBox_rowNum || watched == ui->comboBox_columnNum)
+    {
+        if(event->type() == QEvent::Wheel)
+        {
+            return true;
+        }
+    }
+    return QWidget::eventFilter(watched, event);
+}
+
 /* 关闭按钮槽函数 */
 void SettingNum::do_pBtn_close()
 {
@@ -175,14 +192,14 @@ void SettingNum::do_selectRowAndColumn(int index)
 }
 
 /* 通道选择槽函数,选择了一个通道,取消其他项可能已经选择的相同通道 */
-void SettingNum::do_selectChannel(const int channel, const QString &channelName)
+void SettingNum::do_selectChannel(const OscChnNum channel, const QString &channelName)
 {
     auto sender = qobject_cast<OneSettingItem*>(QObject::sender());
     for(auto item : m_listItem)
     {
         if((item->getCurrentChannel().channel == channel) && (item != sender))
         {
-            item->setCurrentChannel(GEyeMapInfo.getChannelName(0));
+            item->setCurrentChannel(GEyeMapInfo.getChannelName(OscChnNum::Osc_None));
         }
     }
 }

+ 3 - 1
EyeMap/SettingNum/settingnum.h

@@ -30,6 +30,8 @@ public:
 
 protected:
     void paintEvent(QPaintEvent *event) override;
+    /* 事件过滤器 */
+    bool eventFilter(QObject *watched, QEvent *event) override;
 
 private slots:
     /* 关闭按钮槽函数 */
@@ -41,7 +43,7 @@ private slots:
     /* 选择行和列槽函数 */
     void do_selectRowAndColumn(int index);
     /* 通道选择槽函数,选择了一个通道,取消其他项可能已经选择的相同通道 */
-    void do_selectChannel(const int channel, const QString &channelName);
+    void do_selectChannel(const OscChnNum channel, const QString &channelName);
 
 private:
     /* 布局item */

+ 2 - 2
EyeMap/main.cpp

@@ -28,8 +28,8 @@ int main(int argc, char* argv[])
     addFont();
     /* 初始化数据 */
     GEyeMapInfo.initEyeMapInfo();
-    /* 初始化示波器的数据 */
-    OscDataInfo.initOscData();
+    /* 初始化示波器的数据内存区域 */
+    GOscDataInfo.initOscData();
 
     EyeMapWidget w;
     w.show();

+ 3 - 3
USBInterFace/USBInterFace.cpp

@@ -14,13 +14,13 @@ USBInterface::USBInterface()
  * @return true 
  * @return false 
  */
-bool USBInterface::loadLib(const QString& libPath)
+bool USBInterface::loadLib(const QString& libName)
 {
-    if(libPath.isEmpty())
+    if(libName.isEmpty())
     {
         return false;
     }
-    QString libName = libPath + "/USBInterFace.dll";
+    // QString libName = libPath + "/USBInterFace.dll";
     
     if(m_lib.isLoaded())
     {

+ 1 - 1
USBInterFace/USBInterFace.h

@@ -39,7 +39,7 @@ using EventCheck = unsigned long(*)(long Timeout);
 public:
     USBInterface();
     /* 加载动态库 */
-    bool loadLib(const QString& libPath);
+    bool loadLib(const QString& libName);
     /* 指定设备编号 */
     void specifyDevId(int idx);
     /* 打开设备 */