From 61deef5cdf96cbfdd6ad45be49e80d597c00ca65 Mon Sep 17 00:00:00 2001
From: QuakeGod <QuakeGod@sina.com>
Date: 星期二, 24 十二月 2024 08:37:21 +0800
Subject: [PATCH] 2024-12-24

---
 ConfigTool/ConfigToolView.cpp |   45 +++++++++++++++++++++++----------------------
 1 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/ConfigTool/ConfigToolView.cpp b/ConfigTool/ConfigToolView.cpp
index 45f4659..202c924 100644
--- a/ConfigTool/ConfigToolView.cpp
+++ b/ConfigTool/ConfigToolView.cpp
@@ -75,7 +75,7 @@
 	: CFormView(IDD_CONFIGTOOL_FORM)
 {
 	// TODO: 鍦ㄦ澶勬坊鍔犳瀯閫犱唬鐮�
-	psyscfg = (pKMSysCfg)m_cfgdatabuf;
+	psyscfg = (pstKMSysCfg)m_cfgdatabuf;
 
 }
 
@@ -281,7 +281,7 @@
 	m_propsyscfg1.ScrollWindow(0, Scrolldel);
 	m_nScrollPos += Scrolldel;
 
-	m_propsyscfg1.psyscfg = (pKMSysCfg)m_cfgdatabuf;
+	m_propsyscfg1.psyscfg = (pstKMSysCfg)m_cfgdatabuf;
 
 	m_propsyscfg1.m_nFrameheight = m_nFrameheight;
 	m_propsyscfg1.UpdateScrollInfo();
@@ -466,6 +466,7 @@
 	CString s1;
 	s1.Empty();
 	SetDlgItemText(IDC_EDIT_DEVICE_TYPE, s1);
+	SetDlgItemText(IDC_EDIT_DEVICE_NAME, s1);
 	SetDlgItemText(IDC_EDIT_FIRM_VER, s1);
 	SetDlgItemText(IDC_EDIT_KLINK_VER, s1);
 	SetDlgItemText(IDC_EDIT_KBUS_VER, s1);
@@ -660,8 +661,8 @@
 	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
 	CString s1;
 	
-	int res = ((CConfigToolDoc *)m_pDocument)->MyKlink.SetCommParam();
-	s1.Format(_T("Com Set = %d "),res);
+	int res = GetDocument()->MyKlink.SetCommParam();
+	s1.Format(_T("Com Set = %d  COM%d %d %s"),res, GetDocument()->MyKlink.m_nPort, GetDocument()->MyKlink.m_nBaudRate, GetDocument()->MyKlink.m_Settings);
 	SysLog(s1);
 }
 
@@ -692,8 +693,8 @@
 //	s1 += FormatHex(m_factorydataBuf, nCount);
 	SysLog(s1);
 
-	res = ((CConfigToolDoc *)m_pDocument)->MyKlink.ReadSysCfgData(1, 0, DCount, &nCount, m_cfgdatabuf);
-	psyscfg = (pKMSysCfg)m_cfgdatabuf;
+	res = ((CConfigToolDoc *)m_pDocument)->MyKlink.ReadSysCfgData(1, 0, 0, DCount, &nCount, m_cfgdatabuf);
+	psyscfg = (pstKMSysCfg)m_cfgdatabuf;
 	s1.Format(_T("read SysCfgData = %d  %d bytes \r\n"), res, nCount);
 //	s1 += FormatHex(m_cfgdatabuf, nCount);
 	SysLog(s1);
@@ -730,8 +731,8 @@
 	s1 += FormatHex(m_factorydataBuf, nCount);
 	SysLog(s1);
 
-	res = ((CConfigToolDoc *)m_pDocument)->MyKlink.ReadSysCfgData(1, 0, DCount, &nCount, m_cfgdatabuf);
-	psyscfg = (pKMSysCfg)m_cfgdatabuf;
+	res = ((CConfigToolDoc *)m_pDocument)->MyKlink.ReadSysCfgData(1, 0,0, DCount, &nCount, m_cfgdatabuf);
+	psyscfg = (pstKMSysCfg)m_cfgdatabuf;
 	s1.Format(_T("read SysCfgData = %d  %d bytes \r\n"), res, nCount);
 	s1 += FormatHex(m_cfgdatabuf, nCount);
 	SysLog(s1);
@@ -752,7 +753,7 @@
 	unsigned short nCount=0;
 	m_propsyscfg1.GetParams();
 
