Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ATL timetable information system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Minetest
ATL timetable information system
Commits
bc541c0c
Commit
bc541c0c
authored
Nov 16, 2020
by
Christoph Heinen
Browse files
Options
Downloads
Patches
Plain Diff
use arrays of displays as one multiline display
parent
bd24563b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
env_setup-fahrplan.lua
+69
-7
69 additions, 7 deletions
env_setup-fahrplan.lua
with
69 additions
and
7 deletions
env_setup-fahrplan.lua
+
69
−
7
View file @
bc541c0c
...
@@ -442,15 +442,16 @@ F.typeset_arrivals = function(arrivals, screen_width)
...
@@ -442,15 +442,16 @@ F.typeset_arrivals = function(arrivals, screen_width)
local
screen_lines
=
{}
local
screen_lines
=
{}
for
platform
,
lines
in
pairs
(
arrivals
.
by_platform
)
do
for
platform
,
lines
in
pairs
(
arrivals
.
by_platform
)
do
local
start
=
platform
..
": "
local
start
=
platform
..
": "
local
new_lines
=
{}
for
i
,
line
in
ipairs
(
lines
)
do
for
i
,
line
in
ipairs
(
lines
)
do
lines
[
i
]
=
"["
..
line
..
"]"
new_
lines
[
i
]
=
"["
..
line
..
"]"
end
end
local
lines
=
table.concat
(
lines
,
", "
)
new_
lines
=
table.concat
(
new_
lines
,
", "
)
if
#
start
+
#
lines
<=
screen_width
then
if
#
start
+
#
new_
lines
<=
screen_width
then
table.insert
(
screen_lines
,
start
..
F
.
util
.
pad_left
(
lines
,
screen_width
-
#
start
-
#
lines
,
pad_char
))
table.insert
(
screen_lines
,
start
..
F
.
util
.
pad_left
(
new_
lines
,
screen_width
-
#
start
-
#
new_
lines
,
pad_char
))
else
else
table.insert
(
screen_lines
,
F
.
util
.
pad_right
(
start
,
screen_width
-
#
start
,
pad_char
))
table.insert
(
screen_lines
,
F
.
util
.
pad_right
(
start
,
screen_width
-
#
start
,
pad_char
))
table.insert
(
screen_lines
,
F
.
util
.
pad_left
(
lines
,
screen_width
-
#
lines
,
pad_char
))
table.insert
(
screen_lines
,
F
.
util
.
pad_left
(
new_
lines
,
screen_width
-
#
new_
lines
,
pad_char
))
end
end
end
end
if
#
screen_lines
<
1
then
if
#
screen_lines
<
1
then
...
@@ -461,7 +462,7 @@ F.typeset_arrivals = function(arrivals, screen_width)
...
@@ -461,7 +462,7 @@ F.typeset_arrivals = function(arrivals, screen_width)
end
end
-- display a nice table over multiple screens
-- display a nice table over multiple screens
F
.
display_arrivals
=
function
(
arrivals
,
lcds
,
screen_width
,
screen_heig
t
h
)
F
.
display_arrivals
=
function
(
arrivals
,
lcds
,
screen_width
,
screen_heigh
t
)
if
S
.
deactivated
then
if
S
.
deactivated
then
return
return
end
end
...
@@ -473,6 +474,67 @@ F.display_arrivals = function(arrivals, lcds,screen_width,screen_heigth)
...
@@ -473,6 +474,67 @@ F.display_arrivals = function(arrivals, lcds,screen_width,screen_heigth)
for
i
,
lcd
in
ipairs
(
lcds
)
do
for
i
,
lcd
in
ipairs
(
lcds
)
do
if
type
(
lcd
)
==
"table"
then
if
type
(
lcd
)
==
"table"
then
local
multi_screen_width
=
#
lcd
[
1
]
*
(
screen_width
-
1
)
local
multi_screen_lines
=
F
.
typeset_arrivals
(
arrivals
,
multi_screen_width
)
local
display_line
=
1
local
lcd_strings
=
{}
for
i
,
line
in
ipairs
(
multi_screen_lines
)
do
display_line
=
(
i
-
1
)
%
screen_height
+
1
--print("displayline " .. display_line)
for
j
,
lcd_name
in
ipairs
(
lcd
[
display_line
])
do
lcd_strings
[
lcd_name
]
=
(
lcd_strings
[
lcd_name
]
or
""
)
..
string.sub
(
line
,(
j
-
1
)
*
screen_width
+
1
,
j
*
screen_width
-
1
)
..
line_break
end
end
--[[for lcd_name,string in pairs(lcd_strings) do
print(lcd_name .. ' ' .. string)
digiline_send(lcd_name, string)
end ]]
for
i
,
lcda
in
ipairs
(
lcd
)
do
for
j
,
lcdb
in
ipairs
(
lcda
)
do
--print(lcdb .. ' ' .. (lcd_strings[lcdb] or "nil"))
digiline_send
(
lcdb
,
lcd_strings
[
lcdb
]
or
line_break
)
end
end
--[[local multi_screen_width = #lcd[1] * screen_width-1
--print("multi_screen_width="..multi_screen_width)
--print('number of screens horizontal: ' .. #lcd[1])
local multi_screen_lines = F.typeset_arrivals(arrivals, multi_screen_width)
--print(F.util.pretty(multi_screen_lines))
for i,lcd1 in ipairs(lcd) do
counter = 1
for j,lcd2 in ipairs(lcd1) do
local string = ""
local break_after = false
for k=counter,#multi_screen_lines do
string = string .. string.sub(multi_screen_lines[k],(j-1)*screen_width+1,j*screen_width-1) .. line_break
if k - counter == screen_height then
counter = k
break_after = true
break
end
end
--print( lcd2 .. ' ' .. string )
digiline_send(lcd2, string)
if break_after then
break
end
end
return ]]
else
else
digiline_send
(
lcd
,
table.concat
(
screen_lines
,
line_break
))
digiline_send
(
lcd
,
table.concat
(
screen_lines
,
line_break
))
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment