Devo7E beta15 + Switch Mod will not fit in ROM

More
28 Nov 2013 20:54 - 28 Nov 2013 21:01 #15998 by robca

victzh wrote: @HappyHarry - using galee's code is problematic, it is very heavily repackaged Deviation, no direct correspondence.

What is so special about this code in contrast to Deviation that you'd want to bring in?


Mostly because it cleverly manages to implement two 3-way switches, by using more diodes and implementing a scanning algorithm pulling pins high and low as needed

I started looking into it, but my coding skills are weak and I didn't find enough time to look at it yet.

If you look at the repository posted earlier, the relevant file is Fkey.c.

I found two versions of that file, one before and one after the addition of the two-way switches (with a lot of help from cmpang from this forum).

By comparing the files, you can see how the matrix is scanned using GPIO_CNF_OUTPUT_OPENDRAIN instead of GPIO_CNF_OUTPUT_PUSHPULL, and adding two section:

if(result==KEY_MASK)
{
//PC6 ¿ªÂ©Êä³ö²¢À­µÍ
gpio_set_mode(KEY_ROW_PORT,GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, GPIO6);
gpio_clear(KEY_ROW_PORT, GPIO6);

KeySwExt=(~(gpio_port_read(KEY_COL_PORT)>>5))&0xf;

//»¹Ô­PC6
gpio_set_mode(KEY_ROW_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO6);
gpio_set(KEY_ROW_PORT, GPIO6);
}

and

s=gpio_port_read(KEY_SW_PORT);
sw=0;
if(s&(1L<<10)) sw|=SW_FMOD;
if(s&(1L<<11)) sw|=SW_HOLD;
if(KeySwExt&1) sw|=SW_FLAP0;
if(KeySwExt&2) sw|=SW_FLAP1;
if(KeySwExt&4) sw|=SW_GEAR0;
if(KeySwExt&8) sw|=SW_GEAR1;
if(sw==SwBuf) SwStat=sw;
else SwBuf=sw;
}

I'm enclosing the two files (old and new) and a XPS (can be opened with any new-ish Windows OS) with the description of the HW mod (in Chinese, but the pictures are self-explanatory)
Attachments:
Last edit: 28 Nov 2013 21:01 by robca.

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

More
28 Nov 2013 20:56 - 28 Nov 2013 21:15 #16001 by robca
Let me try adding the files again
Attachments:
Last edit: 28 Nov 2013 21:15 by robca.

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

More
28 Nov 2013 21:07 #16002 by PhracturedBlue
Replied by PhracturedBlue on topic Devo7E beta15 + Switch Mod will not fit in ROM
I think I gave him that code way back when. It is pretty intrusive to add to the default build though.

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

More
28 Nov 2013 21:20 - 28 Nov 2013 21:20 #16005 by robca

PhracturedBlue wrote: I think I gave him that code way back when. It is pretty intrusive to add to the default build though.


definitely a significant change, but for people adding the two 2-way switches, the soldering and hw changes are pretty much identical. A Devo 7e with two additional 3-way switches becomes a significantly more flexible beast

I'd be delighted if anyone could write a patch for adventurous people :-). I can build any repository (thanks to the VM), it would just take me a long time to figure out how to make it work without being familiar with the code

Cmpang also has the HW modification done already (and he's using Galee's builds, who are pretty old by now), so I'm sure he'd only be too happy to test (sorry cmpang for putting words in your mouth :oops: )

I'm soldering my switches tomorrow, will flash Galee's build to test them, and then I should be able to test as well

If there's nobody willing to do it, sooner or later I still hope to find the time to look into it
Last edit: 28 Nov 2013 21:20 by robca.

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

More
28 Nov 2013 21:20 #16006 by victzh
@PhracturedBlue - on unrelated topic (no Switch Mod) - I try to build Devo7E without Standard GUI (as far as I understand it is being obsoleted, and anyway it will give some life span to Devo7E). Just turning on NO_STANDARD_GUI does not help a lot - nobody tried it for a while. Am I correct that in this case the whole src/pages/common/standard should be excluded from the build?

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

More
28 Nov 2013 21:23 #16007 by victzh
It was my impression that we had some Switch Mod for Devo7E, is not this whole thread about it? What's the benefit of galee's code/modification compared to what people did with standard Deviation code? More switches? How many do you need? (It's not a rhetoric question, I plan to include extra switch ability to multi-module board, so it's for real.)

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

More
28 Nov 2013 21:32 #16008 by PhracturedBlue
Replied by PhracturedBlue on topic Devo7E beta15 + Switch Mod will not fit in ROM
The standard Gui will never be obsolted in general. Despite the fact that I don't use it myself and it is a 2nd-class citizen as far as testing goes, it is widely used and preferred by many folks. I gave it as an option to give the Devo7e more legs for the future, but I think robca's path is probably the end-road for the 7e, allowing customization for each user's needs.

setting NO_STANDARD_GUI should remove the entire 'src/pages/128x64x1/standard' directory.

This is currently done by modifying targe/devo7e/Makefile.inc to uncomment:
#NO_STANDARD_GUI := 1