-	res = ((CConfigToolDoc *)m_pDocument)->MyKlink.WriteSysCfgData(1, 0, DCount, m_cfgdatabuf);
+	res = ((CConfigToolDoc *)m_pDocument)->MyKlink.WriteSysCfgData(1, 0, 0, DCount, m_cfgdatabuf);
 //	m_propsyscfg1.psyscfg = (pKMSysCfg)m_cfgdatabuf;
 	s1.Format(_T("Download = %d  %d bytes"), res, DCount);
 	SysLog(s1);
@@ -804,7 +805,7 @@
 		psyscfg->Version = int(syscfg1["SYSTEM"]["Version"]);
 		psyscfg->workmode = int(syscfg1["SYSTEM"]["WorkMode"]);
 		psyscfg->SwitchFunc = _tstoi(syscfg1["SYSTEM"]["SwitchFunc"]);
-		psyscfg->Space1 = 0;
+		psyscfg->nCfgBlockCount = 0;
 
 		psyscfg->PortParams[0].WorkMode = int(syscfg1["Port_1"]["WorkMode"]);
 		psyscfg->PortParams[0].Station = int(syscfg1["Port_1"]["Station"]);
@@ -832,12 +833,12 @@
 		psyscfg->PortParams[1].RecvAddr = int(syscfg1["Port_2"]["RecvAddr"]);
 		psyscfg->PortParams[1].RecvSize = int(syscfg1["Port_2"]["RecvSize"]);
 
-		psyscfg->OutMappings[0] = int(syscfg1["OutMapping"]["Output_0"]);
-		psyscfg->OutMappings[1] = int(syscfg1["OutMapping"]["Output_1"]);
-		psyscfg->OutMappings[2] = int(syscfg1["OutMapping"]["Output_2"]);
-		psyscfg->OutMappings[3] = int(syscfg1["OutMapping"]["Output_3"]);
-		psyscfg->OutMappings[4] = int(syscfg1["OutMapping"]["Output_4"]);
-		psyscfg->OutMappings[5] = int(syscfg1["OutMapping"]["Output_5"]);
+		psyscfg->OutMappings[0].value = int(syscfg1["OutMapping"]["Output_0"]);
+		psyscfg->OutMappings[1].value = int(syscfg1["OutMapping"]["Output_1"]);
+		psyscfg->OutMappings[2].value = int(syscfg1["OutMapping"]["Output_2"]);
+		psyscfg->OutMappings[3].value = int(syscfg1["OutMapping"]["Output_3"]);
+		psyscfg->OutMappings[4].value = int(syscfg1["OutMapping"]["Output_4"]);
+		psyscfg->OutMappings[5].value = int(syscfg1["OutMapping"]["Output_5"]);
 
 		m_propsyscfg1.ShowParams();
 
@@ -888,12 +889,12 @@
 
 	syscfg1["SYSTEM"]["Version"] = psyscfg->Version;
 
-	syscfg1["OutMapping"]["Output_0"] = psyscfg->OutMappings[0];
-	syscfg1["OutMapping"]["Output_1"] = psyscfg->OutMappings[1];
-	syscfg1["OutMapping"]["Output_2"] = psyscfg->OutMappings[2];
-	syscfg1["OutMapping"]["Output_3"] = psyscfg->OutMappings[3];
-	syscfg1["OutMapping"]["Output_4"] = psyscfg->OutMappings[4];
-	syscfg1["OutMapping"]["Output_5"] = psyscfg->OutMappings[5];
+	syscfg1["OutMapping"]["Output_0"] = psyscfg->OutMappings[0].value;
+	syscfg1["OutMapping"]["Output_1"] = psyscfg->OutMappings[1].value;
+	syscfg1["OutMapping"]["Output_2"] = psyscfg->OutMappings[2].value;
+	syscfg1["OutMapping"]["Output_3"] = psyscfg->OutMappings[3].value;
+	syscfg1["OutMapping"]["Output_4"] = psyscfg->OutMappings[4].value;
+	syscfg1["OutMapping"]["Output_5"] = psyscfg->OutMappings[5].value;
 
 	CFileDialog dlg1(false, _T("*.cfg"),NULL, OFN_OVERWRITEPROMPT, _T("閰嶇疆鏂囦欢(*.cfg)|*.cfg|鎵�鏈夋枃浠� (*.*)|*.*||"),this);
 	INT_PTR r = dlg1.DoModal();

--
Gitblit v1.9.1