Jump to content
The simFlight Network Forums

Paul Henty

Members
  • Posts

    1,723
  • Joined

  • Days Won

    76

Everything posted by Paul Henty

  1. Pete often asks people to look at the FSUIPC.Log file that's created in the Modules folder. Have a look and see if there's anything obvious. Maybe copy it into this thread and see if anyone can see anything. Paul
  2. It works the same as in the Read() method - ie, you can use it in the FSUIPC_Get() method to read back the number you just wrote. I can't see that being of much use though :-) It's pretty redundant as far as I can see. Paul
  3. Hi kenazo, Public Form1() is the constructor. It's a bit unusual to see this.Show() in the constructor. Rather you should put this in the main program method (public static Main()) after you create your form. Presumably you have something like Form1 myForm = new Form1(); after that you should do myForm.Show(); Alternatively you can do: Application.Run(myForm); or Application.Run(new Form1()); Anyway - to your specific problem: The application isn't responding because it's in a really tight loop. Thread.Sleep() is still blocking the thread - ie, it's waiting 300ms and then carrying on - it's not allowing other threads to run. What you should use instead is: Application.DoEvents(); Which unblocks the thread and allows other windows messages etc to be processed. But there's a much better way of doing this than creating a continuous loop on the main thread: On the form designer find the 'Timer' control in the toolbox and drag it onto the form. It's not a visual component so it appears at the bottom of the form. This timer allows you to run a method every x milliseconds. In the properties set the Interval to the number of millisecond - So you want 300. Then on the events section (click the lightning icon on the top of the properties) double click in the blank space next to 'Tick'. This will take you to the code and wire up an event handler for you. You will see a new method which will now run every 300ms. It's probably called: private void timer1_Tick(object sender, EventArgs e) Ignore the parameters. Just write your code in here to get the airspeed back. At some point in your code need to Enable the timer - by default it won't run. I suggest enabling it after you have opened FSUIPC because the code in the timer event will crash is it's run before FSUIPC is open. To achieve this - and some other good practise too - I suggest you setup two more events: In the form designer click on the (blue) title bar of the form to get the properties/events window to show the properties/events for the form itself. Then go to the events bit and find: Load Again double click in the blank area to the right to make a new event handler. This one will run when the form loads. In here - do the FSCIPC open stuff and lastly enable the timer. Timer1.Enabled = true; (Be sure to move the line Fsuipc fsuipc = new Fsuipc(); up into the form member variables section so it can be accessed from any method). Lastly, back to the forms events and make a handler for FormClosing. Here you can close FSUIPC. Hope that helps at bit. Everything should run much more smoothly, and with the timer method you won't need to worry about Application.DoEvents() either because the timer is on a different thread anyway. If you have any questions, just ask. Paul
  4. Yeah, I get an accurate value for the current indicated speed. Paul
  5. Hi Simon, I've just pasted your code and it works for me! As Pete said you need to divide the AS by 128 not multiply but other than that it's working. I don't have any ideas on where the problem might be but it's not the code. Paul
  6. OK, no probs. Yeah, that's was plan B - Just looking for an easy option first :-) Thanks for your reply. Paul
  7. Hi Pete, I'd like to read the position of the sun from FS into my program - ie, its heading and its angle from the horizon. I've looked in the offset table in the documenation and I can't see anything. I'm assuming that FS has to calculate this to put the sun in the right place and do the sun glare effect when you fly towards it. What are the chances that FSUIPC can give this info? Thanks, Paul
  8. Roberto, Have you installed the lastest GoFlight drivers from the web site? http://www.goflightinc.com Old versions of the goflight installer program do not write a registry key that FSUIPC looks for. The latest installer on the web site will. Give it a try if you havn't already. 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.