fix: correctly assign State.upcomingTrains before display link fallback
This commit is contained in:
@@ -2103,7 +2103,7 @@ function Display.render()
|
||||
|
||||
-- Upcoming Trains
|
||||
if State.upcomingTrains and #State.upcomingTrains > 0 then
|
||||
local startY = State.currentTrain and 11 or 7
|
||||
local startY = State.currentTrain and 10 or 7
|
||||
mon.setCursorPos(1, startY)
|
||||
mon.setTextColor(COLORS.DEBUG)
|
||||
mon.write("UPCOMING TRAINS:")
|
||||
@@ -2327,8 +2327,11 @@ function Main.loop()
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Fallback to Display Link text parsing if Block Reader is not available
|
||||
elseif Peripherals.createTarget then
|
||||
-- Update Upcoming Trains globally for the monitor
|
||||
State.upcomingTrains = newUpcoming
|
||||
|
||||
-- Try CC:C Bridge Display Link (Legacy Text Parsing) if Block Reader is not available
|
||||
if not Peripherals.blockReader and Peripherals.createTarget then
|
||||
local lines = Peripherals.createTarget.dump()
|
||||
|
||||
for k, v in pairs(State.announcedApproaching) do
|
||||
@@ -2409,7 +2412,6 @@ function Main.loop()
|
||||
|
||||
if not Peripherals.station then
|
||||
State.currentTrain = nil
|
||||
State.upcomingTrains = newUpcoming
|
||||
Display.render()
|
||||
Display.renderTerminal()
|
||||
os.sleep(0.5)
|
||||
@@ -2472,7 +2474,6 @@ function Main.loop()
|
||||
end
|
||||
end
|
||||
|
||||
State.upcomingTrains = newUpcoming
|
||||
Display.render()
|
||||
Display.renderTerminal()
|
||||
os.sleep(0.5)
|
||||
|
||||
Reference in New Issue
Block a user