Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
Slowing Down For Loop In SImpl+
#simpl
While I haven't confirm this will work for volume volume ramps, you might try using the SIMPL+ CreateRamp function.? It's mainly used to ramp lighting load.? CreateRamp uses Ramp Control Blocks (RCBs).? You can specified the ramp rate, upper and lower bounds, and the target value after ramping is complete.? To stop the ramp in progress, you use the StopRamp function. So use the CreateRamp to start your ramp and StopRamp to stop it.? While designed to ramp lighting loads,? I see no reason off hand why it wouldn't work for volume control.? Just be careful what is downstream as not all SIMPL symbol will pass RCBs.
Steve |
I did this for a countdown timer (like an egg timer), and it has a cancel button, so needed an easy stop. I did it with a function, and a delay.
?
Integer_Function countdown(integer _countdown_seconds) { ? ? integer i; ? ? for(i = 0 to (_countdown_seconds * 2)) // Time number format = 1s is integer value 100 { if(!countdown_cancel_flag) { Delay(50); //this equals 1/2 second current_time = countdownSecondsInteger - (i/2); } else { ? ? ? ? countdown_cancel_flag = 0; return(0); } } return(1); } |
Why do you need SIMPL+ for this though? :/ There's a variable oscillator in SIMPL. Although if you use a for loop to change a delay then you're also tying up a thread that could be used to do other things in the system indefinitely until the for loop exits as well. (Wait / RetimeWait / CancelWait / PauseWait / ResumeWait / etc.)
-- ?
Crestron Service Provider - TBD Enterprises Inc.
|
toggle quoted message
Show quoted text
|
Doing loops with delays over complicates things. You need to think about doing a different method. No loops at all are required if you use the CreateRamp and StopRamp functions.?
For example, assume you have a raise button.? When you press the raise button, you execute a SIMPL+ CreateRamp function and then return.? When you release the button, you call the StopRamp function and return.? Very simple and no loops or delays are required.? If you just need to ramp to a particular level, just call the CreateRamp function with the appropriate target value and you are done. |
to navigate to use esc to dismiss