Jump to content
The simFlight Network Forums

Compound Button presses with Button Flags


Recommended Posts

Greetings Pete,

I've been using FSUIPC for a long time now (thanks for such a vital program), but am finally getting into some more demanding setups. I'm running FSX, sp2 and FSUIPC 4.3. I am connecting some real aircraft radio remote tuning heads which use 5 pins to output each digit. Two pins are active for each digit in the frequency (note this not BCD - my XPDR and ADF output BCD and I have that code working reasonably well). I'm using betainnovations' gammaray interface boards, which will send key presses for each wired pin. (I cannot have it send joystick button presses.) I'm not a programmer, so I'm trying to build everything in the FSUIPC config files as opposed to writing vb or c++ etc.

....pins>.....A..............B...............C...............D..............E

key.code....50............51.............52.............53............54 (ctrl + alt)

0.....................…….....1...............................................1

1...............1..............1

2...............1...............................1

3..............................1................1

4..............................1..............................1

5...............................................1.............1

6...............................................1..............................1

7..............................................................1...............1

8..............1..............................................1

9..............1...............................................................1

I have two questions regarding two different ways to make this work.

Right now I'm using joystick button flags to store and clear the output from each digit's pins, (joy 10 buttons 2-6 in the example below) as follows (from the KEYS section)...

928=50,11,1003,2562,1004,2562; nav1 ones

929=51,11,1003,2563,1004,2563

930=52,11,1003,2564,1004,2564

931=53,11,1003,2565,1004,2565

932=54,11,1003,2566,1004,2566

For the first method, I am then using the following compound button press commands to set the bcd bits...

504=CP(F+10,3)(F+10,6)0,0,Cx0A000350,x0100; set nav1 ones to 0

505=CP(F+10,3)(F+10,6)0,0,Cx0A000350,x0200;

506=CP(F+10,3)(F+10,6)0,0,Cx0A000350,x0400;

507=CP(F+10,3)(F+10,6)0,0,Cx0A000350,x0800;

508=CP(F+10,2)(F+10,3)0,0,Cx06000350,x0100; set nav1 ones to 1

509=CP(F+10,2)(F+10,3)0,0,Cx0A000350,x0200;

510=CP(F+10,2)(F+10,3)0,0,Cx0A000350,x0400;

511=CP(F+10,2)(F+10,6)0,0,Cx0A000350,x0800;

etc for each value.

This actually works, however, this requires actually pressing joystick button 0,0 to trigger the update. I'd like for this to update automatically. Since joystick 10 isn't real, there's no actual button press to do the triggering in the compound statement.

Is there a way to make a key command send a "real" button press, not just set a flag? Or some other way to automatically trigger the update?

For the second method...

I also tried to do this using a conditional statement in the key section, but couldn't figure out how to read the state of the button flag - I don't know which offset to read.

Are the button flags accessable via an offset read, or is there an undefined offset I can use?

Thanks for any assistance you can provide!

Best regards,

Mike.

Link to comment
Share on other sites

Is there a way to make a key command send a "real" button press, not just set a flag?

Yes. You can use the Offset controls to toggle a bit in the Virtual Buttons offsets, 3340 and following. Thre are 36 bytes in which 8 bits each represent a button on a "virtual joystick" -- numbers 64-73. There are 32 buttons on each of the 9 joysticks, giving 288 possibles. So, for example, for the first 8 joystick, number 64, you'd assign Offset Dword ToggleBits as the control, with x3340 as the offset, and then 1 for button 0, 2 for button 1, 4 for button 2, 8 for button 3 and so on. The next joystick, number 65, would be at offset 3344 (there being 4 bytes in 32 bits or one Dword).

Unfortunately, because the keyboard reception isn't working when the button scanning is used whilst INSIDE the FSUIPC options, it isn't possible to program these buttons from the FS PC's keyboard within the FSUIPC options. They were more intended to be used from an application program or vis the button facilities in WideClient. So, you'd need to assign the keypress controls in the Options dialogue, carefully noting which joystick number and button number it is so you can use that when editing your INI file.

Using "togglebits" you'd change the status of the button on each press -- press for on, press again for off, and so on. To emulate a normal press / release button you'd program the keypress to send the "setbits" control on the press and "clearbits" control on the release, so the button only looks pressed whilst the key is held down. Best also to check the "No repeats" option (added in the new versions of FSUIPC).

I also tried to do this using a conditional statement in the key section, but couldn't figure out how to read the state of the button flag - I don't know which offset to read.

You can't access button and flag states directly through offsets -- only the virtual buttons as just described.

Regards

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.