This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

How to share file descriptor between scripts
#1
Hi All,

I have to open file descriptor once at system init and share it between all scripts. But the following approach doesn't work because this type of data looks like not supported by storage.
How to get it working?
Thanks

init script:

local mb = luamodbus.rtu()
mb:open('/dev/RS485-1', 38400, 'N', 8, 1, 'H')
mb:connect()
storage.set('f_mb_rtu_1', mb)

resident script:

local mb =  storage.get('f_mb_rtu_1')
mbConfusedetslave(6)
mb:writebits(0, true)


-- but result is nil due to wrong mb
Reply


Messages In This Thread
How to share file descriptor between scripts - by 4poker - 10.03.2016, 16:30

Forum Jump: