mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
+ Add system timestamps to lua read() and new lua read_line() per global options
+ Add missing timestamp-format epoch + Update send_ to use fsync and tcdrain like normal tty_sync does + Rework read_line to save partial line at timeout + Simplified read_line to reduce cyclomatic complexity + renamed example files read.lua and read_line.lua + moved #define READ_LINE_SIZE to top of file + renamed g_linebuf to linebuf, and moved it into read_line as a static variable
This commit is contained in:
parent
db3f109c7d
commit
afd82f7ac4
12 changed files with 171 additions and 24 deletions
14
examples/lua/read.lua
Normal file
14
examples/lua/read.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
read(1000, 6000) -- initial config
|
||||
send("\n")
|
||||
msleep(100)
|
||||
read(650, 60) -- main menu
|
||||
send("S") -- S menu
|
||||
msleep(30)
|
||||
read(650, 60)
|
||||
send("t") -- Parallel Value Table
|
||||
read(650, 60)
|
||||
while true do
|
||||
msleep(1000)
|
||||
send("t")
|
||||
read(650, 50) -- repeat PVT forever
|
||||
end
|
||||
17
examples/lua/read_line.lua
Normal file
17
examples/lua/read_line.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
read(1000, 8000) -- read initial config
|
||||
send("\n")
|
||||
read(650, 100) -- main menu
|
||||
send("S") -- S menu
|
||||
n = 1
|
||||
while n > 0 do -- while not empty, read more
|
||||
n, str = read_line(25)
|
||||
end
|
||||
while true do
|
||||
send("t") -- query PV table
|
||||
msleep(880)
|
||||
n = 1
|
||||
while n > 0 do -- while not empty, read more
|
||||
n, str = read_line(60)
|
||||
msleep(60)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue