Feature #228
Von Maximilian Seesslen vor etwa 2 Jahren aktualisiert
The beep mode e.g. handles fade in/out Light or to have an smothly blinking LED.
A special feature is needed to enter the mode at a special position.
e.g. when an display Backlight is fading out and someone is touching it, the fading in should not start at the
defined start point but at the brightness where it was when fading out.
Same thing for amibent light. This could also be done by creating an dynamic blink mode. But having static ones
and jumping to the right position automatically, makes it much easier.
<pre><code class="cpp">
int diffPerms=( ( ( slope.endValue - slope.startValue ) * 1000 ) / (FTYPE)slope.duration );
int currentFrequency = slope.startValue + ( ( (FTYPE)elapsedMSeconds(m_timer) * diffPerms ) / 1000 );
</code></pre>
Example: from 1000 to 80 in 1 sec; current value is 540
<pre><code class="cpp">
diffPerms =
((80-1000)*1000) / 1000)=-920 (/1000)
timeShift = ( ( start - current ) * 1000) / diffPerms = -500
timeShift = ( ( 540 - 80 ) * 1000) / -920 = -500
timeShift = ( ( 1000 - 80 ) * 1000) / -920 = -1000 // Its over
// Thats the time to be added to the start time
</code></pre>
A special feature is needed to enter the mode at a special position.
e.g. when an display Backlight is fading out and someone is touching it, the fading in should not start at the
defined start point but at the brightness where it was when fading out.
Same thing for amibent light. This could also be done by creating an dynamic blink mode. But having static ones
and jumping to the right position automatically, makes it much easier.
<pre><code class="cpp">
int diffPerms=( ( ( slope.endValue - slope.startValue ) * 1000 ) / (FTYPE)slope.duration );
int currentFrequency = slope.startValue + ( ( (FTYPE)elapsedMSeconds(m_timer) * diffPerms ) / 1000 );
</code></pre>
Example: from 1000 to 80 in 1 sec; current value is 540
<pre><code class="cpp">
diffPerms =
((80-1000)*1000) / 1000)=-920 (/1000)
timeShift = ( ( start - current ) * 1000) / diffPerms = -500
timeShift = ( ( 540 - 80 ) * 1000) / -920 = -500
timeShift = ( ( 1000 - 80 ) * 1000) / -920 = -1000 // Its over
// Thats the time to be added to the start time
</code></pre>