including custom-switch support in Deviation

More
20 Jan 2014 15:10 #18775 by PhracturedBlue
Replied by PhracturedBlue on topic including custom-switch support in Devo 8s
robca:
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.
Attachments:

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

More
20 Jan 2014 18:45 #18788 by PhracturedBlue
Replied by PhracturedBlue on topic including custom-switch support in Devo 8s
I have found a solution that enables run-time configuration of the switches with minimal additional code. I need to do some testing of it, But it seems to work ok for my 3x2 setup.

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.

More
20 Jan 2014 20:02 #18798 by HappyHarry
Replied by HappyHarry on topic including custom-switch support in Devo 8s
great news :D, I currently don't have my second 3way switch wired up so I can test the 1 x 3way for now. can I ask you to also add in the code from the 1x3way patch that enables st2 for the 7e? I'll try to look at it myself this evening but I'd rather someone who knows 100% what he's doing look at it lol

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

More
20 Jan 2014 23:23 #18808 by PhracturedBlue
Replied by PhracturedBlue on topic including custom-switch support in Devo 8s
what is st2?

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

More
21 Jan 2014 00:06 - 21 Jan 2014 00:11 #18810 by HappyHarry
Replied by HappyHarry on topic including custom-switch support in Devo 8s
pitch and throttle curves for stunt mode 2

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* :o
Last edit: 21 Jan 2014 00:11 by HappyHarry.

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

More
21 Jan 2014 04:25 - 21 Jan 2014 04:28 #18818 by PhracturedBlue
Replied by PhracturedBlue on topic including custom-switch support in Devo 8s
Ok, I've committed the code. there are several changes:
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.
Last edit: 21 Jan 2014 04:28 by PhracturedBlue.

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

More
21 Jan 2014 09:36 #18825 by HappyHarry
Replied by HappyHarry on topic including custom-switch support in Devo 8s
I'll build and try it out later today in the 1x3way configuration, apart from switch functionality and the relevant spin boxes is there anything else you'd like tested?

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

More
21 Jan 2014 14:06 #18834 by HappyHarry
Replied by HappyHarry on topic including custom-switch support in Devo 8s
i just built the new code which includes the new switch code, also with telem, perm timer and layout editor enabled using gcc 4.8 and it came in at

ROM: 0x08003000 - 0x0801fe60 = 115.59kB
RAM: 0x20000000 - 0x2000245c = 9.09kB

which is great work considering all the recent additions 8)

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.

More
21 Jan 2014 15:34 - 21 Jan 2014 16:09 #18837 by HappyHarry
Replied by HappyHarry on topic including custom-switch support in Devo 8s
ok in 3x1 mode i can enable the A switch, set it as my flight mode switch which enables the extra curve menu's, and i can set it for my rates, i can set toggle icons for the three positions also, but the toggle icons don't show on the screen, and the switch position changes aren't registered as my rates don't change, my throttle and pitch curves don't change, also no input for the switch is shown on the channel monitor
Last edit: 21 Jan 2014 16:09 by HappyHarry.

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

More
21 Jan 2014 18:48 #18859 by HappyHarry
Replied by HappyHarry on topic including custom-switch support in Devo 8s
has anyone else tried this?

pb is your A switch looking at the same pins that the 1 x 3way patch uses? as in these here >>

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

More
21 Jan 2014 19:48 - 21 Jan 2014 21:18 #18862 by PhracturedBlue
Replied by PhracturedBlue on topic including custom-switch support in Devo 8s
It is using B.6/C.6 and B.8/C.6 which are the only places you can connect to on the grid.

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.
Last edit: 21 Jan 2014 21:18 by PhracturedBlue.

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

More
21 Jan 2014 20:53 #18866 by HappyHarry
Replied by HappyHarry on topic including custom-switch support in Devo 8s
pb it doesn't build with those changes, is there something else i need to change?
+ 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.

More
21 Jan 2014 20:56 #18868 by HappyHarry
Replied by HappyHarry on topic including custom-switch support in Devo 8s
it's ok i worked it out, there was a close bracket missing

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

More
21 Jan 2014 21:32 - 21 Jan 2014 21:36 #18871 by HappyHarry
Replied by HappyHarry on topic including custom-switch support in Devo 8s
pb this change hasn't made any difference, i think i may see what might be wrong, if you have set the code to use galee's wiring scheme it uses these connections





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?
Attachments:
Last edit: 21 Jan 2014 21:36 by HappyHarry.

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

More
21 Jan 2014 23:20 #18882 by PhracturedBlue
Replied by PhracturedBlue on topic including custom-switch support in Devo 8s
why do you have diodes on your switch? The 3x1 should not require that (and it likely explains why the code doesn't work, though not why the patch you were using does).

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.

More
21 Jan 2014 23:57 - 21 Jan 2014 23:59 #18887 by blackmoon
Replied by blackmoon on topic including custom-switch support in Deviation
The why is because in the original thread by cmpang the 2x2way had one diode per switch. www.deviationtx.com/forum/how-to/1436-ad...imitstart=0&start=40

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 ?
Last edit: 21 Jan 2014 23:59 by blackmoon.

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

More
21 Jan 2014 23:59 #18888 by PhracturedBlue
Replied by PhracturedBlue on topic including custom-switch support in Devo 8s
I see it in cmpang's 2x2 tutorial, so I guess that is why it is there. I have no idea why he put it there though. The diode shouldn't be needed on the 3x1 or 2x2 mod. Funnily enough, looking at cmpang's post, I see I provided the patch that enables it with the diode too...go figure.

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.

More
22 Jan 2014 00:53 #18891 by PhracturedBlue
Replied by PhracturedBlue on topic including custom-switch support in Devo 8s
Ok, I just checked in new code that will hopefully get your switches working.

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
(also allowed are 3x2 and 2x2)

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

More
22 Jan 2014 07:34 #18903 by IMback!
Replied by IMback! on topic including custom-switch support in Deviation
i think the diodes are needed how else would you read the buttons while a switch is pressed?

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

More
22 Jan 2014 07:50 #18904 by SeByDocKy
Replied by SeByDocKy on topic including custom-switch support in Deviation
Sorry to ask another noob question but I am getting lost with your nomenclature. What does it mean 2x2,1x3 or 2x3 ?. In my first though, for example the 2x3, was when you add two 3 states switch.... But now I am comfused when reading the thread... I want to add these two 3-states switches and I don't know which directives to follow ...

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

Time to create page: 0.120 seconds
Powered by Kunena Forum