Jump to content
Sign in to follow this  
wytman71

Map and Axis to Incr/Decr Commands

Recommended Posts

Thanks for the application - really changes the game!

I have been working on the Blackbird Corsair, specifically on the Supercharger handle.  I'd like to map an axis on my Honeycomb Bravo to the handle.  The handle has a Lvar (L:FG1D021) for position, but that, while settable, is not actually controlling the supercharger application, and is intended for output animation only.  I figured out that control is done via two events sent through the EVENTS_ID, and implemented a dirt simple script bound for the moment to a up/down toggle switch on the Honeycomb (the permanent "flap" switch over on the far right - NOT the axis at the far right).  The scripts are rather simply:

0x1101B (>L:EVENTS_ID,enum) // to decrement the handle (to neutral from low, or high to low)

0x1101A (>L:EVENTS_ID,enum) // to increment the handle (to low from neutral, or low to high)

The above does work to increment and decrement the handle, and the animated position of the handle moves as well without me having the set it.  FG1D021 gets set to 0, 50, or 100 depending on the increment/descrement.

What I'd love to do is map sending those events to the an axis.  I feel like I'd have to set a variable for the current state, though I suppose I could just read the enum or number value for FG1D021 lvar, and then do a comparison against where the axis is (LVAR is mapped 0 to 100 range). From what I can see using dev mode "Tools->Behaviors", the output is 0, 50, or 100 for the lvar.

So ...

if axis <25, and enum value is 50, then decrement once.  if enum is 100, decrement twice..

if 26-80 axis, and enum value is 0, then increment once.  If enum is 100, decrement once

if >80 axis, and enum value is 50, then increment once.  If enum is 0, increment twice.

I guess depending on how fast I move, it would really only ever decrement or increment once.  But regardless, I could write a routine like this in C, basic, fortran, and python.  But I can't for the life of me figure out how to do it in RPN script.  I am missing something obvious here methinks.  Anyway - if someone can point me in the right direction, I think I could figure it out. 

 

Thanks!

Share this post


Link to post
Share on other sites

I could offer a different solution.

1. Create the following script:
Group: Corsair
Name: SuperCharger
Code: (L:Corsair-SuperCharger)·50·*·(L:FG1D021,·Number)·<·if{·0x1101B·(>L:EVENTS_ID,·enum)·}·els{·0x1101A·(>L:EVENTS_ID,·enum)·}·

The Group and Script Name are important, because they determine the name of the "Script Variable" = the LVar at the beginning. OK? If you rename the group or the script, you have to rename the LVar accordingly (or use the "Insert Script Var" button). be mindful that AAOs RPN dialect is case sensitive.

2. Create an axis assignment to your phyiscal lever where you set Axis Min = 0, Axis Max = 2 and Rounding to "Int".

That should do the trick. What will happen is, that moving the lever will transmit the axis output value (0, 1 or 2) to the script through the script variable. The script then compares that variable times 50 to the position of the lever in the cockpit (which is 0, 50 or 100) and then sends either the up or the down event.

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

Same can be done with the flaps lever:

Group: Corsair
Name: FlapLever
Code: (L:Corsair-FlapLever)·20·*·(L:FLAP_LEVER,·Number)·<·if{·0x11164·(>L:EVENTS_ID,·enum)·}·els{·0x11165·(>L:EVENTS_ID,·enum)·}·

Axis assignment in this case is Axis Min = 0, Axis Max = 5, Rounding "Int".
 


LORBY-SI

Share this post


Link to post
Share on other sites

And the tail hook

Group: Corsair
Name: TailHook
Code: (L:Corsair-TailHook)·(L:FG1D189,·Number)·<·if{·0x1111F·(>L:EVENTS_ID,·enum)·}·els{·0x1111E·(>L:EVENTS_ID,·enum)·}·

Axis assignment in this case is Axis Min = 0, Axis Max = 2, Rounding "Int".


LORBY-SI

Share this post


Link to post
Share on other sites

Downside is, that you will have to move the levers at least once when you jump in the cockpit. Best would be to do a full checklist where all levers are moved through their entire range.


LORBY-SI

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...