Page 1 of 1

(Extended) Aux state handling

Posted: Sun Jul 06, 2014 2:52 am
by Metori

Code: Select all

    uint16_t auxState = 0;
    for(i=0;i<4;i++)
      auxState |= (rcData[AUX1+i]<1300)<<(3*i) | (1300<rcData[AUX1+i] && rcData[AUX1+i]<1700)<<(3*i+1) | (rcData[AUX1+i]>1700)<<(3*i+2);

Can anyone explain me why we are using

Code: Select all

(rcData[AUX1+i]<1300)

instead of

Code: Select all

(rcData[AUX1+i]<=1300)

?

Re: Aux state handling

Posted: Sun Jul 06, 2014 3:32 am
by dominicclifton
the 1700 is equally important in your question too right?

I guess if the middle is 1500 then +/- 200 either side seems reasonable but addional information would be most welcome to help demystify it.

Re: Aux state handling

Posted: Sun Jul 06, 2014 3:53 am
by Metori
My question is why we are using < insted of <= in this part?

If using < then aux value of 1300 and 1700 will not be interpreted as aux state.
With < we will get aux ranges like 0-1299, 1301-1699, 1701 and above.

Thanks.

Re: (Extended) Aux state handling

Posted: Sun Jul 06, 2014 6:02 am
by Metori
About two month ago I wrote post in GPS NAV thread: viewtopic.php?f=8&t=3989&start=500#p50755
It says that EXTENDED_AUX_STATES feature don't work properly. But it looks like nobody uses this feature surely =(

Today after reading code and some investigatig I found a solution:

Code: Select all

#if defined(EXTENDED_AUX_STATES)
    uint32_t auxState = 0;
    for(i=0;i<4;i++)
      auxState |= (uint32_t)(rcData[AUX1+i]<=1230)<<(6*i) |
      (uint32_t)(1230<rcData[AUX1+i] && rcData[AUX1+i]<=1360)<<(6*i+1) |
      (uint32_t)(1360<rcData[AUX1+i] && rcData[AUX1+i]<=1490)<<(6*i+2) |
      (uint32_t)(1490<rcData[AUX1+i] && rcData[AUX1+i]<=1620)<<(6*i+3) |
      (uint32_t)(1620<rcData[AUX1+i] && rcData[AUX1+i]<=1750)<<(6*i+4) |
      (uint32_t)(rcData[AUX1+i]>1750)<<(6*i+5);
#else
    uint16_t auxState = 0;
    for(i=0;i<4;i++)
      auxState |= (rcData[AUX1+i]<=1300)<<(3*i) | (1300<rcData[AUX1+i] && rcData[AUX1+i]<=1700)<<(3*i+1) | (rcData[AUX1+i]>1700)<<(3*i+2);
#endif

Re: (Extended) Aux state handling

Posted: Sun Aug 03, 2014 7:19 pm
by bejo52
I would like to use it and gave it already a try with the GPS Nav version from EOSBandi but there are some other things they did not work for me. Especially the headfree mode didn't work and the gimbal configuration at the Win GUI is not available. So if the extended Aux state could be included in the MWii GUI it would be great.

Re: (Extended) Aux state handling

Posted: Mon Aug 11, 2014 9:46 pm
by Hypermobile
I tried it on the NAV, and i likes it.

made a DIY (adjustable) 6-state switch.
Great stuff should be on the Next Release of regular Multiwii