mrDarker
2025-06-17 58b5bb07de4bcbf670db5ad79ff8b9bd7afc1e28
SourceCode/Bond/Servo/CEFEM.cpp
@@ -22,6 +22,10 @@
      m_pPort[3] = nullptr;
      m_pAligner = nullptr;
      m_pFliper = nullptr;
      m_robotData.status = ROBOT_STATUS::Idle;
      m_robotData.position = ROBOT_POSITION::Port1;
      m_robotData.armState[0] = FALSE;
      m_robotData.armState[1] = FALSE;
   }
   CEFEM::~CEFEM()
@@ -329,6 +333,11 @@
      cmds[1].rcmd = static_cast<short>(SERVO::RCMD::Robot_home);
      return robotCmds(cmds, 2, onWritedBlock);
   }
   RMDATA& CEFEM::getRobotMonitoringData()
   {
      return m_robotData;
   }
   void CEFEM::init()
@@ -692,6 +701,28 @@
   {
      __super::onReceiveLBData(pszData, size);
      // 解释得到Robot状态
      // 地址从(0x3500 - 0x3000)开始
      int index = 0x500;
      for (int i = 0; i < 6; i++) {
         if (isBitOn(pszData, size, index + i)) {
            m_robotData.status = (ROBOT_STATUS)i;
            break;
         }
      }
      index += 8;
      for (int i = 0; i < 11; i++) {
         if (isBitOn(pszData, size, index + i)) {
            m_robotData.position = (ROBOT_POSITION)i;
            break;
         }
      }
      index += 16;
      m_robotData.armState[0] = isBitOn(pszData, size, index);
      m_robotData.armState[1] = isBitOn(pszData, size, index + 1);
      for (unsigned int i = 0; i < 4; i++) {
         if (m_pPort[i] != nullptr) {
            m_pPort[i]->onReceiveLBData(pszData, size);