6 Flight modes on a modded Devo7e with 2x3 Switche

More
11 Aug 2015 18:26 #36794 by AssassinsLament
This is what I want:

Channel 5
(APM 6 Modes)
HOLD0 + SW A0 = mode 1 (-100)
HOLD0 + SW A1 = mode 2 (-67)
HOLD0 + SW A2 = mode 3 (-33)
HOLD1 + SW A0 = mode 4 (0)
HOLD1 + SW A1 = mode 5 (33)
HOLD1 + SW A2 = mode 6 (67)

So HOLD0 seems to work fine:
[mixer]
src=HOLD0
dest=Ch5
switch=SW A0
scalar=-100
usetrim=0
curvetype=fixed
[mixer]
src=HOLD0
dest=Ch5
switch=SW A1
scalar=-67
usetrim=0
curvetype=fixed
[mixer]
src=HOLD0
dest=Ch5
switch=SW A2
scalar=-33
usetrim=0
curvetype=fixed

But then when I try to do HOLD1 similarly, it doesn't work:
[mixer]
src=HOLD1
dest=Ch5
switch=SW A0
scalar=0
usetrim=0
curvetype=fixed
[mixer]
src=HOLD1
dest=Ch5
switch=SW A1
scalar=33
usetrim=0
curvetype=fixed
[mixer]
src=HOLD1
dest=Ch5
switch=SW A2
scalar=67
usetrim=0
curvetype=fixed

Any help would be much appreciated, thanks!

Please Log in or Create an account to join the conversation.

More
11 Aug 2015 18:49 #36795 by FDR
You were very close: on the 4th page make a fixed curve with values of +100, set the switch to HOLD1, and change the mux type to "add", and you are ready.

Please Log in or Create an account to join the conversation.

More
11 Aug 2015 19:22 #36797 by AssassinsLament
Replied by AssassinsLament on topic 6 Flight modes on a modded Devo7e with 2x3 Switche
Thank you for your reply! I just tried your suggestion and now on Channel monitor, some how HOLD0+A1 = 33, and HOLD0+A2 = 67. They should be -67 and -33 respectively. If I take all of the HOLD1 pages out, the values are correct. HOLD0+A1 and HOLD0+A2 are correct. What am I doing wrong?

Thanks in advance!

Please Log in or Create an account to join the conversation.

