fix(client): 解决终端配置界面文字重叠与停站状态进站预告误报问题

1. 修复配置界面 UI 布局:当发车音乐可用列表过长时导致与后续输入提示重叠的问题,通过拆分显示并换行解决。
2. 彻底解决停站时误报进站预告:当 CC 电脑检测到当前站台已有列车停靠(`State.currentTrain ~= nil`)时,无论显示器上显示的是该站台的当前列车发车倒计时,还是被阻塞的下一班列车的到达倒计时,均强制抑制针对该站台的“进站预告”触发,直至站台被清空。
This commit is contained in:
2026-08-04 11:29:45 +08:00
parent c86fca8449
commit 01ac488aef
+29 -15
View File
@@ -1,6 +1,6 @@
-- 1. Configuration & Constants -- 1. Configuration & Constants
local APP_VERSION_TEXT = "v1.0.57" local APP_VERSION_TEXT = "v1.0.58"
local CONFIG = { local CONFIG = {
CLOUD_URL = "ws://stabadmin.fse-media.group", CLOUD_URL = "ws://stabadmin.fse-media.group",
@@ -273,9 +273,11 @@ function Utils.promptSlaveIdentity()
term.setCursorPos(1, 10) term.setCursorPos(1, 10)
term.setTextColor(colors.gray) term.setTextColor(colors.gray)
term.write("Available beeps: " .. availStr) term.write("Available beeps:")
term.setTextColor(colors.white)
term.setCursorPos(1, 11) term.setCursorPos(1, 11)
term.write(availStr)
term.setTextColor(colors.white)
term.setCursorPos(1, 13)
term.write("Departure beep (e.g. fc1): ") term.write("Departure beep (e.g. fc1): ")
term.setCursorPos(30, 6) term.setCursorPos(30, 6)
@@ -285,15 +287,15 @@ function Utils.promptSlaveIdentity()
term.setCursorPos(31, 8) term.setCursorPos(31, 8)
local stationPlatform = Utils.trim(read() or "") local stationPlatform = Utils.trim(read() or "")
term.setCursorPos(32, 11) term.setCursorPos(32, 13)
local departureBeep = Utils.trim(read() or "") local departureBeep = Utils.trim(read() or "")
if departureBeep == "" then departureBeep = "fc1" end if departureBeep == "" then departureBeep = "fc1" end
if stationCode == "" or stationPlatform == "" then if stationCode == "" or stationPlatform == "" then
term.setCursorPos(1, 12) term.setCursorPos(1, 15)
term.setTextColor(colors.red) term.setTextColor(colors.red)
term.write("Both station code and platform are required.") term.write("Both station code and platform are required.")
term.setCursorPos(1, 14) term.setCursorPos(1, 16)
term.setTextColor(colors.lightGray) term.setTextColor(colors.lightGray)
term.write("Press any key to retry...") term.write("Press any key to retry...")
os.pullEvent("key") os.pullEvent("key")
@@ -359,9 +361,11 @@ function Utils.promptConfig()
term.setCursorPos(1, 10) term.setCursorPos(1, 10)
term.setTextColor(colors.gray) term.setTextColor(colors.gray)
term.write("Available beeps: " .. availStr) term.write("Available beeps:")
term.setTextColor(colors.white)
term.setCursorPos(1, 11) term.setCursorPos(1, 11)
term.write(availStr)
term.setTextColor(colors.white)
term.setCursorPos(1, 13)
term.write("Departure beep [" .. currentBeep .. "]: ") term.write("Departure beep [" .. currentBeep .. "]: ")
term.setCursorPos(30, 6) term.setCursorPos(30, 6)
@@ -373,17 +377,17 @@ function Utils.promptConfig()
local platformInput = Utils.trim(read() or "") local platformInput = Utils.trim(read() or "")
if platformInput == "" then platformInput = currentPlatform end if platformInput == "" then platformInput = currentPlatform end
term.setCursorPos(32, 11) term.setCursorPos(32, 13)
local beepInput = Utils.trim(read() or "") local beepInput = Utils.trim(read() or "")
if beepInput == "" then beepInput = currentBeep end if beepInput == "" then beepInput = currentBeep end
local ok = Utils.saveStationIdentity(codeInput, platformInput, beepInput) local ok = Utils.saveStationIdentity(codeInput, platformInput, beepInput)
if ok then if ok then
Utils.refreshStationIdentity() Utils.refreshStationIdentity()
term.setCursorPos(1, 12) term.setCursorPos(1, 15)
term.setTextColor(colors.green) term.setTextColor(colors.green)
term.write("Configuration saved.") term.write("Configuration saved.")
term.setCursorPos(1, 14) term.setCursorPos(1, 16)
term.setTextColor(colors.lightGray) term.setTextColor(colors.lightGray)
term.write("Press any key to return...") term.write("Press any key to return...")
os.pullEvent("key") os.pullEvent("key")
@@ -393,10 +397,10 @@ function Utils.promptConfig()
State.inConfig = false State.inConfig = false
break break
else else
term.setCursorPos(1, 12) term.setCursorPos(1, 15)
term.setTextColor(colors.red) term.setTextColor(colors.red)
term.write("Failed to save configuration.") term.write("Failed to save configuration.")
term.setCursorPos(1, 14) term.setCursorPos(1, 16)
term.setTextColor(colors.lightGray) term.setTextColor(colors.lightGray)
term.write("Press any key to retry...") term.write("Press any key to retry...")
os.pullEvent("key") os.pullEvent("key")
@@ -2764,8 +2768,13 @@ function Main.loop()
end end
local isAtStation = false local isAtStation = false
local trainPlatform = tostring(platform or State.stationPlatform or "1")
local currentPlatform = tostring(State.stationPlatform or "1")
if State.currentTrain then if State.currentTrain then
if State.currentTrain.id == trainName then if trainPlatform == currentPlatform then
isAtStation = true
elseif State.currentTrain.id == trainName then
if trainName == "???" or trainName == "Unknown" or trainName == "" then if trainName == "???" or trainName == "Unknown" or trainName == "" then
if Utils.isFuzzyMatch(State.currentTrain.dest, destination) then if Utils.isFuzzyMatch(State.currentTrain.dest, destination) then
isAtStation = true isAtStation = true
@@ -2913,8 +2922,13 @@ function Main.loop()
end end
local isAtStation = false local isAtStation = false
local trainPlatform = tostring(platform or State.stationPlatform or "1")
local currentPlatform = tostring(State.stationPlatform or "1")
if State.currentTrain then if State.currentTrain then
if State.currentTrain.id == tName then if trainPlatform == currentPlatform then
isAtStation = true
elseif State.currentTrain.id == tName then
if tName == "???" or tName == "Unknown" or tName == "" then if tName == "???" or tName == "Unknown" or tName == "" then
if Utils.isFuzzyMatch(State.currentTrain.dest, dest) then if Utils.isFuzzyMatch(State.currentTrain.dest, dest) then
isAtStation = true isAtStation = true