From 1310b3764eafe085dd43a73aa5190a18e9f717c0 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期四, 11 九月 2025 17:11:40 +0800
Subject: [PATCH] 1. 把数值放大1000倍 2. 发送PLC是双字

---
 SourceCode/Bond/SGMeasurement/SGMeasurementDlg.cpp |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.cpp b/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.cpp
index dcf3a01..4f7a030 100644
--- a/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.cpp
+++ b/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.cpp
@@ -724,27 +724,27 @@
 	if (m_nUseTrigger) {
 		UpdateControlStatus(m_bConnected, m_bSaving);
 		AfxMessageBox(_T("褰撳墠鏄‖瑙﹀彂妯″紡锛岃妫�鏌ヨЕ鍙戝櫒鐘舵�併��"), MB_ICONINFORMATION);
-		return -1.0f;
+		return 0xFF;
 	}
 
 	if (!m_bConnected) {
 		AppendLogLineRichStyled(_T("璁惧鏈繛鎺ワ紝璇峰厛杩炴帴璁惧銆�"), LOG_COLOR_WARNING);
-		return -1.0f;
+		return 0xFF;
 	}
 
 	if (m_bSaving) {
 		AppendLogLineRichStyled(_T("鏁版嵁瀛樺偍姝e湪杩涜涓紝璇峰厛鍋滄瀛樺偍銆�"), LOG_COLOR_WARNING);
-		return -1.0f;
+		return 0xFF;
 	}
 
 	if (nOutNo < 1 || nOutNo > 4) {
 		AppendLogLineRichStyled(_T("杈撳嚭绔彛缂栧彿鏃犳晥锛屽繀椤诲湪 1 鍒� 4 涔嬮棿銆�"), LOG_COLOR_ERROR);
-		return -1.0f;
+		return 0xFF;
 	}
 
 	if (m_nSavePointCount < 0) {
 		AppendLogLineRichStyled(_T("鏁版嵁鐐规暟蹇呴』澶т簬 0銆�"), LOG_COLOR_ERROR);
-		return -1.0f;
+		return 0xFF;
 	}
 
 	std::vector<float> vecBuffer(m_nSavePointCount, 0.0f);
@@ -755,7 +755,7 @@
 		CString strError;
 		strError.Format(_T("璇诲彇 OUT%d 鏁版嵁澶辫触锛岄敊璇爜锛�%#X"), nOutNo, nRet);
 		AppendLogLineRichStyled(strError, LOG_COLOR_ERROR);
-		return -1.0f;
+		return 0xFF;
 	}
 
 	vecBuffer.resize(nReceived);
@@ -764,7 +764,7 @@
  	std::vector<float> vecGlass1, vecGlass2;
 	if (!SplitGlassSegments(nOutNo, vecBuffer, vecGlass1, vecGlass2, m_fJumpThreshold, m_nJumpWindow, m_nValleyMargin, m_nMinGlass1Count)) {
 		AppendLogLineRichStyled(_T("鏈兘璇嗗埆鍑轰袱鐗囩幓鐠冪殑鏁版嵁銆�"), LOG_COLOR_WARNING);
-		return -1.0f; 
+		return 0xFF;
 	}
 
 	std::vector<float> vecGlass1Filtered, vecGlass2Filtered;
@@ -924,17 +924,12 @@
 	m_plcListener.SetAnalyzeCallback([this]() {
 		if (!m_bConnected) {
 			AppendLogLineRichStyled(_T("璁惧鏈繛鎺ワ紝璇峰厛杩炴帴璁惧銆�"), LOG_COLOR_WARNING);
-			return std::array<double, 4>{ -1.0, -1.0, -1.0, -1.0 };
+			return std::array<double, 4>{ 0xFF, 0xFF, 0xFF, 0xFF };
 		}
 
 		std::array<double, 4> result;
 		for (int i = 0; i < 4; ++i) {
 			result[i] = AnalyzeStoredData(i + 1); // OUT1 ~ OUT4
-		}
-
-		if (std::any_of(result.begin(), result.end(), [](double v) { return v < 0; })) {
-			AppendLogLineRichStyled(_T("鍒嗘瀽澶辫触锛屾煇浜涜緭鍑虹鍙f暟鎹棤鏁堛��"), LOG_COLOR_ERROR);
-			return std::array<double, 4>{ -1.0, -1.0, -1.0, -1.0 };
 		}
 
 		CString strLog;

--
Gitblit v1.9.3