Jump to content
The simFlight Network Forums

Recommended Posts

Posted

If I understand things correctly, offset 3BF8 is used for determining the number of flap positions on a given aircraft. (For example, the default C172 would return a value of 4).

In looking at all the different offsets available, I understand that there are a variety of ways to get the different values, angles, etc. of flaps.

As the program I am writing in C# is to be used across multiple flight simulator platforms, trying to read the different degrees of flaps from each flight sim platform could be problematic.

How can I go about simply getting the current flaps detent value of an aircraft?

Once I have that value, I can manage the degrees of flaps, etc. from my aircraft database that contains these values?

Regards,
Marc

Posted

Hi,

just check offset 3BFA that will give you exactly what you are asking for.

3BFA, 2 
Flaps détente increment. The full range of flap movement is 0–
0x3FFF (16383). Each détente position or “notch” is spaced
equally over this range, no matter what flap angle is
represented—a table in the AIR file gives those. To obtain the
number of détentes, divide this increment value into 16383 and
add 1. For example 2047 (0x7FF) would be the increment for 9
positions.

Thomas

Posted

The flaps handle index 0BFC, works great and will use it for FSX & P3D.Unfortunately this offset will not work in FS9.

Any ideas on the logic to get handle indexes for FS9?

Posted

Hi,

as I said you can use Offset 0x3BFA. For the standard Cessna in FS you will read value 5461.

'To obtain the number of détentes, divide this increment value into 16383 and add 1.'

16383 / 5461 = 3 +1 = 4 detent

This works with FSUIPC and FSUIPC4, the layer Offset 0x0BFC in FSUIPC4 only.

Thomas

Posted

Hi Thomas,

Got that part no problem. My apologies, in reading back my previous post I was not very clear. (Too many hours in front of a keyboard, I guess).

I have the number of total detentes, but was looking for away to get the same results as 0BFC , but in FS9 meaning:

Flaps Up value would be 0, Flaps 10  value would be 1, Flaps 20 = value would be 2, Flaps 30 value would be 3, etc.

This way I can easily get the corresponding degrees of flaps from my aircraft database.

I am getting Flaps 0  value = 0, Flaps 1 value = 1, Flaps 2 value = 3, Flaps 3 value =3

Offset<short> FSUIPCDetentes = new Offset<short>("FSUIPCDetentes", 0x3BFA); //Number of flap positions (NOT Including Full Up).
Offset<int> FSUIPCAircraftDetente = new Offset<int>("FSUIPCAircraftDetente", 0x0BDC); //Current aircraft detente.

int intDetentes; //Total number of flap positions +1 (to include full up).
int intAircraftDetente; //Current aircraft detente from FSUIPC.

//Get total number of flap positions including full up.
intDetentes = (16383 / FSUIPCDetentes.Value) +1;

//Curent aircraft detente handle.
intAircraftDetente = intDetentes - (16383 / FSUIPCAircraftDetente.Value);

This is driving me crazy as it is the last thing I need to get working as far as data from FSUIPC in my ACARS program.

Any assistance suggestions or other offsets I can maybe try (although, I think I have been through them all) would be greatly appreciated.

Regards,

Posted

I figured out how to get the handle like in 0BFC.

I will post the final code I used in case someone else needs it in the future, in the next day or so.

Regards,

 

 

Posted
1 hour ago, CXA001 said:

I figured out how to get the handle like in 0BFC.

I will post the final code I used in case someone else needs it in the future, in the next day or so.

Thanks! Could you post it as a new item in the User Contributions sub-forum, please? It won't get lost then! ;-)

Pete

 

Posted

I spoke to soon...

My code worked great with the default C172, but when I loaded the default FS9 737-400 most handles which I was trying to get work.

Back to the drawing board. :(

Marc

Posted

This line might be your problem:

intAircraftDetente = intDetentes - (16383 / FSUIPCAircraftDetente.Value);

You are doing a division with all integers so any decimal places are going to be lost.

Trying doing the maths as doubles likes this to get a more accurate answer:

intAircraftDetente = (int)((double)intDetentes - (16383d / (double)FSUIPCAircraftDetente.Value));

 

Paul

Posted

I realized that last night and switched to doubles.

Did some more changes last night and I think I finally have the answer, but more testing is required on my part to be sure.

Will advise.

Marc

Posted

For 0BFC, 1, Flaps handle index (0 full up) I need to read how many bytes from it. I have tried different values, but I am getting weird numbers.

Regards,

Marc

Posted

As it clearly says, it is one byte! The next byte (0BFD) is an anti-skid brake active flag. Please refer to the offsets list!

It is a new value for FSX and P3D. It wasn't populated by FSUIPC before FSX. I thought you were working with FS9 now? THat location could contain anything in FS9, I wouldn't know.

Pete

 

Posted

I am working with FS9, but came up with a bug in FSX/P3D.

For whatever reason, I always have issues working with Bytes & BitConverters and I can never get the values I need.

Offset<byte[]> FSUIPCHandle = new Offset<byte[]>("FSUIPCHandle", 0x0BFC, 2); //Flaps handle for FSX, P3D.
  
//Get data from FSUPIC
FSUIPCConnection.Process(new string[] { "FSUIPCHandle" }); 
  
labelCurrentHandle.Text = BitConverter.ToString(FSUIPCHandle.Value, 1);

This is running in a timer that runs every 1 second and I always get a value of 1.

I can confirm that there is not value for this in FS9.

Sorry for the trouble,

Marc

Posted

This should be:

labelCurrentHandle.Text = BitConverter.ToString(FSUIPCHandle.Value, 0);

You are getting 2 bytes back from 0x0BFC (not sure why), but you only need the first one so that would be index 0. 1 is the second byte 0x0BFD.

It would be easier to just declare the offset as a byte then there's no need to do any bit conversion.

Offset<byte> FSUIPCHandle = new Offset<byte>("FSUIPCHandle", 0x0BFC); //Flaps handle for FSX, P3D.

Paul

  • 4 weeks later...
Posted

Private Function Get_Flaps_Position()
        If SIM = "FSX" Or SIM = "P3D" Then
            Return (flapsindex.Value)
        Else
            Return (Int(flapsvalue.Value) / Int(flapsincrement.Value))
        End If
    End Function

Posted

Dim flapsincrement As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H3BFA)

Dim flapsindex As Offset(Of Byte) = New FSUIPC.Offset(Of Byte)(&HBFC) ' FSX

Dim flapsvalue As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&HBDC)

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.