Smooth fades

Mike Shellim 26 June 2021
Updated 22 April 2022

Fading is a way of switching smoothly between two different configurations. OpenTX already offers fades - but only between flight modes. So this article shows how to create a fade within a flight mode.


As an example, we'll consider a motor which must operate in two modes, under the control of switch SF.

The change from one state to the other must take 2 seconds, and must always be smooth.


The solution which follows is simple and robust, using one channel and four mixers.

The key is to make a channel act as a time-based ramp, controlled by SF. The ramp channel consists of a single mix:

+= SF Weight(+50%) Offset(50%) Slow(u=1: d=1) -- fade duration

With SF in one position, the channel value is zero. With SF in the other position, the channel value is 100%. The transition takes 2 seconds. The ramp varies smoothly and predictably as the position of SF changes.

Next, we calculate the contribution of each end point according to where we are on the ramp, call this ramp%. One end point will contribute Ramp%, and the other (100% - Ramp%). Then we add the contributions, and assign the result to the motor channel. The equation is:

Motor = Thr*(100%-Ramp%) + (-85%)*Ramp%

Ramp% is the simply value of CH10, so we can implement the equation as follows:

+= Thr Weight(+100%) -- Thr ...
*= CH10:Ramp Weight(-100%) Offset(100%) -- ... *(100% — Ramp%)
+= CH10:Ramp Weight(-85%) -- -85%*Ramp%

Recall that the output of a mix = offset + source_value*weight. We make use of that in the second line to calculate  '(100% — Ramp%)'.

And that's it.

Here's a demo file:



(For OpenTX 2.2 and above)