Jump to content
The simFlight Network Forums

Switching customer views


Alpin-Flier

Recommended Posts

Hi John

I have nearly finished installing MSFS to my B737-800 homepit. Many issues could be solved thanks to FSUIPC7 😊.  But since a day I am squeezing my brain to solve the following problem. Perhaps I don't see the wood for the trees any more... Tried to find the solution in the normal and the advanced user guide without success.

I want to switch the visual between two modes: Captain and 1.Off view. They are defined with MSFS customer views on ALT-1 and ALT-2 and then selected via the keyboard. Then I have programmed two buttons in FSUIPC to send these key presses, all working fine. But now I should trigger the view selection from an external program, that can write to FSUIPC offsets. But how can I link two free offsets in FSUIPC, that will trigger the key commands at changes?

Your help would be most welcome. Best regards

Urs Meyer

 

Link to comment
Share on other sites

To send key presses via offsets, you can either use the keysend offset at 0x3200, or the general control offset at 0x3110 using the FSUIPC keysend control 1070 (press and release). See the offset status document for offset use, and the Advanced User guide for details on using the key send controls and the parameters (virtual key codes) needed.

John

Link to comment
Share on other sites

Hi John

Sorry to get back to you, but I am still in trouble. I tried a lot but without success. The only thing I get working is the control via buttons. The working button definitions in the .ini file are:

1=PB,14,K49,24     -{Key press: lalt+1}-
2=PB,15,K50,24     -{Key press: lalt+2}-

When I look to the log-file I can see some actions, somehow cryptic:

  1485500 Button changed: bRef=0, Joy=1 (B), Btn=14, Pressed
  1485500 [Buttons] 10=PB,14,K49,24
  1485500 SendKeyToFS(00010031=[lalt+1], KEYDOWN) ctr=0
  1485516 Sending WM_KEYDOWN, Key=164 (LAlt) (Scan code 56), Ctr=4
  1485531 Sending WM_KEYDOWN, Key=49 (Scan code 2), Ctr=3
  1485547 Ignoring EV_KEYDOWN received as was sent to FS: 0x31 (1)
  1485547 Sending WM_KEYUP, Key=49 (Scan code 2), Ctr=2
  1485578 Sending WM_KEYUP, Key=164 (LAlt) (Scan code 56), Ctr=1
  1485625 Button changed: bRef=0, Joy=1 (B), Btn=14, Released
  1485625 [Buttons] 10=PB,14,K49,24

  1486609 Button changed: bRef=0, Joy=1 (B), Btn=15, Pressed
  1486609 [Buttons] 11=PB,15,K50,24
  1486609 SendKeyToFS(00010032=[lalt+2], KEYDOWN) ctr=0
  1486625 Sending WM_KEYDOWN, Key=164 (LAlt) (Scan code 56), Ctr=4
  1486641 Sending WM_KEYDOWN, Key=50 (Scan code 3), Ctr=3
  1486641 Ignoring EV_KEYDOWN received as was sent to FS: 0x32 (2)
  1486656 Sending WM_KEYUP, Key=50 (Scan code 3), Ctr=2
  1486672 Sending WM_KEYUP, Key=164 (LAlt) (Scan code 56), Ctr=1
  1486734 Button changed: bRef=0, Joy=1 (B), Btn=15, Released
  1486734 [Buttons] 11=PB,15,K50,24

But I still don't know how to achieve the same result by filling offsets with controls and parameters. I tried to fill x3200, x3204 and x3208 with 1070, 49 and 24 in different ways. Then I tried to write 1070 to x3110, but I didn't know how the parameters 49 and 24 should be filled in x3114.

Please, please let me know the correct procedure. Many thanks in advance.

Best regards
Urs Meyer

 

Link to comment
Share on other sites

9 minutes ago, Alpin-Flier said:

I tried to fill x3200, x3204 and x3208 with 1070, 49 and 24 in different ways.

They are not the correct parameters - as it says in the documentation, the message (0x3200 4 bytes) is WM_KEYDOWN or WM_KEYUP which are 256 and 257 respectfully. You can see the parameter to use in the log message. Using this offset you would have to send both a WM_KEYDOWN and WM_KEYUP message to get a key press and release, as well as sending the Alt key separately (i.e. 4 messages in total), so maybe better/easier to use offset 0x3110.

16 minutes ago, Alpin-Flier said:

Then I tried to write 1070 to x3110, but I didn't know how the parameters 49 and 24 should be filled in x3114.

As specified in the documentation:

Quote

1070 Key Press and Release (param is Keycode + Shift code (i.e. enter with + symbol, not calculate), or JsBk)

