Add two switches to the Devo 7e

More
14 Feb 2013 16:33 - 14 Feb 2013 16:37 #6379 by cmpang
Add two switches to the Devo 7e was created by cmpang
The other day while reading the "Devo 7e Hardware Connections" to the part of the Button Matrix, to my amazement I found two unused buttons left over in the originl design.

www.deviationtx.com/articles/18-devo-7e-hardware-connections

Since the 7e is coming short of switches (that limits 7e to being a plain 6 Channels Tx, or even worse a 4 Channels Tx only if both the existing switches are assigned as "Hold" , "FMOD", "D/R"), I think it would be nice if we can make use of the two left over button matrix.

After some discussion with PB and with his kind help (he always is, isn't he?) and a bit of very easy hardware mod, the upgrade work is done and now we have a plain 8 Channel 7e Tx.

The mod goes on like this:

1. Open the Tx case, take out the four screws that hold the main PCB






2. Flip the PCB over and we can see the buttons and the wire connectors. Carefully identify the spots as shown in the photo and solder three wires perferably of different colors say Red, Yellow and Orange.







3. The schematic diagram :





4. On the Tx front cover, drill out two holes to the size of the switches you are going to use and put the switches on. Left is "Elevator D/R" and right is "Aileron D/R).





5. Connect the other end of the Red wires (you have to make a parallel connection) to the middle (toung) of both switches.





6. Solder a diode to the top contact of both switches. Pay attention to the direction of the diodes. Different doide types have different appearance. The one I am using is a low voltage rectifier 1N4001 but whatever diode type should also works. The point is to make sure current is flowing from the Yelow/Orange to the Red wire.






That's all for the hardware mod. Of course you have to upgrade to the latest fw in order for the switches to work. The one I am using now is:

www.deviationtx.com/media/kunena/attachm...ang_2013-02-12-3.zip

Thanks again to PB's patience and hardwork to make it a reality...
Last edit: 14 Feb 2013 16:37 by cmpang.

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

More
14 Feb 2013 21:08 - 14 Feb 2013 21:11 #6385 by Mullson
Replied by Mullson on topic Add two switches to the Devo 7e
Thank you!
Really nice walkthrough.
Last edit: 14 Feb 2013 21:11 by Mullson.

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

More
15 Feb 2013 05:08 #6394 by PhracturedBlue
Replied by PhracturedBlue on topic Add two switches to the Devo 7e
Here is the code patch to enable the new switches. I recommend learning to build and patch deviation, since I will not be supplying builds with this capability until we have virtual-switch capability or some other scalable solution to manage such optional capabiities.
diff -r ab395d806bed src/target/devo7e/capabilities.h
--- a/src/target/devo7e/capabilities.h	Thu Feb 14 20:58:25 2013 -0800
+++ b/src/target/devo7e/capabilities.h	Thu Feb 14 21:06:31 2013 -0800
@@ -7,15 +7,19 @@
   CHANDEF(HOLD1)
   CHANDEF(FMOD0)
   CHANDEF(FMOD1)
+  CHANDEF(AIL_DR0)
+  CHANDEF(AIL_DR1)
+  CHANDEF(ELE_DR0)
+  CHANDEF(ELE_DR1)
 #endif
 
 #ifdef UNDEF_INP
 #define INP_RUD_DR0 INP_HOLD0
 #define INP_RUD_DR1 INP_HOLD1
-#define INP_ELE_DR0 INP_HOLD0
-#define INP_ELE_DR1 INP_HOLD1
-#define INP_AIL_DR0 INP_HOLD0
-#define INP_AIL_DR1 INP_HOLD1
+//#define INP_ELE_DR0 INP_HOLD0
+//#define INP_ELE_DR1 INP_HOLD1
+//#define INP_AIL_DR0 INP_HOLD0
+//#define INP_AIL_DR1 INP_HOLD1
 #define INP_FMOD2  INP_FMOD1
 #define INP_MIX0   INP_FMOD0
 #define INP_MIX1   INP_FMOD1
diff -r ab395d806bed src/target/devo7e/channels.c
--- a/src/target/devo7e/channels.c	Thu Feb 14 20:58:25 2013 -0800
+++ b/src/target/devo7e/channels.c	Thu Feb 14 21:06:31 2013 -0800
@@ -40,6 +40,7 @@
     gpio_set(GPIOC, GPIO10 | GPIO11);
 }
 
