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; // 重置稳定计数