From 4cc9fd5bb0c0224e88ca702e6e736e1bc138dce6 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 20 二月 2025 11:36:16 +0800
Subject: [PATCH] 1.测试通过Equipment Mode Change Report流程;

---
 SourceCode/Bond/Servo/CCLinkPerformance/CCLinkIEControl.cpp     |    5 +-
 /dev/null                                                       |    0 
 SourceCode/Bond/Servo/CCLinkPerformance/PerformanceMelsec.h     |   14 +++---
 SourceCode/Bond/Servo/CStep.h                                   |    3 +
 SourceCode/Bond/Servo/CEquipment.cpp                            |   24 +++++------
 SourceCode/Bond/Servo/CMaster.cpp                               |    5 +-
 SourceCode/Bond/Servo/CCLinkPerformance/CCLinkIEControl.h       |    2 
 SourceCode/Bond/Servo/CEquipment.h                              |    2 +
 Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.1(1).xlsx |    0 
 SourceCode/Bond/Servo/CStep.cpp                                 |   20 +++++++--
 10 files changed, 45 insertions(+), 30 deletions(-)

diff --git "a/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.1\0501\051.xlsx" "b/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.1\0501\051.xlsx"
new file mode 100644
index 0000000..312cbab
--- /dev/null
+++ "b/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.1\0501\051.xlsx"
Binary files differ
diff --git a/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.1.xlsx b/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.1.xlsx
deleted file mode 100644
index 26977da..0000000
--- a/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.1.xlsx
+++ /dev/null
Binary files differ
diff --git a/SourceCode/Bond/Servo/CCLinkPerformance/CCLinkIEControl.cpp b/SourceCode/Bond/Servo/CCLinkPerformance/CCLinkIEControl.cpp
index 582cc6b..baad0d5 100644
--- a/SourceCode/Bond/Servo/CCLinkPerformance/CCLinkIEControl.cpp
+++ b/SourceCode/Bond/Servo/CCLinkPerformance/CCLinkIEControl.cpp
@@ -80,7 +80,7 @@
     return 0; // 校验通过
 }
 
-int CCCLinkIEControl::ReadData2(const StationIdentifier& station, short devType, short devNo, short size, void* pData)
+int CCCLinkIEControl::ReadData2(const StationIdentifier& station, DeviceType enDevType, short devNo, short size, void* pData)
 {
     // 验证站点参数和数据有效性
     int nRet = ValidateStationAndSize(station, size);
@@ -92,7 +92,8 @@
     // 确保线程安全的最小锁定范围
     {
         std::lock_guard<std::mutex> lock(m_mtx);
-        nRet = mdReceive(m_nPath, CombineStation(station), devType, devNo, &size, pData);
+        const short nDevType = CalculateDeviceType(station, enDevType);
+        nRet = mdReceive(m_nPath, CombineStation(station), nDevType, devNo, &size, pData);
     }
 
     if (nRet != 0) {
diff --git a/SourceCode/Bond/Servo/CCLinkPerformance/CCLinkIEControl.h b/SourceCode/Bond/Servo/CCLinkPerformance/CCLinkIEControl.h
index 3a33626..5d92f9e 100644
--- a/SourceCode/Bond/Servo/CCLinkPerformance/CCLinkIEControl.h
+++ b/SourceCode/Bond/Servo/CCLinkPerformance/CCLinkIEControl.h
@@ -59,7 +59,7 @@
     // 读取LED状态
     int ReadLedStatus(LedStatus& outLedStatus);
 
-    int ReadData2(const StationIdentifier& station, short devType, short devNo, short size, void* pData);
+    int ReadData2(const StationIdentifier& station, DeviceType enDevType, short devNo, short size, void* pData);
 
 private:
     static CCLinkIEControlMode ConvertToCCLinkIEControlMode(short nMode);
diff --git a/SourceCode/Bond/Servo/CCLinkPerformance/PerformanceMelsec.h b/SourceCode/Bond/Servo/CCLinkPerformance/PerformanceMelsec.h
index 60dea51..21a8281 100644
--- a/SourceCode/Bond/Servo/CCLinkPerformance/PerformanceMelsec.h
+++ b/SourceCode/Bond/Servo/CCLinkPerformance/PerformanceMelsec.h
@@ -117,13 +117,13 @@
 	SPB = 0x0032,	 // 缂撳啿瀛樺偍鍣� (瀛�)
 	MAIL = 0x0065,   // 鐗规畩杞厓浠剁被鍨嬶細閭欢绫诲瀷 (10杩涘埗 101)
 	MAILMC = 0x0066, // 鐗规畩杞厓浠剁被鍨嬶細鏃犵‘璁ら偖浠� (10杩涘埗 102)
-	LX = 0x03E9,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴杈撳叆) (0x03E9锝�0x04E7) (浣�)
-	LY = 0x07D1,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴杈撳嚭) (0x07D1锝�0x08CF) (浣�)
-	LB = 0x59D9,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴缁х數鍣�) (0x59D9锝�0x5AD7) (浣�)
-	LW = 0x5DC1,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴瀵勫瓨鍣�) (0x5DC1锝�0x5EBF) (瀛�)
-	LSB = 0x61A9,    // 閾炬帴鐩存帴杞厓浠� (閾炬帴鐗规畩缁х數鍣�) (0x61A9锝�0x62A7) (浣�)
-	LSW = 0x6D61,    // 閾炬帴鐩存帴杞厓浠� (閾炬帴鐗规畩瀵勫瓨鍣�) (0x6D61锝�0x6E5F) (瀛�)
-	SPG = 0x7148,    // 鏅鸿兘鍔熻兘妯″潡杞厓浠� (0x7148锝�0x7247) (瀛�)
+	LX = 0x03E8,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴杈撳叆) (0x03E9锝�0x04E7) (浣�)
+	LY = 0x07D0,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴杈撳嚭) (0x07D1锝�0x08CF) (浣�)
+	LB = 0x59D8,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴缁х數鍣�) (0x59D9锝�0x5AD7) (浣�)
+	LW = 0x5DC0,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴瀵勫瓨鍣�) (0x5DC1锝�0x5EBF) (瀛�)
+	LSB = 0x61A8,    // 閾炬帴鐩存帴杞厓浠� (閾炬帴鐗规畩缁х數鍣�) (0x61A9锝�0x62A7) (浣�)
+	LSW = 0x6D60,    // 閾炬帴鐩存帴杞厓浠� (閾炬帴鐗规畩瀵勫瓨鍣�) (0x6D61锝�0x6E5F) (瀛�)
+	SPG = 0x7147,    // 鏅鸿兘鍔熻兘妯″潡杞厓浠� (0x7148锝�0x7247) (瀛�)
 };
 
 // 鏁版嵁绫诲瀷
diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index 2a592fa..fcc8002 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -15,6 +15,7 @@
 		m_bLocalAlarm = FALSE;
 		m_bAutoRecipeChange = FALSE;
 		m_bVCREnable[0] = FALSE;
+		m_pCclink = nullptr;
 		InitializeCriticalSection(&m_criticalSection);
 	}
 
@@ -32,6 +33,11 @@
 	{
 		m_listener.onAlive = listener.onAlive;
 		m_listener.onCimStateChanged = listener.onCimStateChanged;
+	}
+
+	void CEquipment::setCcLink(CCCLinkIEControl* pCcLink)
+	{
+		m_pCclink = pCcLink;
 	}
 
 	void CEquipment::getProperties(std::vector<std::pair<std::string, std::string>>& container)
@@ -54,6 +60,7 @@
 	{
 		auto iter = m_mapStep.find(addr);
 		if (iter != m_mapStep.end()) return -1;
+		pStep->setCcLink(m_pCclink);
 		m_mapStep[addr] = pStep;
 		return 0;
 	}
@@ -119,7 +126,7 @@
 
 	void CEquipment::setReadBitBlock(unsigned int start, unsigned int end)
 	{
-		m_blockReadBit.type = (unsigned int)DeviceType::LB;;
+		m_blockReadBit.type = (unsigned int)DeviceType::B;
 		m_blockReadBit.start = start;
 		m_blockReadBit.end = end;
 		m_blockReadBit.size = (m_blockReadBit.end - m_blockReadBit.start + 1) / 8;
@@ -168,12 +175,13 @@
 
 	void CEquipment::onReceiveLBData(const char* pszData, size_t size)
 	{
+		/*
 		TRACE("%s onReceiveLBData: %d bytes\n", m_strName.c_str(), size);
 		for (unsigned int i = 0; i < size; i++) {
 			if (pszData[i] != 0)
 				TRACE("%d[%x]\n", i, pszData[i]);
 		}
-
+		*/
 
 		// 以下解释和处理数据
 		BOOL bFlag;
@@ -239,21 +247,11 @@
 
 		// Equipment Mode Change Report
 		index = 0x360;
-		bFlag = isBitOn(pszData, size, ++index);
-		static int i;
-		i++;
-		if (i > 10) bFlag = TRUE;
-		if (i > 15) bFlag = FALSE;
-		if (i > 110) bFlag = TRUE;
-		if (i > 115) bFlag = FALSE;
-		//if (i == 12) bFlag = FALSE;
+		bFlag = isBitOn(pszData, size, index);
 		CStep* pStep = getStep(0x360);
 		if (pStep != nullptr) {
 			pStep->onSignal(bFlag);
 		}
-
-
-
 	}
 
 	BOOL CEquipment::isBitOn(const char* pszData, size_t size, int index)
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index 2a9bd53..731fcf9 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -43,6 +43,7 @@
 	public:
 		virtual const char* getClassName() = 0;
 		virtual void setListener(EquipmentListener listener);
+		void setCcLink(CCCLinkIEControl* pCcLink);
 		void setID(int nID);
 		int getID();
 		void setName(const char* pszName);
@@ -105,6 +106,7 @@
 		BOOL m_bVCREnable[VCR_MAX];
 
 	private:
+		CCCLinkIEControl* m_pCclink;
 		std::map<unsigned int, CStep*> m_mapStep;
 	};
 }
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 51f34a6..2bbfe86 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -68,7 +68,7 @@
 			pEquipment->setName("EFEM(ROBOT)");
 			pEquipment->setDescription("EFEM(ROBOT).");
 			pEquipment->setReadBitBlock(0x4000, 0x45ff);
