fix: dedupe delay alerts to reduce music stutter
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
-- ============================================================================
|
||||
-- 1. Configuration & Constants
|
||||
-- ============================================================================
|
||||
local APP_VERSION_TEXT = "v1.0.39"
|
||||
local APP_VERSION_TEXT = "v1.0.40"
|
||||
|
||||
local CONFIG = {
|
||||
CLOUD_URL = "ws://stabadmin.fse-media.group",
|
||||
@@ -2537,8 +2537,9 @@ function Main.loop()
|
||||
reason = reason
|
||||
})
|
||||
|
||||
local alertKey = announceKey .. "::delay=" .. tostring(displayDelayMinutes) .. "::reason=" .. tostring(reason or "") .. "::cancel=" .. tostring(cancelled)
|
||||
if cancelled or displayDelayMinutes > 0 then
|
||||
local alertType = cancelled and "cancelled" or ((displayDelayMinutes > 0) and "delayed" or nil)
|
||||
local alertKey = alertType and (announceKey .. "::" .. alertType) or nil
|
||||
if alertKey then
|
||||
if not State.announcedAlerts[alertKey] then
|
||||
State.announcedAlerts[alertKey] = now
|
||||
Utils.log("INFO", string.format("Train Alert: %s (ETA: %ds, Delay: %dm, Cancelled: %s, Reason: %s)", trainName, etaSeconds, displayDelayMinutes, tostring(cancelled), tostring(reason or "")))
|
||||
@@ -2650,7 +2651,7 @@ function Main.loop()
|
||||
reason = nil
|
||||
})
|
||||
|
||||
local alertKey = announceKey .. "::delay=" .. tostring(delay)
|
||||
local alertKey = announceKey .. "::delayed"
|
||||
if delay > 0 then
|
||||
if not State.announcedAlerts[alertKey] then
|
||||
State.announcedAlerts[alertKey] = now
|
||||
|
||||
Reference in New Issue
Block a user