diff --git a/station_broadcast.lua b/station_broadcast.lua index 96bc702..4c7187b 100644 --- a/station_broadcast.lua +++ b/station_broadcast.lua @@ -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