Excellent - is there some documentation?
but
snap refresh lxi-tools --edge
snap "lxi-tools" has no updates available
The snap system automatically updates your snaps when new updates are available. So your snap is likely up-to-date.
If you want to make sure you can see the list of latest lxi-tools snap versions here:
https://dashboard.snapcraft.io/snaps/lxi-toolsAnd compare it with the information retrieved from the "snap info lxi-tools" command.
Documentation is work in progress. I will try to soon expand with more documentation in the man page.
To run the script named myscript.lua, simply do e.g.:
$ lxi run myscript.lua
In the script file you add regular Lua script code which can use any of the available Lua script libraries for math, file I/O, etc.. See more here:
https://www.tutorialspoint.com/lua/index.htmThere is also a Lua quick guide here:
https://www.tutorialspoint.com/lua/lua_quick_guide.htmIn addition, lxi-tools provides the following Lua functions for managing instruments:
-- Connect to instrument ip and return device handle
device = connect(ip)
-- Send SCPI command to device and return response if ? command
response = scpi(device, command)
-- Send SCPI command to device and return raw response if ? command
response = scpi_raw(device, command)
-- Sleep ms
msleep(milliseconds)
-- Sleep seconds
sleep(seconds)
-- Disconnect device
disconnect(device)
Most of the interfaces are demonstrated in
https://github.com/lxi-tools/lxi-tools/blob/master/test/test.luaAs you can see you simply connect to your instrument using the connect function which give you a device handle upon which the scpi function can operate. This allows to connect to multiple instruments in the same session.
In case of a question command, the scpi command returns a sanitized response string (removes newlines and carriage returns from the received response string).
Likewise, the scpi_raw command returns the original non sanitized response from the instrument, useful if receiving e.g. image or trace binary data.
Notice that the example script uses the Lua function tonumber() Lua to convert the received scientific notation number string (e.g. "+5.000E-2", notation returned by most instruments) to a float number.
Thats pretty much all there is to it. You simply connect to instruments, send scpi commands, and use Lua to do comparison, loops, data manipulation, wait delays, conditional delays, write stuff to disk, etc.. The possibilities are almost endless.
If you have any questions regarding how to do specific things in Lua feel free to ask here, I will try help best I can.