Unfortunately it seems I removed the text that shows you how to calculate the actual parameter if using offsets. The parameter is keycode+256*shift code, So for lalt +1 (49 + 24), it would be 49 +256*24 = 6193. Alternatively, also 49+256*16 = 4145 (as 8 is the shift code for a normal key and can be ignored).
Note that lalt and tab shift codes are switched for key press assignments, and I am not sure which mapping the 1070 control uses. If it uses the key assignments shift codes, it would be 49+256*4 = 1073.

So, first try with parameters 4145 and 4146 (or 6193 and 6194), and if those don't work try 1073 and 1074.

Remember to write the parameter to offset 0x3114 before writing 1070 to 0x3110.

John

Link to comment
Share on other sites

Hi John

Thank you so much for these infos. I can understand the mechanism much better now. For testing I use two buttons again, defined as follows (3 and 4 only for comparison):

[Buttons]
PollInterval=25
ButtonRepeat=20,10
1=PB,4,C65604,0     -{THROTTLE_CUT}-
2=RB,5,C65602,0     -{THROTTLE_DECR}-
3=PB,14,K49,24     -{Key press: lalt+1}-
4=PB,15,K50,24     -{Key press: lalt+2}-
5=PB,18,C78100,4145     -{Custom control: <78100>}-
6=PB,18,C78096,1070     -{Custom control: <78096>}-
7=PB,19,C78100,4146     -{Custom control: <78100>}-
8=PB,19,C78096,1070     -{Custom control: <78096>}-

I tried with all three parameter pairs you proposed, but there is no reaction at all. Is my test arrangement faulty?

Urs

Link to comment
Share on other sites

2 hours ago, Alpin-Flier said:

5=PB,18,C78100,4145     -{Custom control: <78100>}-
6=PB,18,C78096,1070     -{Custom control: <78096>}-
7=PB,19,C78100,4146     -{Custom control: <78100>}-
8=PB,19,C78096,1070     -{Custom control: <78096>}-

What is this?
If you want to test by using buttons to write to offsets, you need to use the Offset DWord Set control, and if you set the parameter offset on press, and set the control number 1070 on release, it should look like this:

5=RB,18,Cx03003114,x00001031 	-{offset dword set, offset 3114}-
6=UB,18,Cx03003110,x0000042E 	-{offset dword set, offset 3110}-
7=RB,19,Cx03003114,x00001032 	-{offset dword set, offset 3114}-
8=UB,19,Cx03003110,x0000042E 	-{offset dword set, offset 3110}-

John

Link to comment
Share on other sites

1 hour ago, John Dowson said:

If you want to test by using buttons to write to offsets, you need to use the Offset DWord Set control, and if you set the parameter offset on press, and set the control number 1070 on release, it should look like this:

5=RB,18,Cx03003114,x00001031 	-{offset dword set, offset 3114}-
6=UB,18,Cx03003110,x0000042E 	-{offset dword set, offset 3110}-
7=RB,19,Cx03003114,x00001032 	-{offset dword set, offset 3114}-
8=UB,19,Cx03003110,x0000042E 	-{offset dword set, offset 3110}-

I've tested that here now and that works - sending lalt+1 on button press (& release) of B.18 and lalt+2 on B.19, using the facilities provided at offset 0x3110.

John

Link to comment
Share on other sites

  • 1 month later...

Hi John

I have some issue with the "Key Press & Release" command. To select a customer view in MSFS, I use keys ALT-1 and ALT-2 as given in MSFS. To operate these keys from an external program I would like to use

  WriteFSUIPC($3114,4,4145);       // Select Captain camera, ALT+1
  WriteFSUIPC($3110,4,1070);       // Push & Release key  

and

  WriteFSUIPC($3114,4,4146);       // Select Copis camera, ALT+2
  WriteFSUIPC($3110,4,1070);       // Push & Release key  

Unfortunately this doesn't work reliable. Sometimes the command is recognised, sometimes not. Could this be a timing problem? Perhaps MSFS does not read the press command before it disappears by the release command. Can this time be influenced somewhere, i.e. make the time between press and release longer? By the way, as a workaround, when I separate press and release commands by using 1071 and 1072, it's ok.

Thanks for info, all the best for the new year and best regards
Urs

Link to comment
Share on other sites

Logging of Buttons & Keys would help to confirm the key press/releases are being sent, as well as maybe IPC Writes...

With the key press and release control (1070), the release is sent directly after the press, with no delay. It has been this way since inception, so I do not want to introduce an artificial delay between the press and release, especially without confirming this is indeed the problem, i.e. with appropriate logging showing the press/release is actually being sent and the time difference between them. I could add a delay maybe based upon a new ini parameter, but would rather not - this is why separate pres and release controls are provided after all.

On 12/30/2022 at 10:13 AM, Alpin-Flier said:

By the way, as a workaround, when I separate press and release commands by using 1071 and 1072, it's ok.

Then just do this!

On 12/30/2022 at 10:13 AM, Alpin-Flier said:

Thanks for info, all the best for the new year and best regards

And best wishes for the New Year to you - regards,

John

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.