SpeedLimit:
Filter:
Classes (extension) | Control

SpeedLimit : Object
ExtensionExtension

limit speed of incomming control messages

Description

Some control sources run at very fast rates, which may cause too much CPU load by running triggered functions too often. SpeedLimit limits these by keeping a minimum time between updates, while making sure slower messages are executed immediately.

First code examples:

Class Methods

SpeedLimit.new(action, dt: 0.1)

make a new speedlimit

Arguments:

action

the action to run when triggered

dt

the minimum time to wait before re-triggering

Inherited class methods

Instance Methods

.action

.action = value

the action to run when triggered

.dt

.dt = value

the minimum time to wait before re-triggering

.filterValue( ... args)

Trigger speedLimit action, if limiting permits. this is used in place of triggeredFunction.value(*args);

Arguments:

... args

.now

last time a trigger, i.e. a call to filterValue came in a.now //

.lastTime

last time the action ran

.latestArgs

the list of latest arguments received

.scheduled

flag whether there is currently a scheduled next trigger

.delta

difference between lastTime and incoming now

Inherited instance methods

Examples