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.

Dali interface dimming
#8
Right now we don't have enough resources to implement this.

Here's a function for start/stop dimming:
Code:
function bindimmer(up, down, out, event)
 local main, rev, step, val, new, delay

 step = 10 -- in %
 delay = 0.5 -- in seconds

 -- ignore "stop" command
 val = tonumber(event.datahex, 16)
 if val == 0 then
   return
 end

 -- up, normal mode
 if event.dst == up then
   main, rev = up, down
 -- down, reverse step
 elseif event.dst == down then
   main, rev = down, up
   step = -step
 -- invalid object
 else
   return
 end

 -- current output object value
 val = grp.getvalue(out) or 0

 while true do
   -- main object in "stop" state
   if not grp.getvalue(main) then
     return
   end

   -- reverse object in "start" state
   if grp.getvalue(rev) then
     return
   end

   -- get new value
   new = math.min(100, val + step)
   new = math.max(0, new)

   -- no change, stop
   if new == val then
     return
   end

   -- write new value
   val = new
   grp.write(out, new, dt.scale)

   -- wait for next run
   os.sleep(delay)
 end
end

Usage:

1. Add bindimmer function to Common functions

2. Create 3 objects:
1/1/1 - binary (dim up)
1/1/2 - binary (dim down)
1/1/3 - 1-byte scale (output)

3. Create an event script for each binary object:
Code:
bindimmer('1/1/1', '1/1/2', '1/1/3', event)

4. You can tune step and delay variables in bindimmer function to adjust dimming speed
Reply


Messages In This Thread
Dali interface dimming - by PassivPluss - 29.07.2015, 17:38
RE: Dali interface dimming - by PassivPluss - 01.08.2015, 18:59
RE: Dali interface dimming - by Peter - 03.08.2015, 15:03
RE: Dali interface dimming - by edgars - 04.08.2015, 10:10
RE: Dali interface dimming - by PassivPluss - 15.09.2015, 03:04
RE: Dali interface dimming - by managementboy - 16.09.2015, 10:48
RE: Dali interface dimming - by admin - 18.09.2015, 06:40
RE: Dali interface dimming - by PassivPluss - 18.10.2015, 05:23
RE: Dali interface dimming - by admin - 19.10.2015, 06:25

Forum Jump: