(Extended) Aux state handling

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
Metori
Posts: 18
Joined: Thu Jan 16, 2014 1:04 pm
Location: Russia, Vladivostok

(Extended) Aux state handling

Post 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)

?
Last edited by Metori on Sun Jul 06, 2014 5:55 am, edited 1 time in total.

dominicclifton
Posts: 202
Joined: Tue Feb 05, 2013 10:28 pm

Re: Aux state handling

Post 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.

Metori
Posts: 18
Joined: Thu Jan 16, 2014 1:04 pm
Location: Russia, Vladivostok

Re: Aux state handling

Post 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.

Metori
Posts: 18
Joined: Thu Jan 16, 2014 1:04 pm
Location: Russia, Vladivostok

Re: (Extended) Aux state handling

Post 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

bejo52
Posts: 11
Joined: Mon Feb 18, 2013 3:01 pm
Location: Germany, Berlin

Re: (Extended) Aux state handling

Post 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.

Hypermobile
Posts: 94
Joined: Mon Jan 13, 2014 8:53 pm

Re: (Extended) Aux state handling

Post 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

Post Reply