From b4aa15969fe35ed20b5ef1f15d5d56c386e13f36 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 17 六月 2025 11:55:15 +0800
Subject: [PATCH] 1.增加Send Able信号出现号的事件处理;

---
 SourceCode/Bond/Servo/CEFEM.cpp |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEFEM.cpp b/SourceCode/Bond/Servo/CEFEM.cpp
index 86cd158..ff4581d 100644
--- a/SourceCode/Bond/Servo/CEFEM.cpp
+++ b/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()
@@ -643,6 +652,23 @@
 				delete pStep;
 			}
 		}
+
+		{
+			// FAC Data Report
+			CEqReadStep* pStep = new CEqReadStep(0x6301, 108 * 2,
+				[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
+					if (code == ROK && pszData != nullptr && size > 0) {
+						decodePanelDataReport((CStep*)pFrom, pszData, size);
+					}
+					return -1;
+				});
+			pStep->setName(STEP_EQ_FAC_DATA_REPORT);
+			pStep->setProp("Port", (void*)1);
+			pStep->setWriteSignalDev(0x04d);
+			if (addStep(STEP_ID_FAC_DATA_REPORT, pStep) != 0) {
+				delete pStep;
+			}
+		}
 	}
 
 	// 必须要实现的虚函数,在此初始化Slot信息
@@ -675,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);

--
Gitblit v1.9.3