From db818209f21b286626a823c71f88ada88d36e170 Mon Sep 17 00:00:00 2001 From: HenryDu8133 <813367384@qq.com> Date: Sun, 2 Aug 2026 17:08:59 +0800 Subject: [PATCH] debug: show raw create target line and eta fields --- station_broadcast.lua | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/station_broadcast.lua b/station_broadcast.lua index d72ad63..9d48b84 100644 --- a/station_broadcast.lua +++ b/station_broadcast.lua @@ -2,7 +2,7 @@ -- ============================================================================ -- 1. Configuration & Constants -- ============================================================================ -local APP_VERSION_TEXT = "v1.0.32" +local APP_VERSION_TEXT = "v1.0.33" local CONFIG = { CLOUD_URL = "ws://stabadmin.fse-media.group", @@ -2176,7 +2176,23 @@ function Display.render() if #rawLine > w then rawLine = rawLine:sub(1, w) end mon.write(rawLine) end - logsStartY = upcomingStartY + 5 + if upcomingStartY + 5 <= h then + mon.setCursorPos(1, upcomingStartY + 5) + local partsLine = string.format( + "VAL:%s UNIT:%s", + tostring(dbg.textEtaValue or "-"), + tostring(dbg.textEtaUnit or "-") + ) + if #partsLine > w then partsLine = partsLine:sub(1, w) end + mon.write(partsLine) + end + if upcomingStartY + 6 <= h then + mon.setCursorPos(1, upcomingStartY + 6) + local lineRaw = "RAW:" .. tostring(dbg.rawLine or "-") + if #lineRaw > w then lineRaw = lineRaw:sub(1, w) end + mon.write(lineRaw) + end + logsStartY = upcomingStartY + 7 end if hasUpcoming then mon.setTextColor(COLORS.INFO) @@ -2412,8 +2428,11 @@ function Main.loop() ok = false, trainStopsCount = 0, tickRate = State.tickRate or 20, + rawLine = nil, textKey = nil, textEtaRaw = nil, + textEtaValue = nil, + textEtaUnit = nil, nbtKey = nil, textEta = nil, nbtEta = nil, @@ -2427,6 +2446,9 @@ function Main.loop() if okLines and type(lines) == "table" then for _, lineText in pairs(lines) do if lineText and lineText ~= "" and lineText:match("[%w%?%[]") then + if not dbg.rawLine then + dbg.rawLine = lineText + end local cleanLine = string.gsub(lineText, "%s*%(?%+%s*%d+.-%)?", "") local etaValue, etaUnit, tName, dest etaValue, etaUnit, tName, dest = string.match(cleanLine, "^(%S+)%s+(.-)%s+(%[.-%][^%s]*)%s+(.*)$") @@ -2445,6 +2467,8 @@ function Main.loop() if not dbg.textKey then dbg.textKey = textKey dbg.textEtaRaw = etaStr + dbg.textEtaValue = etaValue + dbg.textEtaUnit = etaUnit dbg.textEta = etaSeconds end end