Jump to content
The simFlight Network Forums

Help for LUA double strokes in FSX G1000


Recommended Posts

I built a LUA sketch for my G1000 Board  with an Arduino interface to FSUIPC -> FSX

Testing the sketch, I send the string "PFDK01" via COM5 to the LUA script. Where  I have the LUA-sequence:

 if (string.find(datastring, "PFDK01")) then  
        ipc.control(66762, 1)  --This is the control to push G1000 PFD Softkey 1
    end

In the FSX it generates the key strokes twice, not as expected once. Therefore I get false behavier in the FSX.

 

Testing the same Control on the Linda console, I get the same reaction on FSX (double button stroke).

Where is my misunderstanding? What can I do?

I use FSUIPC 4.975a  and FSX

Thanks for help,  Paul

 

Link to comment
Share on other sites

12 minutes ago, meierpaul said:

Testing the same Control on the Linda console, I get the same reaction on FSX (double button stroke).

On my list, control 66762 is G1000 PFD Softkey 2. The Softkey 1 control is 66761.

But assuming that was an error in your question, all that FSUIPC will do is send that control on to FSX.

Have you tested in a more simple way -- assign to a keypress or button in FSUIPC, or perhaps, more directly, assign in FSX. Just as a test?

One more question. I don't know Linda very well, but does it use the same method, via Lua?

Pete

 

Link to comment
Share on other sites

Sorry, my fault on the G1000 PFD Softkey, took the wrong lines.

But I tried your proposal and made a quick macro with the same control:

 [Macros]
ipc.control(66761,1)

and sent it from FSUIPC direct via Key-stroke  (CTRL-B) with the same result of an double stroke in FSX.

FSUIPC-2.jpg.68aaf944949d9caa8b3239f583c5a315.jpg

Sorry, same result Paul

Link to comment
Share on other sites

I ran into this similar problem, but using the GPS.
4 GPS's - 2 in VC, 2 in a popup.
The 530's were isolated from the 430's by using indexing in the GPS var --> C:fs9gps:<index number>
All fine until the 2d popup GPS's were opened.
The stock GPS's along with the G1000 use event listeners residing in the XML code.
The listeners will not work in the popup until they are opened.

If you are using a second iteration of the G1000 in your G1000 board then you now have 2 listeners...
The result? 2 commands performed on a control input.
It is basically a gauge thing, not your hardware or interface.
If this is the case with you ( 2 iterations of G1000 ) the you need to copy the original and rename it to something like g1000_pfd_no_listen.xml
Use that one for the G1000 board or the VC, you will now be using 2 different versions of the same G1000, 1 for VC, 1 for hardware.
Then starting around 8167, the start of event listeners comment out the the ones that you are using in your hardware in the "no_listen" version.
Ex.

<Trigger id="G1000_PFD_SOFTKEY1">
	<KeyEvent>G1000_PFD_SOFTKEY1</KeyEvent>
	<Script>@Softkey0</Script>
</Trigger>

Becomes....

<!-- <Trigger id="G1000_PFD_SOFTKEY1">
	<KeyEvent>G1000_PFD_SOFTKEY1</KeyEvent>
	<Script>@Softkey0</Script>
</Trigger> -->

Note.. This also occurs when the keyboard is active for ICAO lookup.. 2 letters get entered per keyboard press.
If you want to get rid off all of the listeners in 1 fell swoop for your hardware then comment out the lines 8150 thru 8265 as shown below.

 

