Jump to content
The simFlight Network Forums

question re using offset 29F0 to activate a virtual joystick


Recommended Posts

Hi folks

I'm following the documentation trying to use offset 0x29F0 to simulate joystick buttons.    E.g.  I am writing the value of 0x00014000 to 'press' button 0 on virtual joystick 64.    I have enabled monitoring of offset 0x29F0 (well, I think I have) and I can see that the offset is updated with the right value (it is showing the value as 0x14000 - I assume that's the same as 0x00014000).   problem is, FSUIPC does not show the button being pressed in the FSUIPC dialog Buttons and switches tab and there is nothing in the buttons and switches log.

what am I missing? do I need to enable the FSUIPC virtual joystick feature specifically?

I am using the registered version of FSUIPC6 in P3D 4.5.   I am setting the value in the offset using Mobiflight based on a button press

any assistance will be highly appreciated.

 

Kind regards - Ran

Link to comment
Share on other sites

27 minutes ago, ranm said:

do I need to enable the FSUIPC virtual joystick feature specifically?

No.  It's always enabled in a Registered installation.

It works fine. here is the Log from a test I just carried out:

   718088 Monitor IPC:29F0 (U32) = 0x0
   718088 Monitor IPC:3340 (U32) = 0x0
...
   797914 Button changed: bRef=0, Joy=64, Btn=0, Pressed
   797914 [Buttons] 45=P64,0,Cx0D0066E0,x01
   797914 IPC Offsets Control: Ctrl=x0D00, Length=1, Offset=66E0, Param=x1
   797914 Monitor IPC:29F0 (U32) = 0x14000
   797914 Monitor IPC:3340 (U32) = 0x1
...
   987377 Button changed: bRef=0, Joy=64, Btn=0, Released
   987393 Monitor IPC:29F0 (U32) = 0x24000
   987393 Monitor IPC:3340 (U32) = 0x0

To have these log entries I used the Monitor on the right-hand side of the Logging tab, entering 29F0 as a U32 with Hex checked, and 3340 similarly, checking "Normal Log" below. I also enabled Button/Key logging on the left.

Then in another program, I wrote 0x00014000 to 29F0 with the result that Joy 63 Btn 0 triggered an assignment previously made in Buttons & Switches.

Of course, once the button was "pressed" in order to use it again it needs releasing, so I wrote 0x00024000 to do this. 

Note that the order in which these events are logged isn't necessarily exactly the order they occurred. The "monitoring" action is done by periodic scanning of the specified offsets, while button/key logging is done when it occurs.

The buttons & Switches tab will also show the virtual button when the press action is done. It won't show it when it is released, or if it doesn't change. That tab is looking only for changes from "off" to "on" or "released" to "pressed".

If you still can't make it work, please do the logging as above and show me.

Pete

 

 

 

 

Link to comment
Share on other sites

Thank you Pete for a quick reply

don't know what I just did differently to last night but now the button press is picked up in FSUIPC (and of course showing up in the logs).  I could swear I used the same values for press and release, but anything could have happened.  it was a long day.

Thanks again

Ran

Link to comment
Share on other sites

Hi Pete,

Just one last note.  I noticed that initiating a toggle action straight after another action (for example press and release) doesn't register unless I wait for 4 or 5 seconds.   (e.g.  setting 0x29F0 offset with the value or 0x00004000 on a press of a button for toggling button 0 on Joystick 64).

The logs show no change at 0x29F0 or 0x33F0, unless I wait few seconds before initiating the toggle action.  

 

regards - Ran

 

 

 

Link to comment
Share on other sites

1 hour ago, ranm said:

Just one last note.  I noticed that initiating a toggle action straight after another action (for example press and release) doesn't register unless I wait for 4 or 5 seconds.   (e.g.  setting 0x29F0 offset with the value or 0x00004000 on a press of a button for toggling button 0 on Joystick 64).

The logs show no change at 0x29F0 or 0x33F0, unless I wait few seconds before initiating the toggle action.  

That's not right. All offset writes are executed immediately. The monitor logging might not show it for perhaps half a second as it's polling the monitored offsets relatively infrequently, but absolutely nothing takes even a second, let alone 4 or 5!

The button action itself is also based on polling, and that is controlled by the  parameter PollInterval  parameter in the main [Buttons] section. That defaults to 25 (missiseconds) for 40 times a second, so there could a maximum of a  1/40th of a second before the button change is seen!

Enable ipc write logging as well as button logging and the Monitoring or those two offsets. Then show me the log for the whole sequence of press/release/toggle. And also please show me your code, AND the INI file.because you this doesn't make any sense.

Pete
 

 

Link to comment
Share on other sites

thanks for looking into this matter further Pete.

I realise that this is not right.  I am using Mobiflight to write the values in the offset based on buttons connected to an Arduino, and I cannot find the log file, though the Mobiflight console window shows the buttons being pressed.  attached are the FSUIPC logs and INI files.  I have three buttons programmed in Mobiflight as follows:

Button 1:  on press :  write 0x00014000 to 0x29F0;   on release :  write 0x00024000 to 0x29F0

Button 2:  on press :  write 0x00014001 to 0x29F0;   on release :  write 0x00024001 to 0x29F0

Button 3:  on press :  write 0x00004002 to 0x29F0;   on release :  do nothing

with the FSUIPC dialog open on the Buttons and Switches page, flicking between button 1 and 2 is instant - the button change shows up in the tab.  Getting a response to pressing button 3 is intermittent.     I may not be reading the log quite right, but it looks like while offset 0x29F0 is updated with the right value (0x00004002), the button press action isn't (I hops this make sense).  

