Devo 7e 3x2 switches not working anymore

More
30 Mar 2019 09:30 - 30 Mar 2019 09:44 #73612 by daniel.snowsurf
Devo 7e 3x2 switches not working anymore was created by daniel.snowsurf
I have upgraded my Devo 7e from Nov 2017 version to current version and 3x2 switches are not working properly. Does somebody know if something has changed in the hardware.ini or models.ini configuration?
Both 3 position switches on position 1 are recognized as position 0, and in position 2 are recognized as position 1. Position 0 is OK.
I have checked today nightly, one week ago BRANCH_5.0, master and a master custom build and I have always the same problem. While Nov 2017 version works properly.

Attached hardware.ini (renamed as hardware.txt)

Thanks.
Attachments:
Last edit: 30 Mar 2019 09:44 by daniel.snowsurf. Reason: Attached file

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

More
30 Mar 2019 11:58 #73614 by yets
Replied by yets on topic Devo 7e 3x2 switches not working anymore
Ah thankfully it's not just me. I'm having the same exact issues. I too was using the same exact Nov 2017 version and have been chasing this issue for a few weeks now. www.deviationtx.com/forum/7-development/...k-building?start=100

Hopefully the developers will take note of it seeing that there's more than one user having the problem

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

More
31 Mar 2019 08:29 - 31 Mar 2019 09:32 #73633 by daniel.snowsurf
Replied by daniel.snowsurf on topic Devo 7e 3x2 switches not working anymore
I got it working, changing some lines in the code.
The definition of the switches has been inverted (0 to 1 and 1 to 0) in addon_switches.c:
#define SWITCH_3x2  ((1 << INP_SWA0) | (1 << INP_SWA1) | (1 << INP_SWA2) \
                   | (1 << INP_SWB0) | (1 << INP_SWB1) | (1 << INP_SWB2))
#define SWITCH_3x1  ((1 << INP_SWA0) | (1 << INP_SWA1) | (1 << INP_SWA2))
#define SWITCH_2x2  ((1 << INP_SWA0) | (1 << INP_SWA1) \
                   | (1 << INP_SWB0) | (1 << INP_SWB1))
And also the condition to read the switches:
if (SW_ENABLED(src, SWITCH_3x1) && !SW_ENABLED(src, SWITCH_3x2)) {
        global_extra_switches = (((~port) >> 4) & 0x04) | (((~port) >> 5) & 0x08);
    } else if SW_ENABLED(src, SWITCH_2x2) {
        global_extra_switches  = (port>>6)&0x05;
    } else {
        global_extra_switches  = (~(port>>5))&0xf;
    }
but there is a bug, and I'm not sure where it is.

What I have made is force the condition for 3x2 switch:
CAUTION - This works only for Devo 7e 3x2 switch - This is not a solution but a proof of the bug
addon_switches.c
void _scan_extra_switches()
...
//    u32 src = ~Transmitter.ignore_src;
...
//    if (SW_ENABLED(src, SWITCH_3x1) && !SW_ENABLED(src, SWITCH_3x2)) {
//        global_extra_switches = (((~port) >> 4) & 0x04) | (((~port) >> 5) & 0x08);
//    } else if SW_ENABLED(src, SWITCH_2x2) {
//        global_extra_switches  = (port>>6)&0x05;
//    } else {
        global_extra_switches  = (~(port>>5))&0xf;
//    }

I can't find the definition of INP_SWXX... And have to check the code
Last edit: 31 Mar 2019 09:32 by daniel.snowsurf.

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

More
31 Mar 2019 11:09 #73635 by yets
Replied by yets on topic Devo 7e 3x2 switches not working anymore
Thanks I'll give this a try and report back that it works. Thanks for determining that it's a bug, feel like I've been getting something wrong

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

More
31 Mar 2019 14:36 #73639 by daniel.snowsurf
Replied by daniel.snowsurf on topic Devo 7e 3x2 switches not working anymore
I think I got it.
Just change this line, it should not be negated:
addon_switches.c
void _scan_extra_switches()
...
//    u32 src = ~Transmitter.ignore_src;
    u32 src = Transmitter.ignore_src;

Probably there is a problem too in :
uint32_t ADDON_Handle_ExtraSwitches(u32 result) {
    u32 src = ~Transmitter.ignore_src;

The emulator gets the switches in a different way, so it doesn't have the bug. Somebody has to check the other targets.
I'll try to do a pull request, although I'm a new git user.

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

More
01 Apr 2019 09:49 - 01 Apr 2019 13:29 #73657 by yets
Replied by yets on topic Devo 7e 3x2 switches not working anymore
This is my file;

void _scan_extra_switches()
{
// Write to C.6, read B
u32 src = ~Transmitter.ignore_src;

The line was not commented out. Changing to;
void _scan_extra_switches()
{
// Write to C.6, read B
u32 src = Transmitter.ignore_src;

causes the option for extra switches not available on the transmitter once loaded. Not sure if this is what your instructions were changing

Edit: In the latest files of Moeders fork, addon_switch.c doesn't have the above code.
Last edit: 01 Apr 2019 13:29 by yets.

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

More
02 Apr 2019 19:01 #73669 by daniel.snowsurf
Replied by daniel.snowsurf on topic Devo 7e 3x2 switches not working anymore
Yets, that's exactly what I did. It worked for me. The 3x2 switches were declared in the hardware.ini file. I don't understand when you say "option for extra switches not available".

I opened an issue in Github and Phractured Blue is working on it.

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

More
02 Apr 2019 19:44 #73670 by yets
Replied by yets on topic Devo 7e 3x2 switches not working anymore
Once declared in hardware.ini, after making those changes, checking Channel monitor on tx, the extra switches do not show up.

Anyway, in Moeders newest code, that code you changed is no longer there in the addon_switch.c file, so I'll have to wait for PBs fix. I also commented on GitHub regarding the bug

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

Time to create page: 0.037 seconds
Powered by Kunena Forum