fix: trigger approaching broadcast under 30 seconds

This commit is contained in:
2026-08-02 17:42:49 +08:00
parent b7be4cd00d
commit f922ace154
2 changed files with 23 additions and 12 deletions
+4 -4
View File
@@ -2,7 +2,7 @@
-- ============================================================================
-- 1. Configuration & Constants
-- ============================================================================
local APP_VERSION_TEXT = "v1.0.35"
local APP_VERSION_TEXT = "v1.0.36"
local CONFIG = {
CLOUD_URL = "ws://stabadmin.fse-media.group",
@@ -2524,7 +2524,7 @@ function Main.loop()
reason = reason
})
if etaSeconds >= 0 and etaSeconds <= 45 then
if etaSeconds >= 0 and etaSeconds < 30 then
if not State.announcedApproaching[announceKey] then
State.announcedApproaching[announceKey] = now
Utils.log("INFO", string.format("Train Approaching: %s (ETA: %ds, Delay: %dm)", trainName, etaSeconds, delayMinutes))
@@ -2609,8 +2609,8 @@ function Main.loop()
reason = nil
})
-- 触发逻辑:当 ETA 已经明确 <= 45秒(包括30秒、15秒、现在等),且之前没有播报过
if etaSeconds >= 0 and etaSeconds <= 45 then
-- 触发逻辑:当 ETA 已经明确小于30秒(包括15秒、现在等),且之前没有播报过
if etaSeconds >= 0 and etaSeconds < 30 then
if not State.announcedApproaching[announceKey] then
State.announcedApproaching[announceKey] = now
Utils.log("INFO", string.format("Train Approaching: %s (ETA: %ds, Delay: %dm)", tName, etaSeconds, delay))