<!-- THIS COMMENT WILL COMPLETELY TURN OFF ALL LISTENERS        
	<KeyMap id="KeyMap">
            <Trigger id="AlphaNumeric">
                <KeyboardKey>AlphaNumeric</KeyboardKey>
                <Visibility>(@g:pfdEnteringInput) @kDTOInputICAO ==</Visibility>
                <Script>(M:Key) chr (&gt;@g:IcaoSearchEnterChar)</Script>
            </Trigger>
            <Trigger id="ASCII">
                <KeyboardKey>ASCII</KeyboardKey>
                <Visibility>(@g:pfdEnteringInput) @kDTOInputName ==</Visibility>
                <Script>(M:Key) chr (&gt;@g:NameSearchEnterChar)</Script>
            </Trigger>
            <Trigger id="Backspace">
                <KeyboardKey>Backspace</KeyboardKey>
                <Visibility>(@g:pfdEnteringInput)</Visibility>
                <Script>(@g:pfdEnteringInput) @kDTOInputICAO == if{ -1 (&gt;@g:IcaoSearchBackupChar) quit }
			(@g:pfdEnteringInput) @kDTOInputName == if{ -1 (&gt;@g:NameSearchBackupChar) quit }</Script>
            </Trigger>
            <Trigger id="G1000_PFD_DIRECTTO_BUTTON">
                <KeyEvent>G1000_PFD_DIRECTTO_BUTTON</KeyEvent>
                <Script>@DTOButton</Script>
            </Trigger>
            <Trigger id="G1000_PFD_FLIGHTPLAN_BUTTON">
                <KeyEvent>G1000_PFD_FLIGHTPLAN_BUTTON</KeyEvent>
                <Script>@FPLButton</Script>
            </Trigger>
            <Trigger id="G1000_PFD_CLEAR_BUTTON">
                <KeyEvent>G1000_PFD_CLEAR_BUTTON</KeyEvent>
                <Script>@CLRButton</Script>
            </Trigger>
            <Trigger id="G1000_PFD_MENU_BUTTON">
                <KeyEvent>G1000_PFD_MENU_BUTTON</KeyEvent>
                <Script>@MENUButton</Script>
            </Trigger>
            <Trigger id="G1000_PFD_PROCEDURE_BUTTON">
                <KeyEvent>G1000_PFD_PROCEDURE_BUTTON</KeyEvent>
                <Script>@PROCButton</Script>
            </Trigger>
            <Trigger id="G1000_PFD_ENTER_BUTTON">
                <KeyEvent>G1000_PFD_ENTER_BUTTON</KeyEvent>
                <Script>@ENTButton</Script>
            </Trigger>
            <Trigger id="G1000_PFD_GROUP_KNOB_INC">
                <KeyEvent>G1000_PFD_GROUP_KNOB_INC</KeyEvent>
                <Script>@PFDOuterKnobIncrement</Script>
            </Trigger>
            <Trigger id="G1000_PFD_GROUP_KNOB_DEC">
                <KeyEvent>G1000_PFD_GROUP_KNOB_DEC</KeyEvent>
                <Script>@PFDOuterKnobDecrement</Script>
            </Trigger>
            <Trigger id="G1000_PFD_PAGE_KNOB_INC">
                <KeyEvent>G1000_PFD_PAGE_KNOB_INC</KeyEvent>
                <Script>@PFDInnerKnobIncrement</Script>
            </Trigger>
            <Trigger id="G1000_PFD_PAGE_KNOB_DEC">
                <KeyEvent>G1000_PFD_PAGE_KNOB_DEC</KeyEvent>
                <Script>@PFDInnerKnobDecrement</Script>
            </Trigger>
            <Trigger id="G1000_PFD_ZOOMIN_BUTTON">
                <KeyEvent>G1000_PFD_ZOOMIN_BUTTON</KeyEvent>
                <Script>@ZoomInButton</Script>
            </Trigger>
            <Trigger id="G1000_PFD_ZOOMOUT_BUTTON">
                <KeyEvent>G1000_PFD_ZOOMOUT_BUTTON</KeyEvent>
                <Script>@ZoomOutButton</Script>
            </Trigger>
            <Trigger id="G1000_PFD_CURSOR_BUTTON">
                <KeyEvent>G1000_PFD_CURSOR_BUTTON</KeyEvent>
                <Script>@PFDCRSRButtonPush</Script>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY1">
                <KeyEvent>G1000_PFD_SOFTKEY1</KeyEvent>
                <Script>@Softkey0</Script>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY2">
                <KeyEvent>G1000_PFD_SOFTKEY2</KeyEvent>
                <Script>@Softkey1</Script>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY3">
                <KeyEvent>G1000_PFD_SOFTKEY3</KeyEvent>
                <Script>@Softkey2</Script>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY4">
                <KeyEvent>G1000_PFD_SOFTKEY4</KeyEvent>
                <Script>@Softkey3</Script>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY5">
                <KeyEvent>G1000_PFD_SOFTKEY5</KeyEvent>
                <Script>@Softkey4</Script>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY6">
                <KeyEvent>G1000_PFD_SOFTKEY6</KeyEvent>
                <Script>@Softkey5</Script>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY7">
                <KeyEvent>G1000_PFD_SOFTKEY7</KeyEvent>
                <Script>@Softkey6</Script>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY8">
                <KeyEvent>G1000_PFD_SOFTKEY8</KeyEvent>
                <Script>@Softkey7</Script>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY9">
                <KeyEvent>G1000_PFD_SOFTKEY9</KeyEvent>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY10">
                <KeyEvent>G1000_PFD_SOFTKEY10</KeyEvent>
                <Script>@Softkey9</Script>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY11">
                <KeyEvent>G1000_PFD_SOFTKEY11</KeyEvent>
                <Script>@Softkey10</Script>
            </Trigger>
            <Trigger id="G1000_PFD_SOFTKEY12">
                <KeyEvent>G1000_PFD_SOFTKEY12</KeyEvent>
            </Trigger>
        </KeyMap>
END OF THE LISTENERS COMMENT OUT -->



Hope this may get you going in the right direction.. ( not the wrong one - heh )
Roman

EDIT -- If you are going for a full hardware cockpit, IE not using the VC at all then just comment out the G1000 gauge in the panel.cfg so it is not active. Then you would not have to do the above.. The same procedure could also be used as an easy test to see, if indeed, 2 listeners are causing your problems.

Link to comment
Share on other sites

Thanks, I thin that is/was my problem. As soon as I have only one GPS instance open on the screen the comand works fine. As you mentioned the second GPS gives me the problem.

I will try your code, but it also means that I will have to change the XML-Code of the basic FSX G1000.

But thanks and for the moment my problem is solved !!!

Thanks to all Paul

Link to comment
Share on other sites

1 minute ago, meierpaul said:

I will try your code, but it also means that I will have to change the XML-Code of the basic FSX G1000.

No... Copy the complete xml file & paste it as a new file with a new name.. Modify that one. Then call that one as the second iteration of the G1000 in your panel.cfg.

Link to comment
Share on other sites

2 hours ago, meierpaul said:

But I tried your proposal and made a quick macro with the same control:

 [Macros]
ipc.control(66761,1)

and sent it from FSUIPC direct via Key-stroke  (CTRL-B) with the same result of an double stroke in FSX.

Sorry. but you misunderstood! I meant to assign your CTRL-B directly to the control "G1000 PFD Softkey 1", so that we know that that is being semt once and once only.

Of course the other way to check that would be to simply enable logging of non-axis Events.

BTW "ipc.control(66761,1)" is a call to a Lua library called "ipc", and it can't possibly have any effect outside of a Lua program.  The Lua interpreter in FSUIPC only operates for loaded Lua plug-ins, so I really don't know what you thought you tested there!

Anyway, I see you might have other reasons for what you see occurring and may now realise it is nothing really to do with Lua or FSUIPC.

Pete

 

Link to comment
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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.