Holding button

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
pdb0001
Posts: 4
Joined: Thu Oct 27, 2022 2:05 am

Holding button

#1 Post by pdb0001 »

Apologies if this is a stupid question, I’m sure it has already been answered, or is so obvious no one needed to ask, but if someone could point me in the right direction, some FAQs or tutorials, that would be great, I’m new to Air Manager.

I’m trying to get Air Manager to hold down a button in XP12 when I hold down a physical button connected via an Arduino. So far my attempts have only resulted in Air Manager pressing and immediately releasing the button in XP, no matter how long I hold the physical button. Specifically I’m trying to build an APU module for the new XP12 Citation X, and this is for the APU starter switch, which needs to be pressed up (or down) for several seconds.
APU starter switch up -> command = laminar/CitX/APU/starter_switch_up
APU starter switch dwn -> command = laminar/CitX/APU/starter_switch_dwn

I can make it work in SPAD.next by using “begin command” on button press, and “end command” on button release, but I’m not sure how to implement that in Air Manager. Do I need to implement it as a loop in the LUA script, or is there another method I should use instead of xpl_command?

Air Manager looks amazing and I’m excited to see what I can do with it, I’m just on the steep bit of the learning curve atm.

Thank you for reading this, and thanks even more for any helpful advice.

Pete

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Holding button

#2 Post by Sling »

Hi Pete,

Take a look at the wiki API pages relating to xpl_command. You use a similar BEGIN and END within the xpl_command. Be sure to let us know how you go.

pdb0001
Posts: 4
Joined: Thu Oct 27, 2022 2:05 am

Re: Holding button

#3 Post by pdb0001 »

Hi Sling, thanks so much for your fast response. I will take a look at that tomorrow.

pdb0001
Posts: 4
Joined: Thu Oct 27, 2022 2:05 am

Re: Holding button

#4 Post by pdb0001 »

Well I couldn’t wait :D

https://siminnovations.com/wiki/index.p ... pl_command

That looks like exactly what I need, but I must sleep now, it’s nearly 5am here and I have work in a few hours :cry:

Will let you know how it goes

Thanks again

Pete

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Holding button

#5 Post by Ralph »

You'll need to use the pressed and released button callbacks for this, in case you did not know, but you probably already had that figured out :)

pdb0001
Posts: 4
Joined: Thu Oct 27, 2022 2:05 am

Re: Holding button

#6 Post by pdb0001 »

Hi Ralph, Sling,

Thank you both for your replies. Yes, I got the button pressed and released callback bit, which I found from another code snippet. I have now tested with the "BEGIN" and "END" arguments within xpl_command, and it works beautifully, exactly what I wanted. Thanks so much for your help. I will know to check the wiki first for my next query :)

Regards

Pete

Post Reply