It's easy to overthink compensation. It's actually very simple - if you break it down. It can be done using two or three mixes,
including adjustment via a spare trim.
Let's take motor compensation.
Expressed in plain English:
motor speed affects elevator
% Motor-speed => elevator.
That's an interaction. And in OpenTX, an interaction translates to a mix.
So let's make the mix!
The source of the mix is %motorspeed, and the destination is the elevator channel:
CH2:elevator
MIX1 Source = %Motorspeed
Of course we don't have a %Motorspeed source, so let's fake it from the motor channel.
Assuming that CH7 is the motor channel, we have:
CH2:elevator
MIX1 Source = CH7:Motor
Well actually.... that's not quite right, because if motor is done correctly, CH7 will vary from -100% to +100%. We want a true percentage value in the range 0% to 100%.
To do that, we apply a weight and offset of 50%. [this works because
mixer-output = source-value * weight + offset]
CH2:elevator
MIX1 Source=CH7:Motor Weight=50% Offset=50%
So now compensation = motorspeed%. In other words, compensation will be zero at idle, rising to 100% at full throttle...
WHHOAAA: 100% compensation means full up (or down) elevator!! We don't want to be doing loops just by opening the throttle... We need to dial reduce maximum compensation...
Since we're going to adjust compensation using a trim, let's do both the adjustment and the reduction of max compensation all in one go. We do that by adding a MULTIPLY mix, with source=throttle-trim, and some appropriate weight:
CH2:elevator
MIX1 Source=CH7:Motor Weight=50% Offset=50%
MIX2 Source=TrmT Weight={something%} Multiplex=MULTIPLY
Looking at the individual mixer outputs:
- MIX1 varies from 0-100% depending on the motor speed
- In MIX2, TrmT varies from -100% to +100% (because that's how trims work). This is multiplied by the weight, so the output of MIX2 varies from -{something%} to +{something%} depending on the trim position.
Let's check the result of multiplying the two mixes:
- When the motor is at idle, MIX1 is zero, so the result is always zero (regardless of the throttle trim position).
- When the motor is at full power, MIX1 =100%, and the result will be dependent solely on MIX2. In other words +/-{something%} depending on the TrmT position.
At full power, we might want say +/-50% of the available elevator movement, so... we just set 'something%' to 50% (who said OpenTx was difficult!) :
CH2:elevator
MIX1: Source=CH7:Motor Weight=50% Offset=50%
MIX2: Source = TrmT weight=50% Multiplex=MULTIPLY
[...]
Hold on... we're not quite done yet.
The MULTIPLY operator works on the result of all the mixers above it, so these two lines
must be at the top of the elevator channel. This is rather restrictive - for example we would hit a problem if a flap compensation mix were added.
A better way is to farm the compensation calculation to a high mix, and insert the result back into the elevator mix:
CH2:elevator
MIX1: Source=CH10:compensation
[...]
CH10:compensation
MIX1 Source=CH7 Weight=50% Offset=50%
MIX2 Source = TrmT weight=50% Multiplex=MULTIPLY
Another benefit of this approach is that it breaks up the code into manageable chunks.
Okay okay, so you want flap comp as well! No problem, it can be added in exactly the same way, except the source will be the flap lever (instead of CH7). So, if the flap lever is LS, then CH10>MIX1 would look like this:
MIX1 Source=LS Weight=50% Offset=50%
To reverse the sense of LS, change the sign of weight.