Jump to content
The simFlight Network Forums

Paul Henty

Members
  • Posts

    1,724
  • Joined

  • Days Won

    77

Everything posted by Paul Henty

  1. It's writing the entire 24 bytes (all six floats) in one go, starting at 0x86A0. So it's being written last in the sense that it's the only write taking place. Testing it here I get movement, but not it's not subtle and any value over 0 seem to have the same effect. For example, any value but 0 in the heading places me looking at the back of the pilot's seat (e.g. 180 degrees). Any value over 0 in bank puts me upside down (e.g. 180 degrees). Any value over 0 in deltax (e.g. 0.01) puts me to the right but so far outside the plane I'm no longer in the airport. I also tested this writing each float individually as in Pete's Lua with the same results. Here is the write log from FSUIPC for the same values used in the Lua script: 24 Bytes at once... 2217000 WRITE0[8832] 86A0, 24 bytes: 00 00 00 3F A4 70 BD BE D7 A3 F0 BE 00 00 50 42 ...?.p........PB 2217000 00 00 00 00 00 00 00 00 ........ Individual floats... 2218422 WRITE0[8832] 86A4, 4 bytes: A4 70 BD BE .p.. 2218422 WRITE0[8832] 86A8, 4 bytes: D7 A3 F0 BE .... 2218422 WRITE0[8832] 86AC, 4 bytes: 00 00 50 42 ..PB 2218422 WRITE0[8832] 86B0, 4 bytes: 00 00 00 00 .... 2218422 WRITE0[8832] 86B4, 4 bytes: 00 00 00 00 .... 2218422 WRITE0[8832] 86A0, 4 bytes: 00 00 00 3F ...? Paul
  2. The code looks fine. Most likely then is that you're still referencing an old version of the DLL. On your disk (C:\FSUIPCClient3.0_BETA\NET4), right click the DLL and go to properties. In the details tab check the version is 3.0.5632.8. If that's not correct, copy again from the Zip file above. If that's correct then go to the references node in Visual Studio, find FSUIPCClient, right click -> properties. Make sure that also has the same version number. (ignore the property 'Runtime Version', just check 'Version'). If that's not correct then delete this reference from the Solution Explorer (Rightclick -> remove). Then add it again by Rightclicking the References node -> Add Reference... In the dialog press the [browse] button at the bottom and find the DLL in C:\FSUIPCClient3.0_BETA\NET4 That should sort it out. I've rerun my test form with the DLL in the zip above (I downloaded it) and it worked. If all the versions look good at your end I'll have to have another think about it... Paul
  3. If you follow these steps you should be okay. 1. Create a new form 2. Add a button to the form and double click it to get to the code window. Remove the default 'click' event handler. 3. Add the 'using FSUIPC' to the top. 4. Copy and paste from my code to your new form code, everything between (not including): public partial class CameraWriteStructure : Form { (Note that in your code 'CameraWriteStructure' will be replaced by whatever you called the form. e.g. Form2.) and right at the bottom. } } Paul
  4. Are you running the test form I pasted above, or have you put this code in your own program?
  5. You could read one of the files from MakeRunways (e.g. RC4) to give you a list of runways at each airport. Then when the player is close enough to the airport, read the weather information at that airport and get the current wind direction. The DLL has a weather reading facility. Then you can just look up each runway at the airport and find the best runway depending on the heading. However, this may not match up with the same runway that the AI traffic is using. I don't know if that is important to you. This is not a simple thing to do and would require several hours and many lines of code. Getting the runway from the AI is so much easier. Paul
  6. To find out the current folder for the DLL, go to the solution explorer tree in Visual Studio and look under the 'references' node. Find FSUIPCClient and right-click it, then select properties. In the properties windows look for the 'path' field and that will tell you where the current version of the DLL is on your disk. Just overwrite that with the new version and recompile your project. Paul
  7. I can't see anything obviously wrong with the log. I notice you are not using the latest version of FSUIPC (4.939n). You could try updating to see if that helps. You can download the new installer here.... http://forum.simflight.com/topic/66139-updated-modules/ Otherwise you'll have to try some of the other tests. Paul
  8. Ralph, Please use the DLL attached. The previous one had a bug in it when using write-only offsets. Paul FSUIPCClient3.0_BETA.zip
  9. Okay. We can do that same thing as with the beacon light. Looking at the LiNDA plugin, I can see this L:VAR that seems to check for spoilers: function Spoilers_arm_toggle () if _tl("ASC_Spoilers_armed", 0) then Spoilers_ARM () else Spoilers_DISARM () end end If that is correct, you can add this to your lua code: (Offset 0x0BCC is the normal spoiler arm command in FS) -- create a function to write the LVAR value to an offset function writeSpoiler(varname, value) if value > 0 then ipc.writeUD(0x0BCC, 1) -- Set 0BCC (4 bytes) to 1 = armed else ipc.writeUD(0x0BCC, 0) -- Set 0BCC (4 bytes) to 0 = off end end -- create an event listener to monitor the Spoiler LVAR -- this will call the function above when the LVAR changes event.Lvar("L:ASC_Spoilers_armed", pollrate, "writeSpoiler") Paul
  10. Yes I misunderstood. The controls cannot give you information, they can only make things happen. So they are of no use if you want to check the spoilers. However, these controls are standard FS controls. They are not special Aerosoft ones. How are you reading the state of the spoilers in your application? Which offset? Paul
  11. Menu Items: Here is an example in VB of adding some menu items (including sub-menu items) and responding to them. I've included the whole form so you can see where everything goes. You must use the latest version of the DLL (attached). The previous one had a bug which stops menu items working properly. Imports FSUIPC Public Class menuTest ' create a class level variable to access the UserInputServices ' Dim 'WithEvents' as we need to sink some events later Private WithEvents ui As UserInputServices Private Sub menuTest_Load(sender As Object, e As EventArgs) Handles MyBase.Load FSUIPCConnection.Open() ' set the ui variable so we have access in other methods ui = FSUIPCConnection.UserInputServices End Sub Private Sub menuTest_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing FSUIPCConnection.Close() End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click AddMenuItems() End Sub Private Sub AddMenuItems() ' 1. Add our menu items - three main items. Item 3 has two sub items. ' IDs (first parameter) can be whatever you want. Me.ui.AddMenuItem("MenuItem1", "Menu Item 1", False) Me.ui.AddMenuItem("MenuItem2", "Menu Item 2", False) Me.ui.AddMenuItem("MenuItem3", "Menu Item 3", False) Me.ui.AddSubMenuItem("MenuItem3A", "MenuItem3", "Sub Item A") Me.ui.AddSubMenuItem("MenuItem3B", "MenuItem3", "Sub Item B") ' 2. Start a timer that will check for input every 200ms (as recomended by the FSUIPC docs) Me.timerMenuCheckInput.Interval = 200 Me.timerMenuCheckInput.Start() ' 3. start the timer to keep the menu items alive. If you don't call this every 14 seconds ' FSUIPC will remove your menu items. Me.timerMenuKeepAlive.Interval = 8000 ' 8 seconds recomended in the FSUIPC documentation Me.timerMenuKeepAlive.Start() End Sub Private Sub timerMenuKeepAlive_Tick(sender As Object, e As EventArgs) Handles timerMenuKeepAlive.Tick ' tell FSUIPC that we still need the menu items Me.ui.KeepMenuItemsAlive() End Sub Private Sub timerMenuCheckInput_Tick(sender As Object, e As EventArgs) Handles timerMenuCheckInput.Tick Me.ui.CheckForInput() End Sub ' The event handler that gets called when a menu item is selected Private Sub ui_menuItemSelected(sender As Object, e As UserInputMenuEventArgs) Handles ui.MenuSelected ' use e.ID to find out which item was selected ' NOTE: MenuItem3 can never be selected itself because it has submenus. Select Case e.ID Case "MenuItem1" MessageBox.Show("Item 1") Case "MenuItem2" MessageBox.Show("Item 2") Case "MenuItem3A" MessageBox.Show("Item 2 - SubItem A") Case "MenuItem3B" MessageBox.Show("Item 3 - SubItem B") End Select End Sub End Class Sending Controls (e.g. Spoilers) You don't need Lua for this. You can send any control number through FSUIPC. Here is an example of writing the spoiler arm control via the dll. The second parameter (0 in the example) is where you send values with the control. Not all controls need values. Just pass 0 if they do not. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click ' write a control to FS: ' either send the number... FSUIPCConnection.SendControlToFS(66066, 0) ' or use the Enum to make the code easier to read... FSUIPCConnection.SendControlToFS(FsControl.SPOILERS_ARM_ON, 0) ' (Ils sont la meme chose) End Sub Distributing Lua Scripts It's best not to force the users to run a script called ipcready.lua. They may already have their own script called this name. So call the script file something unique to your application. This will need to be in the 'modules' folder so either your installer will need to copy it there, or the users will need to do this manually. To get the script to run you can just tell FSUIPC to run it. You need to declare this offset: (I've put it in its own group called 'luaControl): ' Dim the offset that controls lua files Private luaControl As Offset(Of String) = New Offset(Of String)("luaControl", &HD70, 40, True) Then when your application is connected to FSUIPC you use this code to tell FSUIPC to run the script... Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click ' 1. Your LUA file must be in the modules folder of the user. ' In this example we imagine it is called 'FredLuaScript.lua' ' 2. In your application you need to tell FSUIPC to run this script... luaControl.Value = "Lua:FredLuaScript" ' Do not include the .lua extension to the file name FSUIPCConnection.Process("luaControl") End Sub Regards, Paul FSUIPCClient3.0_BETA.zip
  12. The methods GetArrivalRunwaysInUse and GetDepartureRunwaysInUse work by getting the information from the AI traffic. So you will only get runways if: 1. The player is in range of the airport (about 50 miles I think). AND... 2. There are currently AI planes at, en-route or departed from that airport. The more AI traffic you have the more chance of getting the information. I don't know any other way of finding out the active runways. Paul
  13. No, it's written in Lua. Lua is a different programming language. It is used by FSUIPC to write plug-ins. Lua is the only way to read L:Vars. FSUIPC will run that Lua program and adjust the Offset value for the beacon light when the LVar changes. You can then read the offset from VB as normal. You can read about Lua plugins for FSUIPC in the document "FSUIPC Lua Plug-ins.pdf" in the "Modules\FSUIPC Documents" folder. The easiest way to run code above is to save it into the modules folder as a file called "ipcready.lua". This will run when FSX is ready to fly. As I said, I'm no expert on Lua and I cannot test this as I don't have the Aerosoft Airbus. I can't say for sure that it will work, but it's close. Yes you can replace the "EGLL" with your own variable. e.g. Dim myICAO As String = "LFPG" Dim runways As List(Of FSRunway) = AI.GetArrivalRunwaysInUse(myICAO) Then you change the value of myICAO to be whatever you want. Is that what you mean? There is a PayPal address for donations in Docs/UserGuide.pdf on page 3 ("Licence" section). This is inside the zip file for my DLL. Paul
  14. The LUA plug-in will have to write to an offset so you can read it in VB in the normal way. You have two choices: 1. Write the data to the normal lights offset to control the normal FS beacon light. 2. Write to a one of the general use offsets (from 0x66C0). Option 1 will mean you don't need to change your program because it's already looking at that offset. However it might do unwanted things to your plane if Aerosoft are using it for something else. I'm not an expert in LUA but the code below is something like what you need to do. I've shown using the normal Beacon indicator (option 1). -- set the pollrate to 250ms = 4 times per second pollrate = 250 -- create a function to write the LVAR value to an offset function writeBeacon(varname, value) if value == 1 then ipc.setbitsUW(0x0D0C, 2) -- set bit 2 else ipc.clearbitsUW(0x0D0C, 2) -- clear bit 2 end end -- create an event listener to monitor the LVAR -- this will call the function above when the LVAR changes event.Lvar("L:LIGHT_BEACON", pollrate, "writeBeacon") Do you mean this facility on the AITrafficServices? Dim AI As AITrafficServices = FSUIPCConnection.AITrafficServices ' Refresh the traffic information AI.RefreshAITrafficInformation() ' Get the arrival runways in use Dim runways As List(Of FSRunway) = AI.GetArrivalRunwaysInUse("EGLL") What do you want to know? Pas de probleme. Je vous comprends. Je pense que vous parlez l'Anglais mieux que je parle la Francais. :smile: Paul
  15. Hi Fred, If your code works fine with the default planes built-in to flight sim then the problem is with the way the third-party plane has been programmed. Some types of third-party add-on aircraft do not always use the underlying Flight Sim systems. They often model their own systems and so you cannot access this data via the usual FSUIPC offsets. I suspect this is the case with the beacon light and spoiler on this Airbus by Aerosoft. Sometimes the authors provide an SDK to access their special data (e.g. PMDG 737NGX). Some have data accessible by L:VARS which you can read with a LUA plugin. Each plane is unique and requires its own research. For some like the PMDG MD-11 its not even possible. Paul
  16. Hi Ralph, Below is the code to do this. It uses the new structure feature to keep everything neat and allow you to declare a single offset for all 6 values. You'll need the latest version of the dll (attached). I've pasted the entire test form so you can see where everything goes. using FSUIPC; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace TestApp { public partial class CameraWriteStructure : Form { // declare the structure of 6 floats public class SimConnect6DOF : FSUIPCStruct { public FSUIPCStructField<float> fDeltaX = new FSUIPCStructField<float>(); public FSUIPCStructField<float> fDeltaY = new FSUIPCStructField<float>(); public FSUIPCStructField<float> fDeltaZ = new FSUIPCStructField<float>(); public FSUIPCStructField<float> fPitchDeg = new FSUIPCStructField<float>(); public FSUIPCStructField<float> fBankDeg = new FSUIPCStructField<float>(); public FSUIPCStructField<float> fHeadingDeg = new FSUIPCStructField<float>(); } // declare the offset, using the structure as the datatype. Offset starts at 86A0 private Offset<SimConnect6DOF> cameraSetRelative = new Offset<SimConnect6DOF>("camera", 0x86A0, true); private void button1_Click(object sender, EventArgs e) { // set the values to write SimConnect6DOF cameraData = new SimConnect6DOF(); cameraData.fDeltaX.Value = 12.34f; cameraData.fDeltaY.Value = 12.34f; cameraData.fDeltaZ.Value = 12.34f; cameraData.fPitchDeg.Value = 12.34f; cameraData.fBankDeg.Value = 12.34f; cameraData.fHeadingDeg.Value = 12.34f; // Assign the new structure to the offset value cameraSetRelative.Value = cameraData; // Process the group containing the 'cameraSetRelative' offset FSUIPCConnection.Process("camera"); } public CameraWriteStructure() { InitializeComponent(); } private void CameraWriteStructure_Load(object sender, EventArgs e) { FSUIPCConnection.Open(); } private void CameraWriteStructure_FormClosing(object sender, FormClosingEventArgs e) { FSUIPCConnection.Close(); } } } If you don't want to use the structure you can just declare 6 offset<float> in the normal way, each pointing to one of the offsets listed by Pete. You can put them in their own 'camera' group also. The important thing if you do it this way is that you must declare 86A0 last. The order you assign values before processing doesn't matter. I've tested the above code with the FSUIPC write logging and it's writing exactly what Pete has specified. Let me know if you need any more help. Regards, Paul
  17. Hi Emanuele, Could you please try with the latest version of the DLL attached; just in case the version you have has a problem. Some things to check... 1. In your code, make sure that the declaration of the offsets only happens once. For example, they are declared at the top of a form and not inside the timer loop. 2. Please look in the FSUIPC4.Log file (in your modules folder) to see if there are any problems reported there after you get bad data or freezing. If you are using WideClient then you also need to look at the Wideserver.log on the server and the Wideclient.log on the client. If you're not sure about the contents of the logs, paste them in here and Pete can have a look for you. 3. In the FSUIPC Interface can you please log the Lon/Lat offsets to the FSX window. When your program is getting the 'stuck' values (not changing) do the values on the screen also get stuck or are they ok? 4. Similar to 3: Please run FSInterrogator.exe (found in the FSUIPC_SDK) alongside your program. When your program gets bad data or stops responding does FSInterrogator.exe also have problems or not? These things will help narrow down where the problem is. It could be my DLL or it could be simconnect having problems. Paul FSUIPCClient3.0_BETA.zip
  18. I don't know any other way to get these exact PMDG values, sorry. There are other offsets available for Lon/Lat but these might not match the IRS system: Offsets 6010 and 6018 will give you the Lon/Lat from the GPS but these are in 'Double' floating point format. You will need to convert these to strings if you need strings for your display. Offsets 0560 and 0568 will give you the exact lon/lat of your aircraft. These values will also need conversion (as described in the documentation) to get them into strings. In that case, please check you have the latest version of FSUIPC installed. You should be using 4.939n available from the downloads section: http://forum.simflight.com/topic/66139-updated-modules/ Paul
  19. Can you paste the entire lua script you are using in here? I can take a look and see if there's anything I can spot that might be causing this to happen. Paul
  20. I'm afraid I can't help much further as I don't know anything about Leo's boards. However there is a previous thread which seems to be similar if not the same as what you want to do. in this thread Pete wrote a different version of the rotaries.lua that uses the same board that you have. You'll have to follow it through and maybe run the hidscanner program as described to check ids etc. http://forum.simflight.com/topic/68260-rotary-encoder-input-speed/?hl=bu0836x#entry426604 This is probably your best chance until Pete gets back or someone more knowledgeable than me jumps in. Paul
  21. Hi Roger, Pete's on holiday at the moment, but I might be able to shed some light on this... It doesn't send information to FS, it just triggers a virtual joystick button that is recognised internally by FSUIPC. It just starts at button 0 of the first virtual joystick (numbered from 64) and goes up from there. The actual number doesn't really matter. Via the FSUIPC interface in FS. Go into the buttons tab, rotate your rotary in each direction, fast and slow (so four buttons to assign per rotary). As you rotate them the virtual joystick button assigned by the LUA script is recognised (if the script is working) and displayed in the interface. The joystick number will be 64 or above. Then just assign an FS control as you would any other joystick button. Paul
  22. It doesn't exist in FSX, It's a control for Prepar3d. If you refer to the document "List of FSX and P3D controls.pdf" in your "modules/FSUIPC Documents" folder, the controls marked with a * are for P3D only. For FSX the only way to toggle full screen mode is to send the Alt-Enter key press to the sim. If you want to program a button to do this in the FSUIPC interface you need to assign the control 'Key Press & Release', then in the parameter box write '13+16'. (13 means the return key, +16 means with Alt held down). Paul
  23. The way you have it, the oil function only runs when the oil changes pressure changes. From your description you're getting inconstant results when turning the battery on and off. Unless the oil pressure happens to be changing at the same time the oil function will not run. You could try changing the oil function to read the oil pressure using a direct ipc.read call (rather than using the value passed in by the event handler). Then create another event to call this new oil function on the battery offset (281C). This way the annunciator will update immediately when the oil pressure or the battery state changes. Paul
  24. ... Prepar3D has been renamed as "AFR-FriendlyD3D.exe" In this case you should make sure you have a copy of the .KEY file in the P3D modules folder called: FSUIPC4.AFR-FriendlyD3D.key Paul
  25. Pete is on holiday at the moment. I had a look in the document "Offset Mapping for PMDG 737NGX.pdf" and found these two entries: 0x6C5A | 7 byte string | IRS_DisplayLeft[7] 0x6C61 | 8 byte string | IRS_DisplayRight[8] These look like they might be what you are looking for. I don't have the 737NGX so I can't check. You need to enable the PMDG Link to FSUIPC if you have not already done so. Instructions are at the top of the pdf file. The pdf can be found in the "modules\FSUIPC Documents" folder. Paul
×
×
  • 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.