that modifies the Makefile behavior. It would be better to do in target_defs.h though. That just requires placing the relevant #ifdefs in each of the files in the src/pages/128x64x1/standard directory

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

More
28 Nov 2013 21:42 #16009 by victzh
Thanks, it finally builds for me without standard GUI. My SLT module is smaller than we thought - 2004 bytes, but it helped me to clean it up a bit. Makefile def works fine, I just added a couple of ifdefs in common code. I can check the same with NO_ADVANCED_GUI, if you'd like and make a pull request - it does not hurt to have the code compile for Devo7E, does it?

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

More
28 Nov 2013 21:46 #16010 by PhracturedBlue
Replied by PhracturedBlue on topic Devo7E beta15 + Switch Mod will not fit in ROM
I don't recall if you can also remove the advanced GUI. If it works, then I have no issue having an ifdef for it.

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

More
28 Nov 2013 21:47 - 28 Nov 2013 21:56 #16011 by HappyHarry
Replied by HappyHarry on topic Devo7E beta15 + Switch Mod will not fit in ROM

victzh wrote: @HappyHarry - using galee's code is problematic, it is very heavily repackaged Deviation, no direct correspondence.

What is so special about this code in contrast to Deviation that you'd want to bring in?


the addition of 2 extra 3 pos switches, and 2 extra fully analogue channels for starters :)

[edit]
oops should re-read the thread before replying lol
[/edit]
Last edit: 28 Nov 2013 21:56 by HappyHarry.

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

More
28 Nov 2013 22:09 - 28 Nov 2013 22:11 #16012 by robca

victzh wrote: It was my impression that we had some Switch Mod for Devo7E, is not this whole thread about it? What's the benefit of galee's code/modification compared to what people did with standard Deviation code? More switches? How many do you need? (It's not a rhetoric question, I plan to include extra switch ability to multi-module board, so it's for real.)


Standard mod is two 2-way switches or one 3-way switch. With the same amount of soldering and cost (well, couple diodes extra, but those are sold in packages ot 10 anyway), you could have two 3-way switches. Given that the Devo 7e already has two 2-way switches as base functionality, the ability to add two more 3-way switches is significant (and all for the cost of a dozen new lines of code ;) )

Many quadcopter controllers use 3 way switches for flying mode. My KK2 flight controller (with 1.6++ CPPM firmware) can use a 3-way switch for Acro/SL-mix/SL and another to control the default positions of a 2-way gimbal

I guess I could live with only one 3-way switch and either using the throttle-trim trick (but it's not very user friendly: no tactile feedback), or limit the options using 2-way switches... but having two 3-way switch would be perfect, and leave the remaining two 2-way switches for retractables, lights or anything else

more importantly for me, currently the patch to enable the two 2-way switches is not part of the main build, so it's already something users have to build/find. Assuming it can be coded, a 3-way switch seems a simple superset of the 2-way switches and adds a lot more value

And, to answer your question, two additional 3-way switches are all I can think of (on top of the existing two), for a form factor as small as the 7e. Possibly an extra analog channel (rotary), but that would really be a "just in case" (3 axis gimbal)
Last edit: 28 Nov 2013 22:11 by robca.

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

More
29 Nov 2013 01:44 #16013 by cmpang
I have been using the two 3-way switch version since May and Rob is right that no multi-rotor pilots can live without it.. say the Phantom, Walkera QR X350 and any rotors that are using GPS functions.

Plane pilots using flaps are using it for the 3-stage settings too. Scale boat modellers found it useful for the 3 stage lighting..

Don't let the 7e's toy-size outlook fools you.. there is never a short-coming in using it in a formal flying field.. no lack of feature compared with the big boys by F and J.. and it just surprises the other pilots how well it performed..

With the good work of Deviation, the 7e bcomes a 12 channels capable Tx and it is just a waste that this capability is limited by the number of available input devices ( switches and pots).

The good thing is the mod is much much easier than that of the diode mod. Cost and labor in doing that is just about the same as doing the 2-way switch mod.

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

More
29 Nov 2013 06:58 #16020 by victzh
OK, what's the schematics (I can't read Chinese, only Russian ;-), may be it's easier to recover the smart schema from the physical connections than to try to understand the code?

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

More
29 Nov 2013 07:01 #16022 by victzh
And about fitting in ROM - it is true that Devo7E is at the brink of its memory capability, but some extra life can be breathed in by using only advanced GUI. I think for people wanting some extra controls - switches, POTs - it's no barrier, they're advanced by definition. Am I correct?

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

More
29 Nov 2013 07:22 #16023 by robca

victzh wrote: And about fitting in ROM - it is true that Devo7E is at the brink of its memory capability, but some extra life can be breathed in by using only advanced GUI. I think for people wanting some extra controls - switches, POTs - it's no barrier, they're advanced by definition. Am I correct?


that would definitely be ok by me :-)

as for your previous question, cmpang helped translate some of the content in the fkey.c file, and here's something that should help:

