This thread is privately moderated by Miami Mike, who may elect to delete unwanted replies.
Mar 09, 2017, 12:42 PM
Healthy suntan is an oxymoron.
Discussion

# Taranis: Here's a pitfall to watch for when using a switch to control a motor.

If you program a switch to operate a motor you'll find that the way switches work seems upside-down. Using SE as an example, SE↑ = -100% and SE↓ = +100%.

The simplest way to correct that is to read the switch with a mix that has a negative weight, like this:
Code:
`CH07 (ESC) SE Weight(-100%) [Motor]`
But here's the pitfall: Suppose you want the motor to come on slowly but turn off immediately. You would probably expect this to work:
Code:
`CH07 (ESC) SE Weight(-100%) Slow(u1.0:d0) [Motor]`
This looks like it would take one second to slowly increase the throttle to full power when SE is switched to SE↑, but immediately turn the motor off when SE is switched to SE↓. However, it works exactly the opposite way. The mix above causes the throttle to jump to full power immediately with SE↑ but slowly decrease to off over the course of one second with SE↓.

This is what works:
Code:
`CH07 (ESC) SE Weight(-100%) Slow(u0: d1.0) [Motor]`
The reason for this is that, contrary to data flow diagrams that were promised to be corrected over two months ago , the Delay and Slow functions are processed at the beginning of a mix, not at the end.
Latest blog entry: OpenTX: Circling the Square
Mar 15, 2017, 11:53 AM
Froggy RC Pilot
Quote:
 Originally Posted by Miami Mike [...]The reason for this is that, contrary to data flow diagrams that were promised to be corrected over two months ago , the Delay and Slow functions are processed at the beginning of a mix, not at the end.
Mike,

First, I didn't have time to work on my diagrams.
Second, your statement (slow parameter is at the beginning) is not trivial to represent in a meaningful diagram.
Here is a sample example:
Create a mix
Code:
`Thr ratio(+100%) Switch  SB- Slow(u2:d2)`
Move SB to position -
If you are moving the throttle stick quickly, you will see the mixe moving slowly up and down.
Leave the throttle at +100% or -100% and wait for the mix to reach its final position.
Then move SB to the position ↑ or ↓, the mixe will then move slowly to 0%.

Could you propose me a diagram that take in account all those parameters? This will help me to improve my diagrams.
Last edited by LapinFou; Mar 15, 2017 at 11:59 AM.
 Mar 15, 2017, 01:08 PM Healthy suntan is an oxymoron. Thread OP Yes, I tried your example and I see exactly what you mean. But to make matters even more complicated, try adding a "stair curve" to the mix: The mix now looks like this: Code: `CH01 (Test) [I1]Thr Weight(+100%) Switch(SB-) Curve(32) Slow(u2:d2) [Test]` When you move switch SB to center the output jumps in quick steps to the throttle position of +100% or -100%, with pauses between the steps, but when you move SB back to SB↑ or SB↓, the output moves smoothly but slowly back to 0%, just as in your example. I'll be glad to work with you in sorting all of this out and determining the correct order that steps are processed in a mix, but I'll have to think about this. Maybe we can find others who are willing to help us out. Latest blog entry: OpenTX: Circling the Square
 Mar 15, 2017, 02:46 PM Froggy RC Pilot More brains will be better on this one. I know Kilrah said several times "The slow should be used on source change and not on a mixer line that is enabled by the switch."
 Mar 15, 2017, 06:13 PM Healthy suntan is an oxymoron. Thread OP Try this with your example: Change the mix from ADD to REPLACE and then watch what happens when you move the switch. On the first try it might appear to work the same as when ADD is selected, but move the switch again. There shouldn't be any difference between ADD and REPLACE in the first (and only) mix line, but there is. Latest blog entry: OpenTX: Circling the Square
 Mar 16, 2017, 04:27 AM Froggy RC Pilot Those options (slow/delay) work by comparing the previous and the current position of the source. Then, with this delta of position , the slow transition will be applied. Using switches can generate some weird effect. Concerning the ADD/REPLACE, I don't have an explanation (need to think about it). FYI, did you notice in the diagram, that mixe output is a result of a stack. The 1st value in this stack is 0% (you can see it on the top-right of the mixes diagram). If your 1st mixe is a MULTIPLE (instead ADD/REPLACE), then the result will always be 0% (0% * x = 0%).
