From 12fc574703adc0528a7e905540dbd1ba26015c37 Mon Sep 17 00:00:00 2001
From: LWQ <1806950222@qq.com>
Date: 星期三, 13 八月 2025 19:17:42 +0800
Subject: [PATCH] Merge branch 'side_inspection' of https://soft.boounion.cn/r/~liuyang/MiniLED_ADM into side_inspection

---
 EdgeInspector_App/Recipe/HardwareSettings.cpp |  127 ++++++++++++++++++++++++++----------------
 1 files changed, 78 insertions(+), 49 deletions(-)

diff --git a/EdgeInspector_App/Recipe/HardwareSettings.cpp b/EdgeInspector_App/Recipe/HardwareSettings.cpp
index 4cfde21..d3bcaf1 100644
--- a/EdgeInspector_App/Recipe/HardwareSettings.cpp
+++ b/EdgeInspector_App/Recipe/HardwareSettings.cpp
@@ -1826,33 +1826,39 @@
 
 BOOL CHardwareSettings::WriteHardwareSettingsFile(CString strFilePath)
 {
-	CConfig		BasicInfoFile;
-	CString				str;
-	int					iCam,iScan,iLight,iLoop;	
+	g_pLog->DisplayMessage(_T("HWSettings Start writing hardware settings to file: %s"), strFilePath);
 
-	if(BasicInfoFile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode) == FALSE)
-	{
+	int	iCam, iScan, iLight, iLoop;
+
+	CConfig	BasicInfoFile;
+	if(BasicInfoFile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode) == FALSE) {
 		CFile File;
-		if (!File.Open((TCHAR*)(LPCTSTR)strFilePath, CFile::modeCreate))
-		{			
+		if (!File.Open((TCHAR*)(LPCTSTR)strFilePath, CFile::modeCreate)) {
+			DWORD dwErr = GetLastError();
+			g_pLog->DisplayMessage(_T("HWSettings failed | Path=%s | Error=%lu"), strFilePath, dwErr);
 			return FALSE;
 		}
 		File.Close();
 	}
 
+	CString	str;
 	str = GetFileString((void *)&m_nCameraCount);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
+
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nCameraCount);
 
 	str = GetFileString((void *)&m_nScanCount);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nScanCount);	
 
 	str = GetFileString((void *)&m_nBoardType);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nBoardType);	
 	
 	// 	str = GetFileString((void *)&m_dOneScanTime);
@@ -1861,140 +1867,163 @@
 	// 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_dOneScanTime);	
 
 	str = GetFileString((void *)&m_strMachineName);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
-	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(TCHAR*)(LPCTSTR)m_strMachineName);	
+	}
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(TCHAR*)(LPCTSTR)m_strMachineName);
 
 	str = GetFileString((void *)&m_strLineID);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
+
 		return FALSE;
-	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(TCHAR*)(LPCTSTR)m_strLineID);	
+	}
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(TCHAR*)(LPCTSTR)m_strLineID);
 
 	str = GetFileString((void *)&m_nPLCSignalRetry);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nPLCSignalRetry);	
 
 	str = GetFileString((void *)&m_bInsDirReverse);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bInsDirReverse);
 
 	str = GetFileString((void *)&m_bUseColorVisual);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual);
 
 	str = GetFileString((void *)&m_nSaveImageQuality);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nSaveImageQuality);	
 
-	if(m_pCameraSettings != NULL)
-	{
+	if (m_pCameraSettings != NULL) {
 		iLoop = 0;
-		for(iCam=0;iCam<m_nCameraCount;iCam++)
-		{
-			for(iScan=0;iScan<m_nScanCount;iScan++)
-			{
-				m_pCameraSettings[iLoop].WriteHardwareSettingsFile(&BasicInfoFile);	
+		for (iCam = 0; iCam < m_nCameraCount; iCam++) {
+			for (iScan = 0; iScan < m_nScanCount; iScan++) {
+				m_pCameraSettings[iLoop].WriteHardwareSettingsFile(&BasicInfoFile);
 				iLoop++;
 			}
 		}
 	}
 
 	str = GetFileString((void *)&m_nLightCount_Trans);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Trans);	
 
 	str = GetFileString((void *)&m_nLightCount_Reflect);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Reflect);
 
 	str = GetFileString((void *)&m_nFolderRemoveDay);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFolderRemoveDay);
 
-	if(m_pLightSettings != NULL)
-	{		
-		for(iLight=0;iLight<m_nLightCount_Trans+m_nLightCount_Reflect;iLight++)
-		{
+	if (m_pLightSettings != NULL) {
+		for (iLight = 0; iLight < m_nLightCount_Trans + m_nLightCount_Reflect; iLight++) {
 			m_pLightSettings[iLight].WriteHardwareSettingsFile(&BasicInfoFile);
-		}		
+		}
 	}
 
 	m_PLCSettings.WriteHardwareSettingsFile(&BasicInfoFile);
-
 	m_SoftWareSettings.WriteHardwareSettingsFile(&BasicInfoFile);
 
-
 	str = GetFileString((void *)&m_bUseFreerun);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(int) m_bUseFreerun);
 
 	str = GetFileString((void *)&m_nFreerunPeriod);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunPeriod);
 
 	str = GetFileString((void *)&m_nFreerunExposureTime);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunExposureTime);
 
 	str = GetFileString((void *)&m_bUse_MvsolTriggerControl);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUse_MvsolTriggerControl);
 
 	str = GetFileString((void *)&m_nPort_MvsolTriggerControl);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nPort_MvsolTriggerControl);
 
 	str = GetFileString((void *)&m_bUse_SaveDebugImage);
-	if(str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUse_SaveDebugImage);
 
 	// ly,2025.07.10
 	str = GetFileString((void*)&m_bSaveResultByHour);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, (int)m_bSaveResultByHour);
 
 	// ly,2025.07.07
 	str = GetFileString((void*)&m_bEnableAutoCopy);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, (int)m_bEnableAutoCopy);
+
 	str = GetFileString((void*)&m_strCopyToolExePath);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_strCopyToolExePath);
+
 	str = GetFileString((void*)&m_strCopyToolConfigPath);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_strCopyToolConfigPath);
+
 	str = GetFileString((void*)&m_bEnableAutoDelete);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, (int)m_bEnableAutoDelete);
+
 	str = GetFileString((void*)&m_strDeleteToolExePath);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
+	}
+
 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_strDeleteToolExePath);
 	str = GetFileString((void*)&m_strDeleteToolConfigPath);
-	if (str.IsEmpty() == TRUE)
+	if (str.IsEmpty() == TRUE) {
 		return FALSE;
-	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_strDeleteToolConfigPath);
+	}
 
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_strDeleteToolConfigPath);
 	BasicInfoFile.WriteToFile();
 
+	g_pLog->DisplayMessage(_T("HWSettings Finished writing hardware settings file: %s"), strFilePath);
+
 	return TRUE;
 }
 

--
Gitblit v1.9.3