From 96266d494fe227a0481c305f9c859e69421da6ae Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 18 六月 2025 14:36:37 +0800
Subject: [PATCH] 1.CEqWriteStep, 写数据时,有时还要读取对方的返回值,增加获取返回数据的功能;

---
 SourceCode/Bond/Servo/CEquipment.cpp |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index d380f13..ef24f61 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -1012,30 +1012,34 @@
 		return 0;
 	}
 
-	int CEquipment::indexerOperationModeChange(IDNEXER_OPERATION_MODE mode, ONWRITED onWritedBlock/* = nullptr*/)
+	int CEquipment::indexerOperationModeChange(IDNEXER_OPERATION_MODE mode, ONWRITEDRET onWritedRetBlock)
 	{
-		SERVO::CEqWriteStep* pStep = (SERVO::CEqWriteStep*)getStepWithName(STEP_EFEM_IN_OP_MODE_CHANGE);
+		SERVO::CEqWriteStep* pStep = (SERVO::CEqWriteStep*)getStepWithName(STEP_EQ_IN_OP_MODE_CHANGE);
 		if (pStep == nullptr) {
 			return -1;
 		}
 
 		unsigned short operationMode = (unsigned short)((unsigned short)mode + getIndexerOperationModeBaseValue());
 		LOGI("<CEquipment-%s>准备设置indexerOperationMode<%d>", m_strName.c_str(), (int)mode);
-		if (onWritedBlock != nullptr) {
-			pStep->writeShort(operationMode, onWritedBlock);
-		}
-		else {
-			pStep->writeShort(operationMode, [&, mode](int code) -> int {
-				if (code == WOK) {
-					LOGI("<CEquipment-%s>设置indexerOperationMode成功.", m_strName.c_str());
-				}
-				else {
-					LOGI("<CEquipment-%s>设置indexerOperationMode失败,code:%d", m_strName.c_str(), code);
-				}
+		pStep->writeShort(operationMode, [&, mode](int code) -> int {
+			int retCode = 0;
+			if (code == WOK) {
+				LOGI("<CEquipment-%s>设置indexerOperationMode成功.", m_strName.c_str());
+				const char* pszRetData = nullptr;
+				pStep->getReturnData(pszRetData);
+				ASSERT(pszRetData);
+				retCode = (unsigned int)CToolUnits::toInt16(pszRetData);	
+			}
+			else {
+				LOGI("<CEquipment-%s>设置indexerOperationMode失败,code:%d", m_strName.c_str(), code);
+			}
 
-				return 0;
-				});
-		}
+			if (onWritedRetBlock != nullptr) {
+				onWritedRetBlock(code, retCode);
+			}
+
+			return 0;
+		});
 
 		return 0;
 	}

--
Gitblit v1.9.3