C-Bus Forums  

Go Back   C-Bus Forums > C-Bus Products > Pascal Logic Code Examples

The C-Bus Community Forums is place where C-Bus users can share information and help others with C-Bus. From time to time you will see Clipsal staff on the forums, but this is not an official support channel. If you really need help contact the official support services of Clipsal. More information about the purpose of this forum is available here.

Reply
 
Thread Tools Display Modes
  #11  
Old 22 May 14, 12:56 PM
Ashley Ashley is online now
Senior Member
 
Join Date: Dec 2005
Location: Adelaide, Australia
Posts: 547
Default

Good pick up. I don't usually dim lights up from off. Anyway, I edited to logic to fix the problem. Just add the last line.

Quote:
There has to be a clean, simple way to have a short press just turn on and off to variable level, while still retaining dimming. Surely! *grin*
If there is it has eluded everyone so far

Last edited by Ashley; 22 May 14 at 01:02 PM.
Reply With Quote
  #12  
Old 22 May 14, 01:45 PM
lorenthehaloboy lorenthehaloboy is offline
Member
 
Join Date: Nov 2004
Posts: 66
Default

Thanks Ash, it wasnt just for dimming up. The scenario where a light is on, or at say 60% at 10pm, and then at 11pm this kicks in, the script would have no idea what level the light was at when they hit pushed the button to turn the light off.

It would go to 1%, assume the light was previously at 0%, and so it would turn them on to 30%.

I may be missing something, but not sure how that last line of code helps in these situations unfortunately, unless all lights at 11pm were polled to get their status, and store that level maybe?

It still doesnt help if someone dims a light up to an unknown 46% or something, as when they go to turn it off, it will turn it back on again.
Reply With Quote
  #13  
Old 22 May 14, 03:46 PM
Ashley Ashley is online now
Senior Member
 
Join Date: Dec 2005
Location: Adelaide, Australia
Posts: 547
Default

When you long press a button with downcycle set (i.e. a dimmer), cbus sends out a ramp to level function with an end of 0 or 255 depending upon the last ramp direction. The switch then internally tracks the ramp level. When you release the button, the endramp function is executed. The switch then sends out a ramp to level at its currently tracked position with a 0 ramp time. This effectively sets the group level to the level the switch thinks it should be. This is why sometimes when you release a dimmer switch the light level changes slightly. Delays on the bus can cause a slight variation in what the switch thinks the level should be relative to what the dimmer unit does. The logic will pick up the level sent from the endramp function and set its internal saved level. The same is true whenever anyone else changes the group. So savedLevel will now track the group where ever it is. Try it, it works.
Reply With Quote
  #14  
Old 16 May 17, 08:26 PM
stubbsy stubbsy is offline
New Member
 
Join Date: Jan 2009
Posts: 2
Default

There is an error in the code - shd say "savedLevel" not "saved_level"

That is the only way I could get it to compile and I can't even code (I once did it for 1 hour in 1982)

Seems to work though - thanks
Reply With Quote
  #15  
Old 16 May 17, 09:33 PM
stubbsy stubbsy is offline
New Member
 
Join Date: Jan 2009
Posts: 2
Default

Actually no it does not (at least not all the time).

A short press to turn off, dims the light but then it straight back up - I think it is somehtging to do with the recalled level
Reply With Quote
  #16  
Old 16 May 17, 11:02 PM
Ashley Ashley is online now
Senior Member
 
Join Date: Dec 2005
Location: Adelaide, Australia
Posts: 547
Default

I fixed up the typo. Thanks for pointing it out.

It works fine for me. I just loaded it up and tried it again.

Make sure you have the switch set up properly. On the Key Functions tab you should see:
Short Press: Idle
Short release: Recall 1
Long press: Downcycle
Long release: Endramp

On the blocks tab for that switch, recall1 should be set to 1.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Toolkit 1.3 Released Duncan C-Bus Toolkit and C-Gate Software 0 27 Mar 06 10:49 AM
Toolkit : Wireless - Where Is Dimmer Function? george Quick Tutorials (Read Only) 0 02 Nov 04 05:21 PM


All times are GMT +10.5. The time now is 09:37 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.