Jump to content
The simFlight Network Forums

Reading the event


Dominik

Recommended Posts

Hello, using Visual Basic 6 I can write events into MFS2020, e.g.

this is what fsuipc does

   442906 *** EVENT: Cntrl= 68066 (0x000109e2), Param= 1 (0x00000001) SPEED_SLOT_INDEX_SET

and that's what Visual Basic does

Dim fff As Long
fff = 1
Call FSUIPC_Write(&H3114, 4, VarPtr(fff), dwResult)
Call FSUIPC_Write(&H3110, 4, VarPtr(68066), dwResult)

no offset (unless i'm wrong)  SPEED_SLOT_INDEX_SET, is there any way to read the parameter of this event (SPEED_SLOT_INDEX_SET) using VB6?

I want to know what mode is set to speed, managed or selected.

Link to comment
Share on other sites

SPEED_SLOT_INDEX_SET is a control/event, not a data value stored in an offset. The FSUIPC log entry is just logging that this event was received. There is no way to read the parameter of this event via the SDK.
But really, is that what you want to do? This (undocumented) control alters the FCU authority, so what you probably want to read is where the actual authority of the FCU lies. Not sure where thats held (if at all!)- if there is a sim variable for this then I could add that to the offset area for you to read - if you let me know what it is!

John

 

Link to comment
Share on other sites

15 minutes ago, Dominik said:

I cannot find the offsets responsible for heading, altitude (in the managed or selected mode)

For the altitude, try offsets 0x0818 (AUTOPILOT ALTITUDE LOCK VAR:3) and/or 0x07D4 (AUTOPILOT ALTITUDE LOCK VAR).
For heading, try 0x07CC (AUTOPILOT HEADING LOCK DIR). 

Link to comment
Share on other sites

14 hours ago, Dominik said:

These are the autopilot values, not the autopilot mode

But did you not look? There are offsets for the values and, separately the mode switches/buttons. Here:

07BC Autopilot Master switch
07C0 Autopilot wing leveller
07C4 Autopilot NAV1 lock
07C8 Autopilot heading lock
07D0 Autopilot altitude lock
07D8 Autopilot attitude hold
07DC Autopilot airspeed hold
07E4 Autopilot mach hold
07EC Autopilot vertical speed hold
07F4 Autopilot RPM (N1) hold
07FC Autopilot GlideSlope hold
0800 Autopilot Approach hold.
0804 Autopilot Back course hold. 


Pete

 

Link to comment
Share on other sites

15 hours ago, Dominik said:

These are the autopilot values, not the autopilot mode - managed or selected

As I said, I am not sure where this is held. However, just looked at the SDK documentation, and there are the following sim variables (although they are not documented as being available via SimConnect:

AUTOPILOT ALTITUDE SLOT INDEX Index of the managed references Number TYPE_UINT32 N -
 
AUTOPILOT HEADING SLOT INDEX Index of the managed references Number TYPE_UINT32 N


I can try requesting these to see if available and add them to a spare offset.
I'll check if these are available in the next day or so and let you know.

John

Link to comment
Share on other sites

Can you try the attached version, v7.0.4b, where I have added the following offsets:
    0x0290 4Bytes AUTOPILOT ALTITUDE SLOT INDEX
     0x0294 4Bytes AUTOPILOT HEADING SLOT INDEX

    0x0298 1 Byte APU SWITCH

Thanks,

John

FSUIPC7.exe

P.S. The offsets are read-only. I could make the slot index ones writeable by using the associated controls when written to if needed.  

Edited by John Dowson
PS added
Link to comment
Share on other sites

3 hours ago, John Dowson said:

Can you try the attached version, v7.0.4b, where I have added the following offsets:
    0x0290 4Bytes AUTOPILOT ALTITUDE SLOT INDEX
     0x0294 4Bytes AUTOPILOT HEADING SLOT INDEX

    0x0298 1 Byte APU SWITCH

0290 - works well, result 1 or 2

0294 - works but you need   / 65536   to get a result 1 or 2

0298 - works after pressing the button APU Start - result 1, APU off - result 0

It would be great if you could write these offsets, not only read. How would you find the SPEED_SLOT_INDEX_SET offset, it would be great x2

Dominik.

Link to comment
Share on other sites

16 minutes ago, Dominik said:

How would you find the SPEED_SLOT_INDEX_SET offset, it would be great x2

Sure, I can also add that.

16 minutes ago, Dominik said:

0294 - works but you need   / 65536   to get a result 1 or 2

Ok, but rather strange. I can do that before the offset is populated.

17 minutes ago, Dominik said:

It would be great if you could write these offsets,

Ok, I can look into that as well, but may take a few days. I'll do it for the 3 slot index offsets (altitude, heading and speed), but not the APU switch offset.

John

Link to comment
Share on other sites

21 hours ago, Dominik said:

0294 - works but you need   / 65536   to get a result 1 or 2

Can you check that again please - I get 1 or 2 in that offset directly...

In the attached version, v7.0.5c, you have (note the offset changes!):
     0x0290 4Bytes AUTOPILOT ALTITUDE SLOT INDEX Read/Write
     0x0294 4Bytes AUTOPILOT HEADING SLOT INDEX Read/Write

     0x0298 4Bytes AUTOPILOT SPEED SLOT INDEX Read/Write
    0x029D 1 Byte APU SWITCH Read Only

FSUIPC7.exe

21 hours ago, Dominik said:

0298 - works after pressing the button APU Start

Do you know if there a control/event I can use for this? If so, I can make 0x029D also writable.
I've previously read that its tricky to do this, but some have had success with lua. e.g. from here
 

Quote

Even so, I managed to get working (with many “tricks”) the following controls:

  • landing lights (only one)
  • beacon lights
  • cross feed valve and annunciator
  • apu starter % (has to be set repeatedly to 100% - I use SIOC or lua for this)
  • apu stop
  • apu rpm indicator (with stepper motor controlled by MobiFlight)
  • apu bleed and annunciator
  • apu generator
  • generator 1 a/b and generator 2 a/b and gen off bus annunciators
  • generator 1 and 2 source off (when gen switch on and engine is not running)
  • fuel pumps and Low press annunciators (partly faked)
  • hyd pumps and annunciators (faked with fsuipc free offsets for the moment)
  • yaw damper (AP yaw damper and annunciator - sometimes disconnecting by itself)
  • battery switch (not always working as expected but responding)

John

 

Link to comment
Share on other sites

Autopilot offsets are working properly. You can write and read the values 1 and 2. Unfortunately the autopilot itself does not work properly, it seems to me that these offsets are responsible for the "dots" on the autopilot display and something else. If the plane climbs to the set altitude and we lower the autopilot altitude and write AUTOPILOT ALTITUDE SLOT INDEX value 2, the plane will not start descending. But if you press the cockpit switch that write the value 2 for AUTOPILOT ALTITUDE SLOT INDEX, the plane begins to descend. The button in the cockpit has to execute some other event.

0x029D 1 Byte APU SWITCH - works value 0,1

4 hours ago, John Dowson said:

Do you know if there a control/event I can use for this? If so, I can make 0x029D also writable.

I have no idea, now I'm trying to start the autopilot via VB

Dominik.

Link to comment
Share on other sites

@Dominik

17 hours ago, Dominik said:

Autopilot offsets are working properly. You can write and read the values 1 and 2. Unfortunately the autopilot itself does not work properly, it seems to me that these offsets are responsible for the "dots" on the autopilot display and something else. If the plane climbs to the set altitude and we lower the autopilot altitude and write AUTOPILOT ALTITUDE SLOT INDEX value 2, the plane will not start descending. But if you press the cockpit switch that write the value 2 for AUTOPILOT ALTITUDE SLOT INDEX, the plane begins to descend.

Sorry, I was sending the wrong event on write - I was sending the ALTITUDE SLOT INDEX control, rather than the AP ALTITUDE_SLOT_INDEX one (and similar for the others). I've changed to send the AP ones in the attached version, v7.0.5d, if you would like to try:

 

But I'm not sure on the difference between these controls, so please try the updated version and let me know.

John

Later... No, sorry - that won't work. The AP versions of those controls are not recognized by SimConnect - or weren't ptrviously.
I'll re-activate them to see if available...

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.