Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi Pete and the rest,

Let me start by saying that I am a simple amateur programmer who has spend most of his programming life working with VB and VBA to my own satisfaction. I only recently dared taking the step to Delphi and C because once you get into graphics stuff VB simply is too slow (and yes I bought the books...)

So after apologizing for my shortcommings :wink: here's my question.

I am working on a gauge which enables my aircraft to dump fuel.

I prepared the code and after re-evaluating my connection procedure (checking dwResult every cycle to see if it's connected and if not trying to reconnect) I'm pretty sure my gauge is connected to FSUIPC (side Question: can you actually loose the connection after it's been established ?)... but now here's my problem.

When I start the panel and I try to start dumping fuel, nothing happens ! But... and here's the strange part, if I open the Fuel dialog in FS2002 (via the menu options) and close that again, fuel dumping works fine ! And it keeps working fine until I restart FS.

Does this ring any bells ?

I don't have the actual code with me here, but I can post it tonight if necessary.

Thx for the help,

Björn

Posted

can you actually loose the connection after it's been established ?

No. Using the FSUIPC_Open2() method (which you must, from a Gauge) simply sets up the data control areas used to accumulate the data and responses you request. The connection to FSUIPC is via registered messages.

However, a Gauge of course is only loaded and running in FS when the panel it is defined in is loaded, so during the course of an FS session the gauge may 'connect' and 'disconnect' several times as you load different aircraft with different panels.

When I start the panel and I try to start dumping fuel, nothing happens ! But... and here's the strange part, if I open the Fuel dialog in FS2002 (via the menu options) and close that again, fuel dumping works fine ! And it keeps working fine until I restart FS.

Does this ring any bells ?

No, not at all. It does sound like your gauge has some sort of problem.

I don't have the actual code with me here, but I can post it tonight if necessary.

Better to use FSUIPC's logging. Enable the IPC read and write logging and see what is going on between your gauge and FSUIPC. ZIP it up and send it to me if you like, with a commentary about what you did. petedowson@btconnect.com.

Also, use FSInterrogate to try writing and reading the fuel values, to check that you do see what is happening okay.

Regards,

Pete

Posted

Pete,

Will do the logging thing first thing tonight !

I'm also kinda unclear on the exact meaning of the "_process" function is. Should it be called after every read/write or after a sequence of read/writes. Or can I send a number of read/write fuctions and call "_process" in the end and then all the requests wil be processed at the same time ?

Björn

Posted

I'm also kinda unclear on the exact meaning of the "_process" function is. Should it be called after every read/write or after a sequence of read/writes. Or can I send a number of read/write fuctions and call "_process" in the end and then all the requests wil be processed at the same time ?

The read/write calls do nothing except add the request to a list. They are nothing to do with the interface to FSUIPC at all really, just a convenient library function to save you having to generate the appropriate structures. The only time FSUIPC is involved is when you do a Process call. that sends the data off and gets the response.

Read/Writes therefore take no time at all. You should be accumulating all the reads and writes you want to do on each cycle and passing them all in one Process. The only exceptions to this are when you need the results of one read before doing another, as in the case of protocols involving timestamps.

Pete

Posted

Pete,

The logging tip was the golden tip !

I found that no writing takes place only reading. I was finally able to track down the reason for this: I declared the broadcast dump var's twice as broadcast variables (in two different gauges), very stupid mistake, I know ! This caused the unpredictable results !

Thx for the help !

Björn

Posted

Hi Trev,

Well I'm not the inventor of the code, I simply edited and optimised it, so I'm not sure if I can share it.

It's all pretty basic though, I use offsets 0B7C, 0B94 and 0B74 to get current fuel level and then reduce the level (first Read then Write the level - a number) every 9 ticks or so. In my aircraft (A300) only the center and main left and right tanks can jetisson fuel so the other tanks are not affected.

That's it !

The only extra check I do is to make sure the fuel level doesn't go below 0 because then all hell brakes loose and your aircraft starts doing some really strange stuff.

Incidentally you can also use these offsets (together with the offsets showing tank capacity) to upload fuel.

Kind regards,

Björn

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.