// B.5 B.6 B.7 B.8
//C.6 Rudder TL Rudder TR Elevator TU Elevator TD
//C.7 NC Ent R+ L-
//C.8 Throttle TU Throttle TD Aileron TR Aileron TL
//C.9 NC DN- UP+ Ext
//
//Comment:
//TL: Trim Left TR: Trim Right
//TU: Trim Up TD: Trim down
//
//OP:
// 红RED PB5 蓝Blue PB8 白White PB6 黄Yellow PB7 Brown棕PC6 This seems to match the color of the wire used to connect the switches

Basically it should tell you (together with the picture) where to the GPIO B the wires/switches connect, with the brown wire connected to GPIO C6

from the Devo HW table:

GPIO B
5: Button Matrix Col 1 - Red
6: Button Matrix Col 2 - White
7: Button Matrix Col 3 - Yellow
8: Button Matrix Col 4 - Blue

GPIO C
6: Button Matrix Row 1 - Brown

GPIO C6, Brown goes to the center contact of the 3-way switch (makes sense), and the GPIO B5-8 are connected to the outer contacts thru diodes. Basically it seems to be using Button Matrix Row 1 set high and low, then reading what happens to the GPIO B5-8, with some help from the diodes to prevent wrongly detecting other buttons status

does it help? I can try and draw a real diagram, if you think it's helpful

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

More
29 Nov 2013 07:24 - 29 Nov 2013 07:25 #16024 by PhracturedBlue
Replied by PhracturedBlue on topic Devo7E beta15 + Switch Mod will not fit in ROM
I think this is the thread where cmpang and I worked on initial support. It was almost a year ago so I don't recall all the details.

www.deviationtx.com/forum/7-development/...-work?start=320#6312

May or may not help
Last edit: 29 Nov 2013 07:25 by PhracturedBlue.

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

More
29 Nov 2013 07:24 #16025 by SeByDocKy
Replied by SeByDocKy on topic Devo7E beta15 + Switch Mod will not fit in ROM

cmpang wrote: I have been using the two 3-way switch version since May and Rob is right that no multi-rotor pilots can live without it.. say the Phantom, Walkera QR X350 and any rotors that are using GPS functions.

Plane pilots using flaps are using it for the 3-stage settings too. Scale boat modellers found it useful for the 3 stage lighting..

Don't let the 7e's toy-size outlook fools you.. there is never a short-coming in using it in a formal flying field.. no lack of feature compared with the big boys by F and J.. and it just surprises the other pilots how well it performed..

With the good work of Deviation, the 7e bcomes a 12 channels capable Tx and it is just a waste that this capability is limited by the number of available input devices ( switches and pots).

The good thing is the mod is much much easier than that of the diode mod. Cost and labor in doing that is just about the same as doing the 2-way switch mod.


I was not aware that you can even install some pot for devo7E ... With such capacitied it's more or less a devo10S :)
You have a link how to install pot ?

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

  • rbe2012
  • rbe2012's Avatar
  • Offline
  • So much to do, so little time...
More
29 Nov 2013 08:28 - 29 Nov 2013 08:30 #16026 by rbe2012

robca wrote:

victzh wrote: @HappyHarry - using galee's code is problematic, it is very heavily repackaged Deviation, no direct correspondence.
What is so special about this code in contrast to Deviation that you'd want to bring in?

Mostly because it cleverly manages to implement two 3-way switches, by using more diodes and implementing a scanning algorithm pulling pins high and low as needed

Galee scans the key matrix in both directions - from col to row and if no key is pressed (otherwise the result will be falsified) from row to col. He uses only one row for the reverse scan - could be four to have 16 additional switch positions (= 16 2-way-switches or 8 3-way-switches or something in between). Good idea.
The 2-switch-mod and the 3-switch-mod are using the free places in the key matrix where no buttons are installed. It should be possible to integrate this in one solution (without the need to change the existing 2/3-sw-mods).
Give me some time to think about.

Edit: I missed the last 2 hours of discussion while reading some code - I hope I am not outdated...
Last edit: 29 Nov 2013 08:30 by rbe2012.

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

More
29 Nov 2013 09:22 #16027 by cmpang
Installing a pot is a bit tricky. Someone in China has done it and I haven't try it yet..

The idea is simple. Making use of the PPM in function and use an existing PPM encoder (something aurdino) to feed in as the higher channels and you are done.

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

More
29 Nov 2013 09:26 - 29 Nov 2013 09:32 #16028 by cmpang
[quote="victzh" post=15991Galee scans the key matrix in both directions - from col to row and if no key is pressed (otherwise the result will be falsified) from row to col....[/quote]

that is what Gale has explained in his thread .. too bad the thread is too long and I cannot dig out the exact wording in the orginal post ... anyway, scanning in both directions is the key ...

(for some unknown reason, Gale has not been online for more than 3 months, otherwise I would ask him to give a me full description on the algorithm so that I can translate it in English. It is just an English language barrier afterall)

cmPang
Last edit: 29 Nov 2013 09:32 by cmpang.

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

Time to create page: 0.086 seconds
Powered by Kunena Forum