+ Add system timestamps to lua read() and new lua read_line() per global options; prevented warnings

+ 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
This commit is contained in:
Keith Hill 2024-10-25 11:22:56 -05:00
parent ab678e6c88
commit e5f9b947c4
13 changed files with 201 additions and 22 deletions

17
examples/lua/lines.lua Normal file
View 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

14
examples/lua/pts.lua Normal file
View 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

16
examples/lua/pvt.lua Normal file
View file

@ -0,0 +1,16 @@
send("\n")
msleep(100)
-- read buffer with 0.5 sec delay
read(160, 500)
send("S")
msleep(100)
-- read buffer
read(160, 500)
-- query Parallel Value Table
send("t")
print(read(300, 500))
while true do
sleep(1)
send("t")
print(read(300, 500))
end