rigidigital Posted July 12, 2007 Report Posted July 12, 2007 Hi, for reasons of misplacement I think I am going to load up MSFS98 to try out some experiment. I will need to buy a newer version, I tried FSX sometime ago and thought it pretty woefull on my new PC. will the method below work with FS98(which I still have). I want to read pitch and bank for the moment. Will the values be the same(offsets , i think) for 98 and 2004 ? result = fsuipc.FSUIPC_Read(dwOffset, dwSize, ref token, ref dwResult); regards, Michael. Actually I had to edit, I don't think as a 1st Poster I should be trying to qualify my statement using 'new PC' or having a go at any product. My guess is those using FSX would not think much of my PC anyhow :) but if you can help, I dont even know what the offset i need is yet, too busy just downloaded the new Dot Net dll client and docs.
Pete Dowson Posted July 12, 2007 Report Posted July 12, 2007 will the method below work with FS98(which I still have). I want to read pitch and bank for the moment. Will the values be the same(offsets , i think) for 98 and 2004 ? result = fsuipc.FSUIPC_Read(dwOffset, dwSize, ref token, ref dwResult); I replied to your post about this in the AVSIM Simconnect forum, as follows: I would like to ask if using the fsuipc sdk, dll is thesame for MSFS98 as it is for FS2002/2004 ? Yes, but only a small subset of facilities are available. I wish to get the bank , and pitch (for a start) using the method result = fsuipc.FSUIPC_Read(dwOffset, dwSize, ref token, ref dwResult); Should be okay. Try it. The "official" interface for FS98 was actually FS6IPC. I developed FSUIPC for FS2000 and made it work in its basic form (as an interface to FS variables) in FS98 just to make sure I had the same things -- i.e. that it was compatible. So, if you have trouble with the later, much more developed FSUIPC versions, see if you can find FS6IPC. (The interface is the same). Regards Pete
rigidigital Posted July 13, 2007 Author Report Posted July 13, 2007 I am getting some numbers that dont quite look right. Offset pitch = new Offset(0x0578); double thePitch = ((long)pitch.Value; even on taxi going left and right I get big numbers negative and positive. pitching up on stall 20427319324205325 sitting on runway 4249380562 not sure how to determine datatype for an Offset ? Below this probably means I am needing to get up to speed with C#... the code below generates compile errors, for "divide by zero" or buffer overun ? double thePitch = ((long)pitch.Value * 360 /(65536 * 65536));
Pete Dowson Posted July 13, 2007 Report Posted July 13, 2007 I am getting some numbers that dont quite look right. Offset pitch = new Offset(0x0578); double thePitch = ((long)pitch.Value; even on taxi going left and right I get big numbers negative and positive. pitching up on stall 20427319324205325 sitting on runway 4249380562 not sure how to determine datatype for an Offset ? The type is specified in the Programmers guide. It is part of the description. Try using FSInterrogate which will give you real-time updating values to view in an asortment of formats. Below this probably means I am needing to get up to speed with C#...the code below generates compile errors, for "divide by zero" or buffer overun ? double thePitch = ((long)pitch.Value * 360 /(65536 * 65536)); I'm not surprised -- 65536 * 65536 is one more than the maximum that can be accommodated in a 32 bit unsigned value, let alone signed. You need put the original value into floating point form first THEN do your calculations. Obviously for accurate angles an integral value (in degrees!) in not much use! Pete
Paul Henty Posted July 13, 2007 Report Posted July 13, 2007 Offset pitch = new Offset(0x0578);double thePitch = ((long)pitch.Value; not sure how to determine datatype for an Offset ? Offset 0x0578 is marked as 4 bytes in the fsuipc programmers docs. You need to declare your offset as a 4 byte integer - 'int' in C#. A C# long is 8 bytes so at the moment you're also reading the Bank angle into the same variable. The user guide that came with the .NET client dll has section called "Registering your interest in an Offset" which explains what .NET type to use given the types and lengths specified in the programmer's doc. double thePitch = ((long)pitch.Value * 360 /(65536 * 65536)); You're casting is a bit wrong here. You need to cast the pitch into a double not a long. Also you should mark the literals as double type literals as well or the compiler will treat them as ints or longs. double thePitch = ((double)pitch.Value) * 360d / (65535d * 65535d); Paul
rigidigital Posted July 16, 2007 Author Report Posted July 16, 2007 Your help was great. I'll go and do some more research, where you've suggested! for now this works well and makes a lot more sense. pitch is declared as an int in the Offset. long thePitch = (long)(((((double)pitch.Value) * 360d) / 65536d) / 65536d); this.textBox1.Text = thePitch.ToString(); My casting there is still a bit wrong due to me not looking, but it is good. Staying within nice easy double digits. I tried doing a loop de loop, to see what would happen but I was in a Cessna 182 :) thx both.
rigidigital Posted October 28, 2007 Author Report Posted October 28, 2007 Pete, Ive had a great time playing with your module and extracting data and writing my own C# code. I just got back from the Expo at the Gold Coast. It was fantastic. There were no motion base platforms but I found the experience of a decent cockpit does not require a motion base :) regards, Mike.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now