More
11 Aug 2015 19:42 #36798 by FDR
There should be only one page with the HOLD1 switch!
(The page sources deosn't matter, because you use the fixed function...)

Please Log in or Create an account to join the conversation.

More
11 Aug 2015 19:49 #36799 by AssassinsLament
Replied by AssassinsLament on topic 6 Flight modes on a modded Devo7e with 2x3 Switche
Yes, there is only one instance of a HOLD1 switch.

Here is how it looks currently:
[channel5]
template=complex
[mixer]
src=HOLD0
dest=Ch5
switch=SW A0
scalar=-100
usetrim=0
curvetype=fixed
[mixer]
src=HOLD0
dest=Ch5
switch=SW A1
scalar=-67
usetrim=0
curvetype=fixed
[mixer]
src=HOLD0
dest=Ch5
switch=SW A2
scalar=-33
usetrim=0
curvetype=fixed
[mixer]
src=HOLD1
dest=Ch5
switch=HOLD1
scalar=100
usetrim=0
muxtype=add
curvetype=fixed
[mixer]
src=HOLD1
dest=Ch5
switch=SW A1
scalar=33
usetrim=0
curvetype=fixed
[mixer]
src=HOLD1
dest=Ch5
switch=SW A2
scalar=67
usetrim=0
curvetype=fixed

All the values are correct for each combination, except for HOLD0+A1 and HOLD0+A2

Please Log in or Create an account to join the conversation.

More
11 Aug 2015 19:54 #36800 by FDR
You don't need the last two pages either, only the first four, with the HOLD1 switch as the last page.

Please Log in or Create an account to join the conversation.

More
11 Aug 2015 19:56 #36801 by AssassinsLament
Replied by AssassinsLament on topic 6 Flight modes on a modded Devo7e with 2x3 Switche
That did it! Thank you so much! Was racking my head for 3 days! So happy! Thanks again!!

Please Log in or Create an account to join the conversation.

More
11 Aug 2015 20:27 #36806 by mwm
I misread this, and came up with the following mix. It doesn't do zero, but instead has -33, -67 & -100 on HOLD0. Note that there's nothing wrong with FDR's solution, I just thought I saw a neat application of the MULT mixer type, and then my 8-bit assembly hacking habits kicked in to want to shrink it by a mixer. Figured I'd post it since I got it to work.

[channel5]
template=complex
[mixer]
src=HOLD1
dest=Ch5
usetrim=0
[mixer]
src=AIL
dest=Ch5
switch=SW A1
scalar=67
usetrim=0
muxtype=multiply
curvetype=fixed
[mixer]
src=FMODE0
dest=Ch5
switch=SW A2
scalar=33
usetrim=0
muxtype=multiply
curvetype=fixed

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
11 Aug 2015 20:33 #36808 by AssassinsLament
Replied by AssassinsLament on topic 6 Flight modes on a modded Devo7e with 2x3 Switche
Thanks, it will be surely help me learn more about model coding.

Please Log in or Create an account to join the conversation.

More
12 Aug 2015 06:48 #36819 by Richard96816
Replied by Richard96816 on topic 6 Flight modes on a modded Devo7e with 2x3 Switche
How would you achieve six flight modes with successive button presses?

Please Log in or Create an account to join the conversation.

More
13 Aug 2015 09:03 #36837 by mwm
Well, as loose as your requirements are, six flight modes with successive button presses is just a trim switch with a step size of 33 or so. That cycles up and down through the values on two different buttons. Getting one that cycles is more interesting.

I've added a section to the tutorial on setting up four, five and six flight modes. It uses my Mult method, but mentions the Add method described here first. It's not clear who created that, so there's no credit beyond the one to the community at the beginning of the paper. If either of you objects to this, let me know and I'll delete that paragraph.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 00:13 #37112 by AssassinsLament
Replied by AssassinsLament on topic 6 Flight modes on a modded Devo7e with 2x3 Switche

mwm wrote: If either of you objects to this, let me know and I'll delete that paragraph.


No problem from me! Thanks for your tutorial!

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 02:13 #37119 by AssassinsLament
Replied by AssassinsLament on topic 6 Flight modes on a modded Devo7e with 2x3 Switche
Alright, I have a new feature I wanted to add, and I can't seem to figure out how to do it. I didn't want to start a new thread so I'll post it here, but if that's not appropriate then disregard this.

mwm or FDR,

In mwm's tutorial, I see that you used the EXT button as a momentary button... What I wanted to do was add the Trim Save and Autotune commands to channels 7 and 8 respectively. I wanted to use the left trim horizontal for the Trim save and the left vertical trim for the Autotune, and I only want those commands detected while holding down EXT at the same time. So for instance... hitting left horizontal trim does it's normal trim stuff, but if I were to hold down EXT and then hit left horizontal trim +, it would turn on Trim Save... and hopefully not add onto the horizontal trim at the same time.

I can get those trims to work fine without the EXT being held down, but that's not the best because if I really wanted to trim the quad, I'd also be turning on some of those commands... like autotune.

Thanks for any help!

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 02:22 #37120 by mwm
IIUC, what you need to do is 1) Set up virtual trims using the trim buttons as described. I don't know what you want to see on 7 & 8, but assuming the FC watches for a transition to high on those channels, you'll want them to be momentary buttons. There's no problem using the same trim buttons in multiple virtual switches. I do that with video on the V2x2 protocol. One is momentary, one is a toggle, and the toggle controls an Icon so I can see if video is being recorded or not.

Anyway, set up three momentary virtual switches on your two trim switches (note each trim is TWO switches in this case, with up and down being different switches). Then on channels 7 & 8, the first mixer is a fixed curve that outputs the value for "don't do anything". The second mixer outputs the value of your trim switch, so pushing it will trigger the feature you want. This mixer is enabled by the EXT button virtual channel, so it will only happen if you are holding down the EXT button.

