From d400f022161ff47f02cd0ea95a5076d0187ecd4d Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期五, 30 一月 2026 15:11:06 +0800
Subject: [PATCH] 1.接上,日志完善;

---
 SourceCode/Bond/Servo/CEqStatusStep.cpp |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEqStatusStep.cpp b/SourceCode/Bond/Servo/CEqStatusStep.cpp
index b525e6f..e63cc7d 100644
--- a/SourceCode/Bond/Servo/CEqStatusStep.cpp
+++ b/SourceCode/Bond/Servo/CEqStatusStep.cpp
@@ -8,8 +8,9 @@
 	CEqStatusStep::CEqStatusStep() : CReadStep()
 	{
 		m_nStatusDev = 0;
+		m_nUnitId = 0;
 		for (int i = 0; i < STATUS_MAX; i++) {
-			m_nStatus[i] = 7;
+			m_nStatus[i] = 0;
 			m_nReasonCode[i] = 0;
 		}
 	
@@ -25,18 +26,20 @@
 	{
 		CReadStep::getAttributeVector(attrubutes);
 
+		unsigned int weight = 31;
 		char szName[256];
 		for (int i = 0; i < STATUS_MAX; i++) {
 			sprintf_s(szName, 256, "Status %d", i + 1);
 			attrubutes.addAttribute(new CAttribute(szName,
-				std::to_string(m_nStatus[i]).c_str(), ""));
+				std::to_string(m_nStatus[i]).c_str(), "", weight++));
 			sprintf_s(szName, 256, "Reason Code %d", i + 1);
 			attrubutes.addAttribute(new CAttribute(szName,
-				std::to_string(m_nReasonCode[i]).c_str(), ""));
+				std::to_string(m_nReasonCode[i]).c_str(), "", weight++));
 		}
 
+		std::string strTemp;
 		attrubutes.addAttribute(new CAttribute("Status Dev",
-			std::to_string(m_nStatusDev).c_str(), ""));
+			("W" + CToolUnits::toHexString(m_nStatusDev, strTemp)).c_str(), "", weight++));
 	}
 
 	int CEqStatusStep::getStatus(unsigned int uint)
@@ -46,6 +49,20 @@
 		}
 
 		return -1;
+	}
+
+	int CEqStatusStep::getReasonCode(unsigned int uint) const
+	{
+		if (uint < STATUS_MAX) {
+			return m_nReasonCode[uint];
+		}
+
+		return -1;
+	}
+
+	unsigned int CEqStatusStep::getUnitId() const
+	{
+		return m_nUnitId;
 	}
 	int CEqStatusStep::onReadData()
 	{
@@ -58,10 +75,11 @@
 			return -1;
 		}
 
-		unsigned int unitId = (unsigned int)CToolUnits::toInt16(&szBuffer[0]);
+		const unsigned int unitId = (unsigned int)CToolUnits::toInt16(&szBuffer[0]);
 		if (unitId >= STATUS_MAX) {
 			return -2;
 		}
+		m_nUnitId = unitId;
 
 		if (unitId == 0) {
 			m_nStatus[unitId] = CToolUnits::toInt16(&szBuffer[2 + unitId * 4]);
@@ -91,7 +109,7 @@
 	int CEqStatusStep::onTimeout()
 	{
 		CReadStep::onTimeout();
-		LOGI("<CEqStatusStep> onTimeout.");
+		LOGE("<CEqStatusStep> onTimeout.");
 
 		return 0;
 	}

--
Gitblit v1.9.3