daniedelport
-
Posts
11 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Downloads
Posts posted by daniedelport
-
-
Pete
You are clearly misunderstanding me unfortunately. The writing and reading to and from offsets is, as you put it, a doodle.
The only problem I have and persistently plagues me is that the true heading I am writing moves my aircraft incorrectly. The coordinates and altitudes are fine and I only read the magnetic variation after the plane is moved. Ill just play with it a bit more.
MagVar of +20, not -20 I assume you mean? There's 40 degrees difference!Why bother with a programming language to show simple arithmetic?
Thats why I typed 20 and not -20.
Thanks for the interesting way you answer my questions.
Regards
-
Pete
Still no luck. I have tried it a thousand different ways.
In fact, unless you need the separate values, you don't need to do it separately at all. It all simplifies out quite well. Just add the two (when converting MAG to TRUE) or subtract MagVar from Heading (TRUE to MAG) no matter whether either are currently in the correct range, THEN normalise the result by adding or subtracting 360 till in rangeThis I got thanks Pete. Works fine when reading from FS BUT . . .
If you have a magnetic heading of say 100deg and a magn variation of say 20deg, how would you Write it to 0580. Code in C will be fine. The mathematics will be the same.
-
This topic has been discussed on this forum but I have difficulty writing a heading to FS. (First converting my Magnetic heading to true.)
My code that works 100% in converting the heading is as follows:
(Where hdg and magv were read from FS, as heading and magnetic variation respectively.)
magv = Round((magv * 360#) / 65536#, 1) magv = 360 - magv hdg = Round(((hdg * 360#) / (65536# * 65536#)), 1) hdg = hdg + magv If hdg < 0 Then hdg = 360 + hdg ElseIf hdg = 0 Then hdg = 360 ElseIf hdg > 360 Then hdg = hdg - 360 End If
In Writng the heading I do as follows:
Dim FS_Head As Long magv = (magv * 360#) / 65536# magv = 360 - magv FS_Head = txtHead.Text - magv FS_Head = (FS_Head * 65536# * 65536#) / 360# Call FSUIPC_Write(&H580, 4, VarPtr(FS_Head), dwResult) Call FSUIPC_Process(dwResult)
Long is 4 Byte integer in VB.
txthead is a text box with my magnetic heading I want.
My problem comes in at converting the magnetic to true.
Please help
-
Thanks Pete
I did not think it to be this simple. Understands it perfectly.
Also just bear in mind that for some of the FSUIPC users programming is a hobby and a lot of the stuff is fairly hazy for us, especially if English is a third or fourth language. I am a poultry farmer, which explains a lot probably.
Thanks again for the help.
-
Pete
Yes, I am writing certain values to open/unused offsets I have identified from 0x3210 onwards. It is for Hot key logging purposes.
I can easily write single key presse like Z etc. but the combinations like in my post is a bit unclear. My application is in VB so perhaps one of the VB boffins out there can also help.
Also how do I know when the GPS window is displayed? Is this possible without normal windows API's and purely with FSUIPC?
Thanks
-
What value do I need to use for Shift+Z to write as a Hot Key?? Should be fairly simple for most of you.
Thanks you very much.
-
Pete
I obviously saw that but in VB I am unfimiliar how to add a Special build description field to the version info dialog, with the key as the value.
This seems a VB specific problem. I cannot get a read instruction to work let alone a write one.
-
I am defnately missing something huge.
Why does all my read commands return zero to some of the basic ofsets. Is it something to do with my reg key or what. I do not think so.
What does the varPtr() function mean?
Am I correct in asuming that the data type I need to use must corelate to its size. E.g. if I need to read e.g. Ground altitude at 0020 then I would use a Long data type in VB which is 4 bytes long??
Offset 3C00 which I presume is a string, what VB data type should I use? String does not seem to work.
Thanks for all the help.
-
How do I incorporate the reg key in my VB application to be written automatically to FSUIPC?
-
I have a VB program that needs to determine if FSNAv is active, or if the FSNav screen is beiing shown.
I use FSConnect to interogate FSim.
Thanks
FSUIPC_Write heading
in FSUIPC Support Pete Dowson Modules
Posted
For Sure.
Let's start all over, Pete. I hope for the last time.
All I do is the following:
1. Pause FSIM.
2. Write the Position of the plane (Lat, Lon, Altitude, Pitch, Bank angle) to FSUIPC. (The plane now moves to its new location.)
3. Read Magnetic Variation. (magv)
4. Compute True heading by adding the Magnetic Heading I want, to the Magnetic Variation we just Read above in step 3. (Is the Magnetic variation of my new position (I wrote in step 2) not different than at the "old" position of my plane it was in before I moved in it in step 2?)
5. Write the True Heading to FSUIPC.
6. Finish
I hope that my English, which is not my First language, is understandable.
Clearly the mistake I make is somewhere in converting my Mangnetic Heading to True.
(An interesting thing I saw is that if I write the Pitch angle before the Altitude gets written the Pitch changes significantly. Perhaps this can help someone. It makes sense.)
Perhaps there is a order to write the Position parameters? (Lat, Lon, Alt, Heading, Pitch, Bank angle.)