From 50a42e5d72e2f8cf92ff9b2273e0442977dbcefd Mon Sep 17 00:00:00 2001
From: LAPTOP-T815PCOQ\25526 <mr.liuyang@126.com>
Date: 星期三, 18 十二月 2024 18:28:02 +0800
Subject: [PATCH] 1. 对话框基类添加动态控件管理 2. 对话框基类主题切换功能

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

diff --git a/SourceCode/Bond/BondEq/CBonder.cpp b/SourceCode/Bond/BondEq/CBonder.cpp
index 9f81e4e..c4196dd 100644
--- a/SourceCode/Bond/BondEq/CBonder.cpp
+++ b/SourceCode/Bond/BondEq/CBonder.cpp
@@ -175,11 +175,18 @@
 				c->onData(id, &m_pPlcData[400], 184);
 			}
 		}
+		else if (id == MONITOR_ID_ALARM) {
+			for (auto c : m_components) {
+				c->onData(id, &m_pPlcData[600], 260);
+			}
+		}
 	};
 	pPlc->setListener(listener);
 	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, 10001, 10064, MC::SOFT_COMPONENT::M, &m_pPlcData[600]);
+	
 	pPlc->setName("PLC(1)");
 	pPlc->setDescription("PLC");
 	pPlc->setIndex(0);
@@ -201,7 +208,6 @@
 	CAlarmMonitor* pAlarmMonitor1 = new CAlarmMonitor();
 	pAlarmMonitor1->setName("警告信息");
 	pAlarmMonitor1->setDescription("警告信息监控");
-	pAlarmMonitor1->setBeginAddr(4461 - 4400);
 	pAlarmMonitor1->setIndex(0);
 	pAlarmMonitor1->readAlarmListFromFile((LPTSTR)(LPCTSTR)strAlarmFile);
 	AddComponent(pAlarmMonitor1);
@@ -423,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