Mar 16, 2017, 07:33 AM
Healthy suntan is an oxymoron.
Quote:
 Originally Posted by LapinFou If your 1st mixe is a MULTIPLE (instead ADD/REPLACE), then the result will always be 0% (0% * x = 0%).
Yes I know, and it doesn't make a bit of sense. The multiplex setting of the first mix is always hidden, implying that the first mix in a line has no need for a multiplex setting because it's by default a starting value. That would make perfect sense if it actually worked that way, but it doesn't, and unfortunately Kilrah and his minions refuse to fix it.

But we still have to contend with the fact that ADD gives an inexplicably different result than REPLACE in your example, and we need to figure out what that implies about the order of processes in mixes.
Latest blog entry: OpenTX: Circling the Square
Mar 16, 2017, 10:50 AM
Healthy suntan is an oxymoron.
Quote:
 Originally Posted by LapinFou More brains will be better on this one. I know Kilrah said several times "The slow should be used on source change and not on a mixer line that is enabled by the switch."
I don't think it's just switches, I think flight modes are equally involved because I don't see any difference in behavior between a mix enabled by a switch and a mix enabled by a flight mode. I think when a switch is specified, its state is combined with the flight mode parameter through an AND function to determine if the mix is enabled. But if that's true, I still haven't yet determined where that AND function intercepts the mix.

Code:
```FM0 Default     ----
FM1 Test Mode   SA-```
Code:
```CH01 (Test)
[I1]Thr Weight(+100%) Flight mode(Test Mode) Switch(SB-) Slow(u2:d2) [Test]```
The mix is enabled when SA and SB are both centered.

### Images

Latest blog entry: OpenTX: Circling the Square
 Mar 17, 2017, 01:18 PM Froggy RC Pilot I think the trick is the slow parameter is applied by making the difference between the previous and the new position. The hidden 0% got somehow an impact (probably the root cause of the glitch). For now, I think I will edit my diagram and add a note to warn user.
 Mar 17, 2017, 02:06 PM Healthy suntan is an oxymoron. Thread OP Okay, that's a good idea. Meanwhile, if anyone else who's reading this has anything to contribute, you're certainly welcome to chip in. Latest blog entry: OpenTX: Circling the Square
Mar 23, 2017, 08:34 AM
Froggy RC Pilot
Quote:
 Originally Posted by Miami Mike Yes I know, and it doesn't make a bit of sense. The multiplex setting of the first mix is always hidden, implying that the first mix in a line has no need for a multiplex setting because it's by default a starting value. That would make perfect sense if it actually worked that way, but it doesn't, and unfortunately Kilrah and his minions refuse to fix it. But we still have to contend with the fact that ADD gives an inexplicably different result than REPLACE in your example, and we need to figure out what that implies about the order of processes in mixes.
Look likes you've been listen!
In the OTX2.2.RC14:
Quote:
 All radio : add visual sign when multiply used on first mix of a channel [#4525]
Mar 23, 2017, 03:25 PM
Healthy suntan is an oxymoron.
Yes, thanks for the heads-up! I see that, but they really should have made the multiplex setting of the first mix line irrelevant and just treated that mix as a starting value.

But I guess what they did is better than nothing.

I wonder how they managed to accomplish that on the Taranis screen when there's no room. Either they totally rearranged everything, or they really meant that they changed it in Companion but left it the same in the radio.

Since I'm not currently interested in installing 2.2 on either of my radios, I have no way of checking that for myself.

By the way, we've discovered that there's more involved than just the MULTIPLY setting. We've found here that ADD and REPLACE work differently, so there still may be an issue they haven't addressed, even to their own satisfaction.

### Images

Latest blog entry: OpenTX: Circling the Square
 Mar 26, 2017, 07:52 AM Healthy suntan is an oxymoron. Thread OP Here's how they fixed it, at least in Companion: Code: ```CH01 [I1]Rud Weight(+100%) <-- This mix is set to ADD. CH02 [I2]Ele Weight(+100%) <-- This mix is set to REPLACE. CH03 [I3]Thr MULT! <-- This mix is set to MULTIPLY.``` So there's a warning if a first mix is set to MULTIPLY but no warning if it's set to REPLACE. Latest blog entry: OpenTX: Circling the Square
Mar 26, 2017, 08:00 AM
Healthy suntan is an oxymoron.