Help Programming Mixer

Programing help and example for all firmwares based on thus's th9 firmware.
Post Reply
ChrisKrieg
Posts: 4
Joined: Wed Aug 20, 2014 7:23 pm
Country: -

Help Programming Mixer

Post by ChrisKrieg » Wed Aug 20, 2014 8:12 pm

I'm trying to a a mixer to my throttle so that I will have a 100% linear curve when the switch is off, but a linear curve that goes from -100 to 0 when the switch is on. I want to do this because my quad is using 20A ESCs for each motor, but my LiIon batteries can't handle that amount of current draw. I want to have full use of my throttle stick with a 50% max on the throttle signal.

I tried assigning a curve that is exactly how I want the active mix to behave.
Image
However, when the mix switch (gear) is not active the output of the throttle channel (ch3) is always zero. I've tried using "add", "multiply" and "replace" in the mix settings, but nothing seems to work. The wiki said that if the mix switch (gear) is off the mix shouldn't apply to the channel. So why is the output locked to zero?

Here's my current mix after removing the curve.
Image
Image


I want the mix curve to apply only when the gear switch (GEA) is active. That way I can calibrate my ESCs to recognize 1050us to 1890us as the full range of signal input (1890us being the value of full throttle, 20A) then I can flip the gear switch and activate the mix, giving me 10A for WOT on each ESC and protecting my LiIon batteries from over discharge damage.

Any help is greatly appreciated.

User avatar
Kilrah
Posts: 9671
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Help Programming Mixer

Post by Kilrah » Wed Aug 20, 2014 8:16 pm

ChrisKrieg wrote:The wiki said that if the mix switch (gear) is off the mix shouldn't apply to the channel. So why is the output locked to zero?
If the GEA switch is off the mix doesn't apply to the channel, BUT then there are no mixes at all controlling the channel, so its output defaults of 0.

You simply need to add another line that is active when that one isn't, with the control type you want.

ChrisKrieg
Posts: 4
Joined: Wed Aug 20, 2014 7:23 pm
Country: -

Re: Help Programming Mixer

Post by ChrisKrieg » Wed Aug 20, 2014 8:28 pm

Kilrah wrote:If the GEA switch is off the mix doesn't apply to the channel, BUT then there are no mixes at all controlling the channel, so its output defaults of 0.

You simply need to add another line that is active when that one isn't, with the control type you want.
Thanks for the fast reply. Your explanation makes sense, but how can I add another line that is active when GEA is active? Can I add another mix to CH3 when !GEA is active?

User avatar
MikeB
9x Developer
Posts: 15811
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Help Programming Mixer

Post by MikeB » Wed Aug 20, 2014 8:32 pm

You need two mixes on the throttle channel (3)
CH3: +81% THR
R +41% THR Offset(-40%) FIX OFFSET ON Switch(GEA) [Note REPLACE multiplex]

You may well find that using a maximum of half the full throttle value actually gives you quite a bit less than 10A per motor, so you may want more than the 41% on the second mix. If, for example, you need 50% on it, change the whole mix to:
R +50% THR Offset(-31%) FIX OFFSET ON Switch(GEA)
The sum of the weight (when negative) and the offset should equal -81% to match the 81% of the first mix.

(The FIX OFFSET option is needed otherwise the offset value is modified by the weight value. It might be argued that FIX OFFSET ON is how it should have always been. I added this as an option, rather than change the functionality to prevent existing mixes from going wrong).

Mike.
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

ChrisKrieg
Posts: 4
Joined: Wed Aug 20, 2014 7:23 pm
Country: -

Re: Help Programming Mixer

Post by ChrisKrieg » Wed Aug 20, 2014 8:48 pm

MikeB wrote:You need two mixes on the throttle channel (3)
CH3: +81% THR
R +41% THR Offset(-40%) FIX OFFSET ON Switch(GEA) [Note REPLACE multiplex]

You may well find that using a maximum of half the full throttle value actually gives you quite a bit less than 10A per motor, so you may want more than the 41% on the second mix. If, for example, you need 50% on it, change the whole mix to:
R +50% THR Offset(-31%) FIX OFFSET ON Switch(GEA)
The sum of the weight (when negative) and the offset should equal -81% to match the 81% of the first mix.

(The FIX OFFSET option is needed otherwise the offset value is modified by the weight value. It might be argued that FIX OFFSET ON is how it should have always been. I added this as an option, rather than change the functionality to prevent existing mixes from going wrong).

Mike.
I implemented the settings that you suggested, but the results are the same as before.

CH3: THR
source thr
weight 41
offset -41
fix offset on
flmodetrim off
curve ---
switch GEA
multiplex replace

This results in the same channel behavior as if I used
CH3: THR
source thr
weight 81
offset 0
fix offset off
flmodetrim off
curve c1 (shown in my original post)
switch GEA
multiplex replace

When GEA is off the output of CH3 is still zero. How do I add a second mix to the same channel? CH3


User avatar
Kilrah
Posts: 9671
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Help Programming Mixer

Post by Kilrah » Wed Aug 20, 2014 9:02 pm

ChrisKrieg wrote: Thanks for the fast reply. Your explanation makes sense, but how can I add another line that is active when GEA is active? Can I add another mix to CH3 when !GEA is active?
Yes.
Either you put the first line with no switch, and the second with GEA and REPLACE multiplex, or you put one line with !GEA switch and the other with GEA.

User avatar
MikeB
9x Developer
Posts: 15811
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Help Programming Mixer

Post by MikeB » Wed Aug 20, 2014 9:02 pm

What revision of er9x are you running (the latest is r813)?
Since about r780, mix editing uses a 'popup' menu option for the mixes. Simply move to CH3, press MENU to get the popup, then select INSERT. This will create a new mix on channel 3 and take you to the mix editor.

Mike.
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

ChrisKrieg
Posts: 4
Joined: Wed Aug 20, 2014 7:23 pm
Country: -

Re: Help Programming Mixer

Post by ChrisKrieg » Wed Aug 20, 2014 9:14 pm

MikeB wrote:What revision of er9x are you running (the latest is r813)?
Since about r780, mix editing uses a 'popup' menu option for the mixes. Simply move to CH3, press MENU to get the popup, then select INSERT. This will create a new mix on channel 3 and take you to the mix editor.

Mike.
I've got it now. I didn't know that INSERT added a new mix for the same channel. Thanks for your help.

Post Reply

Return to “er9x / gruvin9x / th9 based firmwares”