From 2ffaec40444a4add7d8e638e5b20a2f81daa18af Mon Sep 17 00:00:00 2001
From: Darker <mr.darker@163.com>
Date: 星期二, 25 二月 2025 17:27:42 +0800
Subject: [PATCH] 1. 合并代码

---
 SourceCode/Bond/Servo/CEqStatusStep.cpp |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEqStatusStep.cpp b/SourceCode/Bond/Servo/CEqStatusStep.cpp
index edf4572..9df8a03 100644
--- a/SourceCode/Bond/Servo/CEqStatusStep.cpp
+++ b/SourceCode/Bond/Servo/CEqStatusStep.cpp
@@ -28,28 +28,28 @@
 		char szBuffer[64];
 		int nRet = m_pCclink->ReadData2(m_station, DeviceType::W,
 			m_nStatusDev, 64, szBuffer);
-		if (0 == nRet) {
-			unsigned int unitId = (unsigned int)CToolUnits::toInt16(&szBuffer[0]);
-			if (unitId < STATUS_MAX) {
-				if (unitId == 0) {
-					m_nStatus[unitId] = CToolUnits::toInt16(&szBuffer[2 + unitId * 4]);
-					m_nReasonCode[unitId] = CToolUnits::toInt16(&szBuffer[2 + unitId * 4 + 2]);
-				}
-				else {
-					m_nStatus[unitId] = CToolUnits::toInt16(&szBuffer[2 + 3 * 2 + unitId * 4]);
-					m_nReasonCode[unitId] = CToolUnits::toInt16(&szBuffer[2 + 3 * 2 + unitId * 4 + 2]);
-				}
-
-				for (int i = 0; i < 64; i++) {
-					TRACE("bbb %d, %x\n", i, szBuffer[i]);
-				}
-				TRACE("cccc %d %d %d\n", unitId, m_nStatus[unitId], m_nReasonCode[unitId]);
-				std::string strTemp;
-				LOGI("<CEqStatusStep> Equipment Status Changed<Unit:%d, %s, ReasonCode=%d>\n",
-					unitId, getStatusDescription(unitId, strTemp).c_str(), m_nReasonCode[unitId]);
-			}
+		if (0 != nRet) {
+			return -1;
 		}
 
+		unsigned int unitId = (unsigned int)CToolUnits::toInt16(&szBuffer[0]);
+		if (unitId >= STATUS_MAX) {
+			return -2;
+		}
+
+		if (unitId == 0) {
+			m_nStatus[unitId] = CToolUnits::toInt16(&szBuffer[2 + unitId * 4]);
+			m_nReasonCode[unitId] = CToolUnits::toInt16(&szBuffer[2 + unitId * 4 + 2]);
+		}
+		else {
+			m_nStatus[unitId] = CToolUnits::toInt16(&szBuffer[2 + 3 * 2 + unitId * 4]);
+			m_nReasonCode[unitId] = CToolUnits::toInt16(&szBuffer[2 + 3 * 2 + unitId * 4 + 2]);
+		}
+
+		std::string strTemp;
+		LOGI("<CEqStatusStep> Equipment Status Changed<Unit:%d, %s, ReasonCode=%d>\n",
+			unitId, getStatusDescription(unitId, strTemp).c_str(), m_nReasonCode[unitId]);
+
 
 		return 0;
 	}

--
Gitblit v1.9.3