the reason I am keen to get the Toggle working is so I could use this with encoders, and unlike for buttons, the Mobiflight app has no option for 'release' - just one action for 'press').  so at present I am using VJoy - but I would like to use the FSUIPC virtual joystick if I can.

again, apologies for not being able to find the Mobiflight log.  If you want to rule out Mobiflight I'll be happy to try another option for writing the offsets  if you can point me in the right direction.

thanks again for your help Pete, much appreciated.

 

Regards - Ran

 

PS. I have written down the sequence of buttons I pressed and results - I can send this to you to compare with the log file if this is any help

 

 

FSUIPC6.ini FSUIPC6.2 - Copy.log

Link to comment
Share on other sites

20 minutes ago, ranm said:

with the FSUIPC dialog open on the Buttons and Switches page, flicking between button 1 and 2 is instant - the button change shows up in the tab.  Getting a response to pressing button 3 is intermittent.     I may not be reading the log quite right, but it looks like while offset 0x29F0 is updated with the right value (0x00004002), the button press action isn't (I hops this make sense).  

You shouldn't be using the Assignments tab for testing your coding. That is ONLY looking for "off to on" or "released to pressed", and whilst it is open most other actions in FSUIPC are slowed or stopped. It is in no way suitable for seeing if your software works. Only use it to make your assignments!

The logs are therefore useless to show me anything, as they are entirely performed whilst within the dialogue!

Assign the virtual buttons to something which you can see or can log, THEN worry about timing if it is wrong.

Pete

 

Link to comment
Share on other sites

I have Pete, and I get the same experience.   To test  I mapped button 3 i.e. virtual joystick 64 button 2 to the ADF freq swap function and it only works sometimes.

I guess I'll stick to using VJoy if this works more reliable for me.

 

Regards - Ran

 

Link to comment
Share on other sites

36 minutes ago, ranm said:

here is the log with the dialog window closed

That's a huge log with little of relevance in it. I assume it's the toggling action only you are concened isn't fast enough?

The first such is here:

  1618297 WRITE0[17660]  29F0,   4 bytes: 02 40 00 00                                      .@..
  1618297 Button changed: bRef=0, Joy=64, Btn=2, Released


Because button 2 was pressed at the start of the log, this toggle released it - no action assigned.
The second toggle action sent pressed it, with immediate effect on the assigned action:

  1586344 Button changed: bRef=0, Joy=64, Btn=2, Pressed
  1586344 [Buttons] 38=P64,2,C66741,0
  1586344 FS Control Sent: Ctrl=66741, Param=0 ADF1_RADIO_SWAP

 
This sequence, with the action occurring immediately the offset is written is the same throughout, as far as I had the patience to search. If you can find one where it failed to obey the press, or took 3-4 sdeconds to do so, please do point it out to me!

As far as I can see, there is no problem. it is doing exactly what it is supposed to do!

If you are simply saying that the offsets are not being written to fast enough, then that will be down to what is sending them.

The log shows other virtual buttons being pressed, -- including one with Repeats enabled and assign to send a keystroke to the sim. I see the repeats building up ad causing quite a queue of keypresses to amount. That won't do any good to Sim performance -- each keypress is another message in its Message Queue.

If you are trying to prove a problem with the toggle action, please ONLY send the toggle action request!

Incidentally, if you are planning on using the type of encoder which alternately sends "press", "release" as you turn it, it is normal to assign the same action to both press and release, That way it operates twice as fast.

Pete

 

 

Link to comment
Share on other sites

Ah - I assumed wrongly that a toggle is a press and release action - my bad.   I understand now that this is just a change from a previous state.

my challenge is that the mobiflight app that I am using only assigns action on an encoder set, and not on release.  I was hoping that the toggle action will be translated as a press+release.  

And the repeats you see in the log are probably due to a noisy hardware button - thanks for tip re-performance, I will check it out.   (I need the repeat to simulate a press and hold, and I have to use a key press via an LUA script as the stupid GTN750 gauge I am using doesn't respond to virtual joystick button presses directly - a long story).

thanks for your time helping me with this  - I can take it from here.

Regards - Ran

 

  

Link to comment
Share on other sites

34 minutes ago, ranm said:

Ah - I assumed wrongly that a toggle is a press and release action - my bad.   I understand now that this is just a change from a previous state.

Ah, I see! Oops. 

"Toggle" (in all of its uses in FS I think) means "on-if-off" or "off-if-on" not "on-then-a-little-later-off", perhaps emulating a key press or a momentary button. That's the way the term is used in all of the FS controls called "Toggle", like SOUND TOGGLE, SLEW TOGGLE,  PAUSE TOGGLE,  GEAR TOGGLE,  TOGGLE MASTER BATTERY, TOGGLE NAV LIGHTS, TOGGLE PUSHBACK, etc etc.

To do "press then release" means sending two commands as you were doing for buttons  0 and 1, with a delay between them for them to be seen, just like real keypresses or button presses. The delay might need only be 20 mSecs or do, but 50 mSecs to be on the safe side (corresponding to the typical keyboard 20 per sec repeat rate).

34 minutes ago, ranm said:

And the repeats you see in the log are probably due to a noisy hardware button

They were automatic repeats based on the button staying pressed and the "repeat" option set in the "Buttons & Switches" assignment.  FSUIPC provides this for buttons to emulate the keypress repeats when you hold a key down. (Windows operates that for keypresses).

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.