+extern u32 glbl_buttons;
 s32 CHAN_ReadRawInput(int channel)
 {
     s32 value = 0;
@@ -52,6 +53,12 @@
     case INP_HOLD1:    value = ! gpio_get(GPIOC, GPIO11); break;
     case INP_FMOD0:    value = gpio_get(GPIOC, GPIO10); break;
     case INP_FMOD1:    value = ! gpio_get(GPIOC, GPIO10); break;
+
+    case INP_AIL_DR0:  value = !(glbl_buttons & (1 << 31)); break;
+    case INP_AIL_DR1:  value = !!(glbl_buttons & (1 << 31)); break;
+    
+    case INP_ELE_DR0:  value = !(glbl_buttons & (1 << 30)); break;
+    case INP_ELE_DR1:  value = !!(glbl_buttons & (1 << 30)); break;
     }
     return value;
 }
diff -r ab395d806bed src/target/devo7e/tx_buttons.c
--- a/src/target/devo7e/tx_buttons.c	Thu Feb 14 20:58:25 2013 -0800
+++ b/src/target/devo7e/tx_buttons.c	Thu Feb 14 21:06:31 2013 -0800
@@ -20,9 +20,9 @@
 static const u16 rows[] = {GPIO6, GPIO7, GPIO8, GPIO9, 0xffff};
 static const u8 buttonmap[] = {
     BUT_TRIM_RH_POS, BUT_TRIM_RH_NEG, BUT_TRIM_RV_POS, BUT_TRIM_RV_NEG,
-    BUT_LAST,        BUT_ENTER,       BUT_RIGHT,       BUT_LEFT,
+    32,              BUT_ENTER,       BUT_RIGHT,       BUT_LEFT,
     BUT_TRIM_LV_POS, BUT_TRIM_LV_NEG, BUT_TRIM_LH_NEG, BUT_TRIM_LH_POS,
-    BUT_LAST,        BUT_DOWN,        BUT_UP,          BUT_EXIT,
+    31,              BUT_DOWN,        BUT_UP,          BUT_EXIT,
     };
 
 #define COL_PORT GPIOB
@@ -46,30 +46,33 @@
   gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
                 GPIO_CNF_OUTPUT_PUSHPULL, GPIO5 | GPIO6 | GPIO7 | GPIO8);
 
-  gpio_set(GPIOB, GPIO5 | GPIO6| GPIO7 | GPIO8);
+  gpio_clear(GPIOB, GPIO5 | GPIO6| GPIO7 | GPIO8);
 
   /* PortC 6-9 are pull-up inputs */
   gpio_set_mode(GPIOC, GPIO_MODE_INPUT,
                 GPIO_CNF_INPUT_PULL_UPDOWN, GPIO6 | GPIO7 | GPIO8 | GPIO9);
-  gpio_set(GPIOC, GPIO6 | GPIO7 | GPIO8 | GPIO9);
+  gpio_clear(GPIOC, GPIO6 | GPIO7 | GPIO8 | GPIO9);
 }
 