Let me know if you have problems with this, and I'll see about setting it up. Bit I've got a full weekend coming up, so it won't happen soon.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 02:28 #37121 by AssassinsLament
Replied by AssassinsLament on topic 6 Flight modes on a modded Devo7e with 2x3 Switche
Awesome, thanks for the quick reply. I will try that out... I am pretty new to this, but I have programming/coding experience so we'll see what I can figure out from your idea. I will update when I've given up or accomplished it, lol.

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 05:23 - 22 Aug 2015 05:42 #37126 by AssassinsLament
Replied by AssassinsLament on topic 6 Flight modes on a modded Devo7e with 2x3 Switche
Ok, I've tried all I could and I just can't figure it out.

Here is my relevant code:
[channel7]
template=complex
[mixer]
src=Virt2
dest=Ch7
scalar=-100
usetrim=0
curvetype=min/max
[mixer]
src=Virt2
dest=Ch7
scalar=100
usetrim=0
curvetype=min/max

[channel8]
template=complex
[mixer]
src=Virt3
dest=Ch8
scalar=-100
usetrim=0
curvetype=min/max
[mixer]
src=Virt3
dest=Ch8
scalar=100
usetrim=0
curvetype=min/max

[virtchan2]
template=complex
[mixer]
src=Virt2
dest=Virt2
scalar=0
[virtchan3]
template=complex
[mixer]
src=Virt3
dest=Virt3
scalar=0

[trim5]
src=Virt2
pos=TRIMLH-
neg=TRIMLH+
step=191
value=-100,0,0
[trim6]
src=Virt3
pos=TRIMLV+
neg=TRIMLV-
step=191
value=-100,0,0

So right now, as the code sits above, max signal is sent to each channel when a trim+ is pushed (respectively) and min signal is sent when a trim- is pushed. Now I tried to attack this two ways...

1) Depending upon FMODE being 0 or 1 (I have my retractable landing gear on FMODE; 0 landing gear up, 1 landing gear down) I want to disable one command or the other. For instance, a Trim Save command should be sent only when throttle is at 0, so the landing gear should be down at that point, so Trim Save (Channel 7) should only work when FMODE0, and Autotune needs to be done in the air, so the landing gear would be up. Anyways, that was my basic idea...

2) But how I really want it, is to use the EXT button in combination with a trim+ or trim-, sends the command. Save Trim command can be a momentary button (it just saves the trim settings when pushed), but Autotune has to be an on/off button (it runs a leveling command and can be/has to be turned off).

I'm having issues adding switches so that the trims only send through channels 7 and 8, when the trims are pressed with EXT... or the basic idea, when pressed with FMODE0 or FMODE1.
Last edit: 22 Aug 2015 05:42 by AssassinsLament.

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 10:10 #37133 by mwm
You need to add another virtual channel for the EXT button if you want to use it.

The first mixer on channels 7 & 8 needs to have a curve type of fixed, not Min/Max.

The second mixer on those two channels needs to have a Switch setting of the virtual channel used for the EXT button or the appropriate FMODE values.

Note that this makes both channels act like momentary buttons, where both buttons have to be held down for it to go on. If you make the AutoTune trim switch a toggle, then that will work as a toggle - while you hold down the EXT button. But releasing the EXT button will shut it off, and then pressing it again without toggling the trim switch will turn it back on. That doesn't sound good to me, but may be what you want. But before trying to figure out how to get different behavior, I'd like a more complete description of what you want. Maybe truth table, showing current value of channel 7, a button change, the state of the other button, and the desired state of channel 7?

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 13:18 #37136 by AssassinsLament
Replied by AssassinsLament on topic 6 Flight modes on a modded Devo7e with 2x3 Switche

mwm wrote: You need to add another virtual channel for the EXT button if you want to use it.

The first mixer on channels 7 & 8 needs to have a curve type of fixed, not Min/Max.

