From e2a1400ab8e341cb1d82615dc849f33134bd3e9c Mon Sep 17 00:00:00 2001 From: baocm Date: Fri, 30 Jan 2026 15:30:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BC=98=E5=8C=96=E4=B8=8B=E6=A6=9C?= =?UTF-8?q?=E7=A7=B0=E9=87=8D=E9=80=BB=E8=BE=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/Publisher.cxx | 10 ---------- weigh/WeightStabilityDetector.cxx | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/core/Publisher.cxx b/core/Publisher.cxx index a51979f..9116eb7 100644 --- a/core/Publisher.cxx +++ b/core/Publisher.cxx @@ -349,7 +349,6 @@ void PublisherApp::run() float stable_weight1 = 0; float stable_weight2 = 0; int weigh_state = WEIGH_IDLE; - int weigh_timeout = 0; while (!is_stopped()) { @@ -510,7 +509,6 @@ void PublisherApp::run() DEBUG("license_no " << license_no); stable_weight1 = stable_weight; weigh_state = WEIGH_STABLE1; - weigh_timeout = 0; } break; case WEIGH_STABLE1: @@ -519,13 +517,6 @@ void PublisherApp::run() DEBUG("weigh1 clear"); weigh_state = WEIGH_STABLE2; } - if (weigh_timeout++ > 600) - { - DEBUG("weigh1 clear timeout"); - weigh_timeout = 0; - stable_weight2 = stable_weight; - weigh_state = WEIGH_SEND; - } break; case WEIGH_STABLE2: if ((stable_weight != 0) && (license_no.empty() != true)) @@ -542,7 +533,6 @@ void PublisherApp::run() DEBUG("stable_weight2 error"); stable_weight1 = stable_weight; weigh_state = WEIGH_STABLE1; - weigh_timeout = 0; } } break; diff --git a/weigh/WeightStabilityDetector.cxx b/weigh/WeightStabilityDetector.cxx index 3d8da21..007765c 100644 --- a/weigh/WeightStabilityDetector.cxx +++ b/weigh/WeightStabilityDetector.cxx @@ -347,7 +347,7 @@ bool WeightStabilityDetector::isVehicleLeaving(float weight_kg) const { } bool WeightStabilityDetector::isVehicleShaking(float weight_kg) { - if (std::abs(weight_kg - previous_weight_) > config_.jitter_threshold) + if (std::abs(weight_kg - stable_weight_) > config_.jitter_threshold) { is_leaving_state_ = false; // 清除离开状态标记 stable_count_ = 0; // 重置稳定计数