EasyManuals Logo

Embedded Systems LogiMachine5 Power User Manual

Embedded Systems LogiMachine5 Power
254 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #207 background imageLoading...
Page #207 background image
207
-- calculate sleep time
self.sleep = 1 / params.resolution
-- reset channel map
self.channels = {}
-- empty channel value map
self.conn:ltrim(params.skey, 1, 0)
-- fill channel map
for chan = 1, params.channels do
self.channels[ chan ] = { current = 0, target = 0, ticks = 0 }
-- turn off by default
self.conn:lpush(params.skey, 0)
self.dm:setchannel(chan, 0)
end
end
-- get new values
function DMX:getvalues()
local max, channels, ticks, values, val
max = self.params.channels
channels = self.channels
ticks = self.ticks
values = self.conn:lrange(self.params.skey, 0, max - 1) or {}
-- check for new values for each channel
for chan = 1, max do
val = tonumber(values[ chan ]) or 0
-- target value differs, set transcation
if val ~= channels[ chan ].target then
channels[ chan ].target = val
channels[ chan ].delta = (channels[ chan ].target - channels[ chan
].current) / ticks
channels[ chan ].ticks = ticks
end
end
end
-- main loop handler
function DMX:run()
self:getvalues()
-- transition loop
for i = 1, self.params.resolution do
self:step()
self.dm:send()
os.sleep(self.sleep)
end
end
-- single transition step
function DMX:step()
local chan, channels, t
channels = self.channels
-- transition for each channel

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Embedded Systems LogiMachine5 Power and is the answer not in the manual?

Embedded Systems LogiMachine5 Power Specifications

General IconGeneral
BrandEmbedded Systems
ModelLogiMachine5 Power
CategoryController
LanguageEnglish