mrDarker
2025-10-22 e8a27bb203fe2aff70390a5eca002d7438da9b0f
SourceCode/Bond/Servo/CMaster.cpp
@@ -6,35 +6,10 @@
#include "RecipeManager.h"
#include <fstream>
#include "SerializeUtil.h"
#include "CServoUtilsTool.h"
namespace SERVO {
   static std::unordered_map<int, std::vector<std::string>> MACHINE_DATA_TYPES = {
   {EQ_ID_Bonder1, {
      "气囊压力", "上腔压力", "管道真空规值", "腔体真空规值",
      "上腔温度1", "上腔温度2", "上腔温度3", "上腔温度4",
      "上腔温度5", "上腔温度6", "下腔温度1", "下腔温度2",
      "下腔温度3", "下腔温度4", "下腔温度5", "下腔温度6"
   }},
   {EQ_ID_Bonder2, {
      "气囊压力", "上腔压力", "管道真空规值", "腔体真空规值",
      "上腔温度1", "上腔温度2", "上腔温度3", "上腔温度4",
      "上腔温度5", "上腔温度6", "下腔温度1", "下腔温度2",
      "下腔温度3", "下腔温度4", "下腔温度5", "下腔温度6"
   }},
   {EQ_ID_VACUUMBAKE, {
      "A腔真空规值", "A腔温控1", "A腔温控2", "A腔温控4",
      "A腔温控5", "A腔温控6", "A腔温控7", "B腔真空规值",
      "B腔温控1", "B腔温控2", "B腔温控4", "B腔温控5",
      "B腔温控6", "B腔温控7"
   }},
   {EQ_ID_BAKE_COOLING, {
      "A烘烤温控1", "A烘烤温控2", "A烘烤温控4", "A烘烤温控5",
      "A烘烤温控6", "A烘烤温控7", "B烘烤温控1", "B烘烤温控2",
      "B烘烤温控4", "B烘烤温控5", "B烘烤温控6", "B烘烤温控7"
   }}
   };
   static inline int64_t now_ms_epoch() {
      using namespace std::chrono;
      return duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
@@ -262,6 +237,10 @@
      // 监控bit线程
      m_hReadBitsThreadHandle = (HANDLE)_beginthreadex(NULL, 0, SERVO::ReadBitsThreadFunction, this,
         0, &m_nReadBitsThreadAddr);
      // 曲线服务
      CreateDAQBridgeServer();
      LOGI("<Master>初始化完成.");
@@ -1662,7 +1641,8 @@
            };
            CGlass* pGlass = ((CEquipment*)pEquipment)->getGlassFromSlot(0);
            auto& bonderTypes = MACHINE_DATA_TYPES[eqid];
            auto& dataTypes = CServoUtilsTool::getEqDataTypes();
            auto& bonderTypes = dataTypes[eqid];
            for (const auto& mapping : bonderMapping) {
               int paramIndex = mapping.first;
               int channel = mapping.second;
@@ -1683,16 +1663,17 @@
            };
            CGlass* pGlass = ((CEquipment*)pEquipment)->getGlassFromSlot(0);
            auto& bonderTypes = MACHINE_DATA_TYPES[eqid];
            auto& dataTypes = CServoUtilsTool::getEqDataTypes();
            auto& vacuumbakeTypes = dataTypes[eqid];
            for (const auto& mapping : vacuumMapping) {
               int paramIndex = mapping.first;
               int channel = mapping.second;
               if (paramIndex < params.size() && channel - 1 < bonderTypes.size()) {
               if (paramIndex < params.size() && channel - 1 < vacuumbakeTypes.size()) {
                  if (m_pCollector != nullptr)
                     m_pCollector->buffersPush(eqid, channel, ts, params.at(paramIndex).getDoubleValue());
                  if (pGlass != nullptr)
                     pGlass->addSVData(eqid, bonderTypes[channel], ts, params.at(paramIndex).getDoubleValue());
                     pGlass->addSVData(eqid, vacuumbakeTypes[channel], ts, params.at(paramIndex).getDoubleValue());
               }
            }
         }
@@ -1704,7 +1685,8 @@
            };
            CGlass* pGlass = ((CEquipment*)pEquipment)->getGlassFromSlot(0);
            auto& coolingTypes = MACHINE_DATA_TYPES[eqid];
            auto& dataTypes = CServoUtilsTool::getEqDataTypes();
            auto& coolingTypes = dataTypes[eqid];
            for (const auto& mapping : coolingMapping) {
               int paramIndex = mapping.first;
               int channel = mapping.second;
@@ -3161,19 +3143,20 @@
         // 2) 为通道设置“曲线名称”
         auto& bonderTypes = MACHINE_DATA_TYPES[EQ_ID_Bonder1];
         auto& dataTypes = CServoUtilsTool::getEqDataTypes();
         auto& bonderTypes = dataTypes[EQ_ID_Bonder1];
         for (size_t i = 0; i < bonderTypes.size(); ++i) {
            m_pCollector->buffersSetChannelName(EQ_ID_Bonder1, i + 1, bonderTypes[i].c_str());
            m_pCollector->buffersSetChannelName(EQ_ID_Bonder2, i + 1, bonderTypes[i].c_str());
         }
         auto& vacuumbakeTypes = MACHINE_DATA_TYPES[EQ_ID_VACUUMBAKE];
         for (size_t i = 0; i < bonderTypes.size(); ++i) {
         auto& vacuumbakeTypes = dataTypes[EQ_ID_VACUUMBAKE];
         for (size_t i = 0; i < vacuumbakeTypes.size(); ++i) {
            m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, i + 1, vacuumbakeTypes[i].c_str());
         }
         auto& coolingTypes = MACHINE_DATA_TYPES[EQ_ID_BAKE_COOLING];
         for (size_t i = 0; i < bonderTypes.size(); ++i) {
         auto& coolingTypes = dataTypes[EQ_ID_BAKE_COOLING];
         for (size_t i = 0; i < coolingTypes.size(); ++i) {
            m_pCollector->buffersSetChannelName(EQ_ID_VACUUMBAKE, i + 1, coolingTypes[i].c_str());
         }
      }