An idea for AP_Tuning library for transmitter tuning

@Rob_Lefebvre one issue I just realised with your use of tuning as a yaw gain is that the new AP_Tuning system reverts your gain when you change flight mode. It would go back to the “wait for mid-point”.
We could add a parameter to control if it should revert on mode change, but first I’d like to know if this is an issue for you.

Yep, it’s definitely an issue. The fixed range may also be an issue, I won’t know until I use it.

What I’m doing now is very simple. I set the target parameter (Rate Yaw P in this case), I set the range. Then, the gain is determined as a ratio of the set range, based on knob position at that point in time. That’s it.

You can adjust the range using TUNE_RANGE. The difference is it is a multiplier of the current saved value. So if your saved yawP is 0.3 and you set TUNE_RANGE to 3 then the knob will go from 0.1 to 0.9.
For reverting on mode change I could add a TUNE_MODE_REVERT option. It would default to 1 meaning that a mode change reverts any tuning changes. You could set it to 0. Sound ok?

Yeah, I think we’re getting close. If TUNE_MODE_REVERT = 0 would the tuning work right at boot-up without doing anything? This is what I’m looking for. So that, no matter what, the tuning value is set according to the knob position, period. Without having to flick any switches, or move the knob.

I guess it’s a little weird that the slope of the tuning change will be higher on the top half of the range than the bottom half. It will be more sensitive from 0.1-0.3, then have 3 times the slope from 0.3-0.9.