10.03.2016, 16:30
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')
mbetslave(6)
mb:writebits(0, true)
-- but result is nil due to wrong mb
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')
mbetslave(6)
mb:writebits(0, true)
-- but result is nil due to wrong mb