From 0fb528df2c1f05ef7d52827432bd934ce6f9d8cd Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期五, 12 九月 2025 09:46:59 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang
---
SourceCode/Bond/SGMeasurement/SGMeasurementDlg.cpp | 28 ++++++++++++----------------
1 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.cpp b/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.cpp
index a3f8234..4f7a030 100644
--- a/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.cpp
+++ b/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.cpp
@@ -247,7 +247,7 @@
strFullLogLine.Format(_T("%s %s"), strLevel, strContent);
// 鍐欏叆鏃ュ織鏂囦欢
- // LOG_LINE(strFullLogLine);
+ LOG_LINE(strFullLogLine);
}
void CSGMeasurementDlg::HighlightAllMatches(const CString& strSearch, COLORREF clrHighlight/* = RGB(255, 165, 0)*/)
@@ -639,7 +639,8 @@
fAvg1 = CalcAverage(vecGlass1);
fAvg2 = CalcAverage(vecGlass2);
- fOffset = std::fabs(fAvg2 - fAvg1); // 绗簩鐗� - 绗竴鐗�
+ fOffset = fAvg2 - fAvg1; // 绗簩鐗� - 绗竴鐗�
+ //fOffset = std::fabs(fAvg2 - fAvg1); // 绗簩鐗� - 绗竴鐗�
CString strLog;
strLog.Format(_T("绗竴鐗囩幓鐠冨钩鍧囧��: %.3f锛岀浜岀墖鐜荤拑骞冲潎鍊�: %.3f锛屽亸绉婚噺: %.3f"), fAvg1, fAvg2, fOffset);
@@ -723,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);
@@ -754,16 +755,16 @@
CString strError;
strError.Format(_T("璇诲彇 OUT%d 鏁版嵁澶辫触锛岄敊璇爜锛�%#X"), nOutNo, nRet);
AppendLogLineRichStyled(strError, LOG_COLOR_ERROR);
- return -1.0f;
+ return 0xFF;
}
vecBuffer.resize(nReceived);
CleanInvalidValuesInPlace(nOutNo, vecBuffer);
- std::vector<float> vecGlass1, vecGlass2;
+ 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;
@@ -923,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