From b67e16869a5bfbbde3896a4e5a13f1301f1b978d Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 13 十二月 2024 14:55:55 +0800
Subject: [PATCH] 1.调整保存警告到数据库的位置; 2.CAlarmMonitor组件不再保存已完成的警告的数据;

---
 SourceCode/Bond/BondEq/CBonder.cpp |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/SourceCode/Bond/BondEq/CBonder.cpp b/SourceCode/Bond/BondEq/CBonder.cpp
index 4ebcf7a..c4196dd 100644
--- a/SourceCode/Bond/BondEq/CBonder.cpp
+++ b/SourceCode/Bond/BondEq/CBonder.cpp
@@ -185,7 +185,7 @@
 	pPlc->addMonitor(1, 4400, 4499, MC::SOFT_COMPONENT::D, m_pPlcData);
 	pPlc->addMonitor(2, 4500, 4599, MC::SOFT_COMPONENT::D, &m_pPlcData[200]);
 	pPlc->addMonitor(3, 4700, 4791, MC::SOFT_COMPONENT::D, &m_pPlcData[400]);
-	pPlc->addMonitor(MONITOR_ID_ALARM, 1001, 1064, MC::SOFT_COMPONENT::M, &m_pPlcData[600]);
+	pPlc->addMonitor(MONITOR_ID_ALARM, 10001, 10064, MC::SOFT_COMPONENT::M, &m_pPlcData[600]);
 	
 	pPlc->setName("PLC(1)");
 	pPlc->setDescription("PLC");
@@ -429,6 +429,27 @@
 	if (iii % 5 == 0) {
 		save();
 	}
+
+
+	// 测试
+	BOOL bTest = FALSE;
+	if (bTest) {
+		static int xx = 0;
+		xx++;
+		memset(&m_pPlcData[600], 0, 260);
+		if (xx == 12) {
+			m_pPlcData[600] = 0x01;
+			for (auto c : m_components) {
+				c->onData(MONITOR_ID_ALARM, &m_pPlcData[600], 260);
+			}
+		}
+		else if (xx == 20) {
+			m_pPlcData[600] = 0x00;
+			for (auto c : m_components) {
+				c->onData(MONITOR_ID_ALARM, &m_pPlcData[600], 260);
+			}
+		}
+	}
 }
 
 void CBonder::AddComponent(CComponent* pComponent)

--
Gitblit v1.9.3