-			pEquipment->setStation(1, 2);
+			pEquipment->setStation(0, 255);
 			addEquipment(pEquipment);
 
 			pEquipment->init();
@@ -121,6 +121,7 @@
 			}
 		};
 		pEquipment->setListener(listener);
+		pEquipment->setCcLink(&m_cclink);
 		m_listEquipment.push_back(pEquipment);
 
 		return 0;
@@ -151,7 +152,7 @@
 				const StationIdentifier& station = item->getStation();
 				MemoryBlock& block = item->getReadBitBlock();
 
-				int nRet = m_cclink.ReadData2(station, (short)block.type,
+				int nRet = m_cclink.ReadData2(station, (DeviceType)block.type,
 					block.start, block.size, block.buffer);
 				if (0 == nRet) {
 					item->onReceiveLBData(block.buffer, block.size);
diff --git a/SourceCode/Bond/Servo/CStep.cpp b/SourceCode/Bond/Servo/CStep.cpp
index 6f98ac8..3873ddf 100644
--- a/SourceCode/Bond/Servo/CStep.cpp
+++ b/SourceCode/Bond/Servo/CStep.cpp
@@ -19,6 +19,7 @@
 		m_hSignalOn = ::CreateEvent(NULL, TRUE, FALSE, NULL);
 		m_hSignalOff = ::CreateEvent(NULL, TRUE, FALSE, NULL);
 		m_nCurStep = 0;
+		m_pCclink = nullptr;
 		InitializeCriticalSection(&m_criticalSection);
 	}
 
@@ -33,6 +34,11 @@
 		m_hSignalOff = nullptr;
 
 		DeleteCriticalSection(&m_criticalSection);
+	}
+
+	void CStep::setCcLink(CCCLinkIEControl* pCcLink)
+	{
+		m_pCclink = pCcLink;
 	}
 
 	void CStep::init()
@@ -79,20 +85,24 @@
 
 				// 1.读取数据
 				nextStep();
-				TRACE("m_nCurStep:%d\n", m_nCurStep);
-
+				ASSERT(m_pCclink);
+				StationIdentifier station(0, 255);
+				DWordContainer dc;
+				m_pCclink->ReadDWordData(station, DeviceType::W, 0x4a8c, 1, dc);
+				int nState = dc.at(0);
+				TRACE(">> nState:%d\n", nState);
 
 				// 2.给对方写ON
 				nextStep();
-				TRACE("m_nCurStep:%d\n", m_nCurStep);
+				m_pCclink->SetBitDevice(station, DeviceType::B, 0x30);
 
 
 				// 3.等待对方OFF
 				nextStep();
-				TRACE("m_nCurStep:%d\n", m_nCurStep);
 				int nStep3Ret = ::WaitForSingleObject(m_hSignalOff, TIMEOUT * 1000);
 				if (nStep3Ret == WAIT_TIMEOUT) {
 					timeout();
+					m_pCclink->ResetBitDevice(station, DeviceType::B, 0x30);
 					goto RESET;
 				}
 				ResetEvent(m_hSignalOff);
@@ -100,6 +110,7 @@
 
 				// 4.给对方写OFF
 				nextStep();
+				m_pCclink->ResetBitDevice(station, DeviceType::B, 0x30);
 				TRACE("m_nCurStep:%d\n", m_nCurStep);
 
 
@@ -125,7 +136,6 @@
 
 	void CStep::onSignal(BOOL bSignal)
 	{
-		TRACE(">>>>>>>>>>>>>>>>>>>> setSignal:%s\n", bSignal ? "ON" : "OFF");
 		Lock();
 		if (m_nCurStep == 0 && bSignal) {
 			SetEvent(m_hSignalOn);
diff --git a/SourceCode/Bond/Servo/CStep.h b/SourceCode/Bond/Servo/CStep.h
index 6c4bb0f..ec87aa0 100644
--- a/SourceCode/Bond/Servo/CStep.h
+++ b/SourceCode/Bond/Servo/CStep.h
@@ -1,4 +1,5 @@
 #pragma once
+#include "CCLinkIEControl.h"
 
 
 namespace SERVO {
@@ -10,6 +11,7 @@
 
 	public:
 		unsigned WorkingProc();
+		void setCcLink(CCCLinkIEControl* pCcLink);
 		virtual void init();
 		virtual void CStep::term();
 		virtual void onSignal(BOOL bSignal);
@@ -22,6 +24,7 @@
 		void timeout();
 
 	private:
+		CCCLinkIEControl* m_pCclink;
 		CRITICAL_SECTION m_criticalSection;
 		std::string strName;
 		HANDLE m_hWorkThreadHandle;

--
Gitblit v1.9.3