- Posts: 4402
including custom-switch support in Deviation
- PhracturedBlue
- Topic Author
- Offline
here is the patch I use. You will likely either need to use gcc 4.8 to build (or you can disable the standard mixer) as code space is pretty tight right now.
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Topic Author
- Offline
- Posts: 4402
Note that no more than 2 switches can be supported.
That means you choose either the 2x2 3x1 or 3x2 solution and wire your Tx accordingly. You cannot have both the 2x2 and 3x2 modifications simultaneously.
I cannot test the 2x2 or 3x1 solutions, so after I check in the code, I'll ask for testers for it.
Please Log in or Create an account to join the conversation.
- HappyHarry
- Offline
- Posts: 1136
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Topic Author
- Offline
- Posts: 4402
Please Log in or Create an account to join the conversation.
- HappyHarry
- Offline
- Posts: 1136
stock deviation for the 7e provides pitch and throttle curves for normal and st1, but the 1 x 3 way patch adds changes to provide the extra curves for st2
sorry i keep forgetting deviation calls it fmode* not st*
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Topic Author
- Offline
- Posts: 4402
1) The new switches will come in as 'SW A' and 'SW B'. Existing switches will not be modified. This is different from any patches floating around
2) I've removed the usb page from the menu. I needed the extra space, and I think the page is redundant with booting with ENT.
3) to enable, in tx.ini near the top (before [modules]), set:
switch_cfg=3x1
switch_cfg=2x2
switch_cfg=3x2
I have only lightly tested it, and there were a lot of changes to shrink the code enough to fit on the devo7e (I'm not using gcc 4.8 yet, and wanted to keep the code under budget). It hasn't been tested at all with the 3x1 or 2x2 settings
Edit: I should note this is really experimental. I had to change all places where there is a spinbox dealing with channels, and it is quite possible they don't all work properly.
Please Log in or Create an account to join the conversation.
- HappyHarry
- Offline
- Posts: 1136
Please Log in or Create an account to join the conversation.
- HappyHarry
- Offline
- Posts: 1136
ROM: 0x08003000 - 0x0801fe60 = 115.59kB
RAM: 0x20000000 - 0x2000245c = 9.09kB
which is great work considering all the recent additions
i've attached the build here for people to test, this is for the 7e and as PB said is purely for testing purposes just now
Please Log in or Create an account to join the conversation.
- HappyHarry
- Offline
- Posts: 1136
Please Log in or Create an account to join the conversation.
- HappyHarry
- Offline
- Posts: 1136
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Topic Author
- Offline
- Posts: 4402
But I see a bug in the code that means it isn't working properly.
in target/devo7e/tx_buttons.c, change:
} else if (Transmitter.ignore_src == SWITCH_3x1) {
int sw = result & (1 << BUT_LAST) ? 0x01 : 0x00;
if (result & (1 << (BUT_LAST+1)))
sw |= 0x02;
global_extra_switches = sw;
}
to
} else if (Transmitter.ignore_src == SWITCH_3x1) {
int sw = result & (1 << (BUT_LAST-1)) ? 0x01 : 0x00;
if (result & (1 << (BUT_LAST)))
sw |= 0x02;
global_extra_switches = sw;
}
If that doesn't work, I'll give you a debug build that will just scan the buttons and print out on screen their state, which should help pinpointthe issue.
Please Log in or Create an account to join the conversation.
- HappyHarry
- Offline
- Posts: 1136
+ Compiling 'target/devo7e/tx_buttons.c'
target/devo7e/tx_buttons.c: In function 'ScanButtons':
target/devo7e/tx_buttons.c:98:60: error: expected ')' before ';' token
int sw = result & (1 << (BUT_LAST-1) ? 0x01 : 0x00;
^
target/devo7e/tx_buttons.c:102:5: error: expected ',' or ';' before '}' token
}
^
target/devo7e/tx_buttons.c:98:13: warning: unused variable 'sw' [-Wunused-variable]
int sw = result & (1 << (BUT_LAST-1) ? 0x01 : 0x00;
^
target/devo7e/tx_buttons.c:104:1: error: expected declaration or statement at end of input
}
^
target/devo7e/tx_buttons.c:104:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make: *** [objs/devo7e/tx_buttons.o] Error 1
Please Log in or Create an account to join the conversation.
- HappyHarry
- Offline
- Posts: 1136
Please Log in or Create an account to join the conversation.
- HappyHarry
- Offline
- Posts: 1136
where mine is wired for the 1 x 3way like this
if you look the two wires that go to the outer contact points my single 3 way switch, they are split one to each of the 3 way switches in galee's style of wiring. would that make a difference?
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Topic Author
- Offline
- Posts: 4402
the only case you need diodes should be for the 3x2 switch. the 2x2 and 3x1 should not need a diode.
The code I've checked in uses different scanning mechanisms for the 2x2, 3x1, and 3x2. So the wiring for the 3x2 is irrelevant when discussing the 3x1. the 3x1 code should match the original patch, however, it does assume there are no diodes on the switch.
I can make it work with the diode mod you have too, but I have no idea why it is there.
Please Log in or Create an account to join the conversation.
- blackmoon
- Offline
- Posts: 402
On the same thread Kaworu patch for the 1x3way had to have the switch wired like the 2x2way only the center would be the same : www.deviationtx.com/forum/how-to/1436-ad...vo-7e?start=40#11635
So we all assumed that the 1x3way would have two diodes, and the patch effectively works with that wiring (tough I didn't test it thoroughly).
So now if one goes 1x3 or 2x2 it should not have diodes and the wiring stays the same as per the posts I linked to ?
And only the 2x3 needs diodes, and wired per the pictures (from galee) posted above ?
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Topic Author
- Offline
- Posts: 4402
I'll provide an update that should work regardless of if the diode is there or not for the 2x2 and 3x1. For the 3x2 it is definitely needed
Please Log in or Create an account to join the conversation.
- PhracturedBlue
- Topic Author
- Offline
- Posts: 4402
Note. there is a big change here.
I have created a new file 'hardware.ini' that contains all of the hardware modifications. the transmitter will not overwrite this file.
You need to move the switch settings and module settings to this file, otherwise they will not work.
There is an example version included, but also note that I changed the name of the switch parameter.
The parameter is now:
extra_switches=3x1
Please Log in or Create an account to join the conversation.
- IMback!
- Offline
- Posts: 84
Please Log in or Create an account to join the conversation.
- SeByDocKy
- Offline
- Posts: 1016
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Development
- including custom-switch support in Deviation