debug: show raw create target line and eta fields

This commit is contained in:
2026-08-02 17:08:59 +08:00
parent a1db54b295
commit db818209f2
+26 -2
View File
@@ -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