+u32 glbl_buttons = 0;
 u32 ScanButtons()
 {
     u8 idx = 0;
     u32 result = 0;
     const u16 *c, *r;
-    gpio_set(COL_PORT, COL_PORT_MASK);
+    gpio_clear(COL_PORT, COL_PORT_MASK);
     for(c = columns; *c != 0xffff; c++) {
+        gpio_set(COL_PORT, *c);
+        u16 but = gpio_port_read(ROW_PORT);
         gpio_clear(COL_PORT, *c);
-        u16 but = gpio_port_read(ROW_PORT);
-        gpio_set(COL_PORT, *c);
         for(r = rows; *r != 0xffff; r++) {
-            if(! (but & *r)) {
+            if((but & *r)) {
                 result |= 1 << (buttonmap[idx] - 1);
             }
             idx++;
         }
     }
-    return result;
+    if (! (result & 0x3FFFFFFF))
+        glbl_buttons = result;
+    return result & 0x3FFFFFFF;
 }
In linux you would normally copy that to a 'file.patch' then from the deviation dir, run:
patch -p1 < file.patch

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

More
15 Feb 2013 06:18 #6396 by cmpang
Replied by cmpang on topic Add two switches to the Devo 7e
Is there a "How-To" to learn to build the fw?

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

More
15 Feb 2013 11:59 - 15 Feb 2013 13:28 #6401 by RandMental
Replied by RandMental on topic Add two switches to the Devo 7e
Have a look at BitBucket whre the code repositories are hosted, PB has full information there on how to setup the environment for both Linux and Windows:
bitbucket.org/PhracturedBlue/deviation

If you develop on Windows, this can also help:
www.deviationtx.com/articles/7-development-on-windows

and Using Eclipse:
www.deviationtx.com/articles/15-using-eclipse-with-deviation
Last edit: 15 Feb 2013 13:28 by RandMental.

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

More
15 Feb 2013 13:43 #6403 by PhracturedBlue
Replied by PhracturedBlue on topic Add two switches to the Devo 7e
There are also theses:
www.deviationtx.com/forum/how-to/1200-vm...-compiling-deviation

www.deviationtx.com/forum/7-development/...tx-build-environment

The folks who put those together will likely be happyto help you if you choose one of those paths.

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

More
15 Feb 2013 14:01 #6405 by harmony96
Replied by harmony96 on topic Add two switches to the Devo 7e
Nice work!

Where can I buy the toggle switch that fits with 7e?

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

More
19 Feb 2013 20:06 #6593 by Mullson
Replied by Mullson on topic Add two switches to the Devo 7e
Can you map for example ch7 "Gyro" to ELE DR0 50% and ELE DR1 90% now? ELE DR being one of the switches.
Or do you have to mod the code in some way? If so how?

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

More
20 Feb 2013 02:15 - 20 Feb 2013 02:15 #6601 by cmpang
Replied by cmpang on topic Add two switches to the Devo 7e
yes you can. Go into the Mixer page, scroll down to CH7, choose Simple, Src = ELE DR and select 3 point curve. Input whatever value you want in points 1 and 3.

Go back to the Transmitter menu, Channel Monitor to double check the function.

There is one shortcoming in this version of 7e that while setting the parameters in the Mixer page, the curve can no longer be displayed. That is, no graphical display while keying in the value of points 1 and 3 in the example above.

Even with those shortcomings and may not be able to further upgrade with the future Deviation development, I still consider the addition of two switches give life to the 7e that is otherwise too limited in functionality..
Last edit: 20 Feb 2013 02:15 by cmpang.

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

More
20 Feb 2013 11:37 - 20 Feb 2013 12:00 #6625 by Mullson
Replied by Mullson on topic Add two switches to the Devo 7e
Wouldn't it be better with a complex 2 mixers set to dr0,1 replace. Or Wouldn't there be any difference.

I hope its going to be a standard so the switch configs can be more interchangeable between the TXs. Its a really easy and safe mod compared to the others.

Do you know how the 4 switches translates in 8emu? I mean if you build your ini with it?
Last edit: 20 Feb 2013 12:00 by Mullson.

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

  • rbe2012
  • rbe2012's Avatar
  • Offline
  • So much to do, so little time...
More
20 Feb 2013 11:55 #6626 by rbe2012
Replied by rbe2012 on topic Add two switches to the Devo 7e

Mullson wrote: Do you know how the 4 switches translates in 8emu? I mean if you build your ini with it?

They are the AIL DR and ELE DR switches similar to the builtin switches in Devo8.

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

More
20 Feb 2013 12:03 #6627 by Mullson
Replied by Mullson on topic Add two switches to the Devo 7e

rbe2012 wrote:

Mullson wrote: Do you know how the 4 switches translates in 8emu? I mean if you build your ini with it?

They are the AIL DR and ELE DR switches similar to the builtin switches in Devo8.


And the hold?

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

More
20 Feb 2013 12:47 #6631 by cmpang
Replied by cmpang on topic Add two switches to the Devo 7e

Mullson wrote:

rbe2012 wrote:

Mullson wrote: ...And the hold?...


Hold and FMode remained as it was before the mod..

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

More
21 Feb 2013 08:52 - 22 Feb 2013 03:26 #6666 by Mullson
Replied by Mullson on topic Add two switches to the Devo 7e
PB
Couldn't we "you" please implement this switches to the build? :whistle:

I use the 671 bild now.
Last edit: 22 Feb 2013 03:26 by Mullson.

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

  • rbe2012
  • rbe2012's Avatar
  • Offline
  • So much to do, so little time...
More
21 Feb 2013 10:09 #6669 by rbe2012
Replied by rbe2012 on topic Add two switches to the Devo 7e
It will not be so easy to determine if a tx has such a hw mod or not (esp. when the switch is off and no input can be read). So a build which supports this has to know while building if the mod is implemented.
RandMental has proposed to save a hashed-value in the tx ( Fixed ID and TX-ID ). If such a feature is implemented we could use this to decide at runtime if a hardware-mod is installed without having to fear side-effects when transferring tx.ini-files.
I would highly appreciate such a mechanism as I am going to play around with some hardware mods too.

Off topic: I thought about a forum category for hardware mods like the flysky module, the 7e-range-hack, this one and what will come later...

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

More
21 Feb 2013 10:55 #6671 by FDR
Replied by FDR on topic Add two switches to the Devo 7e
I would use a tx.ini setting for the most common mods without to possibility to change it on the ui.
This way the builds would be uniform...

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

More
21 Feb 2013 11:32 - 21 Feb 2013 12:37 #6677 by Mullson
Replied by Mullson on topic Add two switches to the Devo 7e

rbe2012 wrote: It will not be so easy to determine if a tx has such a hw mod or not (esp. when the switch is off and no input can be read). So a build which supports this has to know while building if the mod is implemented

Cant it be like FMOD2 is for 7E now.
If you have the mod you can use it. If not you can set it to another switch or turn it of. Its just a switch setting you cant use like FMOD2 for 7E.
So the TX wouldn't have to determine, you will.
Last edit: 21 Feb 2013 12:37 by Mullson.

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

  • rbe2012
  • rbe2012's Avatar
  • Offline
  • So much to do, so little time...
More
21 Feb 2013 12:37 - 21 Feb 2013 12:38 #6684 by rbe2012
Replied by rbe2012 on topic Add two switches to the Devo 7e
Wouldn't work (after a quick look) because two states FMODE2 and either FMODE0 or FMODE1 could be active at the same time.
Last edit: 21 Feb 2013 12:38 by rbe2012. Reason: English language...

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

More
21 Feb 2013 13:11 #6689 by PhracturedBlue
Replied by PhracturedBlue on topic Add two switches to the Devo 7e
the issue is mostly how do I import a model from the forum if I don't know how to map the channels. the model file has no cncept of whattype of TX it is on, and I want to keep it that way.

For the flysky mod, my plan is to have a page on the tx-config screen that lets you set which modules you have and whether they have a PA or not. That way you won't need to set the power to '150mW' on the devo7e for instance. It isn't going to happen before the release though.

For the switches, I was hoping to do something similar, but I was thinking of merging it with the virtual-switch stuff that you're doing. Fundamentally in the code having switches which can be conditionally configured is a lot of work because they are predefined in a list and we can't easily skip over them without changing every spin-box that uses a switch. So I want instead to enable virtual switches and then allow mapping new hardware to them.

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

More
21 Feb 2013 13:47 #6696 by Mullson
Replied by Mullson on topic Add two switches to the Devo 7e

PhracturedBlue wrote: the issue is mostly how do I import a model from the forum if I don't know how to map the channels. the model file has no cncept of whattype of TX it is on, and I want to keep it that way.

I think It should be that way to. But shouldn't it be possible to set the switches for personal use? Or is it already?

PhracturedBlue wrote: For the flysky mod, my plan is to have a page on the tx-config screen that lets you set which modules you have and whether they have a PA or not. That way you won't need to set the power to '150mW' on the devo7e for instance. It isn't going to happen before the release though.

I have bin fiddling whth a hardware diod light mod so at the front you can see what module is in use. Are the different modules power less when not in use?
How do you mean "won't need to set the power to '150mW'"? Do you mean setting the power on the start screen?

PhracturedBlue wrote: For the switches, I was hoping to do something similar, but I was thinking of merging it with the virtual-switch stuff that you're doing. Fundamentally in the code having switches which can be conditionally configured is a lot of work because they are predefined in a list and we can't easily skip over them without changing every spin-box that uses a switch. So I want instead to enable virtual switches and then allow mapping new hardware to them.

If I understand right it sounds really good. My only interest is being able to set them my self. Will it, are it possible?

Another thing, is there any kind of fast bind way. With out going in to the menu's? If not shouldn't there be? For example three buttons at the same time.

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

Time to create page: 0.164 seconds
Powered by Kunena Forum