The second mixer on those two channels needs to have a Switch setting of the virtual channel used for the EXT button or the appropriate FMODE values.

Note that this makes both channels act like momentary buttons, where both buttons have to be held down for it to go on. If you make the AutoTune trim switch a toggle, then that will work as a toggle - while you hold down the EXT button. But releasing the EXT button will shut it off, and then pressing it again without toggling the trim switch will turn it back on. That doesn't sound good to me, but may be what you want. But before trying to figure out how to get different behavior, I'd like a more complete description of what you want. Maybe truth table, showing current value of channel 7, a button change, the state of the other button, and the desired state of channel 7?


Thanks for the reply! Ok, I guess my confusion is how to add a virtual channel used for the EXT button. My assumption was that I could only get to use it if I attached it to a trim first? Or can I use it like a normal channel or virtual channel?

Also I want the Autotune switch to stay on even after releasing the EXT... and only to be able to turn it off by hitting EXT and a negative trim. I don't want it to turn off after I have released the buttons. Hmm... so maybe instead of a switch, have two momentary buttons?

EXT x TRIMLH+ = Autotune On
EXT x TRIMLH- = Autotune Off

As for Trimsave, just a simple EXT x TRIMLV+ = saves trim selection.

The reason I used min/max is because it gave me the best results in terms of sending the signal to MP. Using a fixed curve, it would sometimes make the channel go up to 2k+ and sometimes go to half, and thus not hit the required 1.8k to set off the commands. I'm probably not doing it right on the fixed curve but I couldn't find a way to get the signal/output to the correct strength. Using the min/max, I was able to get 1901 on the max and around like 500 on the min, which worked great.

Sorry if I'm confusing you. I really appreciate the time you're taking.

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 13:33 #37139 by AssassinsLament
Replied by AssassinsLament on topic 6 Flight modes on a modded Devo7e with 2x3 Switche
[channel7]
template=complex
[mixer]
src=Virt2
dest=Ch7
scalar=-100
usetrim=0
curvetype=fixed
[mixer]
src=Virt2
dest=Ch7
scalar=100
usetrim=0
curvetype=fixed
switch=Virt4

[virtchan2]
template=complex
[mixer]
src=Virt2
dest=Virt2
scalar=0

[virtchan4]
template=complex
[mixer]
src=Virt4
dest=Virt4
scalar=0

[trim7]
src=Virt4
pos=Exit
step=193
value=100,0,0

^this was my actual code last night but it wouldn't work right, plus the starting signal (a low signal that doesn't trigger the command) was too high.

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 13:34 #37140 by mwm
Yes, you have to set up a trim using the EXT button, and then point that at a virtual channel, just like you do with regular trim buttons. That's how you make it a momentary button.

The min/max curve is the right curve to use if you want to change the value with the button, but for the first mixer, you don't want to change the value, you want it to be fixed at "off". Are you sure you're using a Fixed curve, and not 1-1? With a fixed curve, the source will be ignored and the value won't change.. The second mixer will source one virtual channel that is acting as a momentary button, enabled by the second virtual channel acting as a momentary button. If the Switch virtual channel is off, the value of the first mixer is used, so it's off. If the Switch virtual channel is on (meaning you're holding down that button), then the value of Src virtual channel is used, and here's where you want the Min/Max curve. In this case, it will be off unless the Src button is also being held down. In other words, it's effectively the and of the two momentary buttons.

I think you can do the two button version, but it's going to take another trim. You want to set up three mixers. The first will source the channel the mix is on with a min/max curve. This will cause the default value to be it's current value. You then have two mixers that use the virtual channels that are momentary based on the TRIMLH buttons,and the Src for both of those is a virtual channel using EXT as a momentary button, the one that turns it off being inverted. So, if you aren't holding a TRIMLH button, the old value is used.. If you are, then the second or third mixer is enabled, and it will output the value of EXT, inverted in the one that turns things off. I haven't actually tried this. I don't really have time to work on it rather than explain it during breaks. Now back to work...

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum