Jump to content
The simFlight Network Forums

Ground Flag not working ??


Recommended Posts

Guest goose30
Posted

Hello,

i have problems with the Ground Flag :

0366

2

Aircraft on ground flag

(0=airborne, 1=on ground).

Not updated in Slew mode.

Here the code ( Delphi )

var

status: Byte;

.

.

.

FSUIPC_Read($0366, 2, @status, dwResult);

if Status = 0 then

le_status.Text:= 'Airborne '+IntToStr(Status)

else le_status.Text:='on Ground '+IntToStr(Status);

The Value is always 128 and the Status always "on Groun" while <> 0

What is the Problem?

Thanks a lot

Matthias

Posted

Here the code ( Delphi )

var

status: Byte;

.

.

.

FSUIPC_Read($0366, 2, @status, dwResult);

I don't know Delphi, but don't you think it might be a little dangerous to read two bytes into space for only one? You will surely be corrupting something! For 2 bytes you need something bigger than a Byte. I don't know what they are called in Delphi, but in C they would be "short" or "unsigned short" or "WORD".

Pete

Guest goose30
Posted

Hello Pete,

it is correct.

But i have tried a wariable as Integer, shortint, also as word.

Nothing.

The flag is at every time the same???

I will now continue with my work and try to find my error.

But i have also another problem:

I will create my program as an Module for the FS2004.

Now i need a litle help with it. Can you give me a LITLE code snipsel

that creates a submenu in the modules menu ( eg test ) . Now,

when i click Modules->test a litle program must open...eg a message box.

My problem is the strukture from the litle program and how to create from the code the dll ???

I have read the manuals from fs2004 developer site but it helps me not.I write in delphi and all the bsp are for c++. so i need a litle bit more help.

only a litle c++ prog that does that and the quellcode. i will convert this to delphi, no problem.

Please HELP ME...

THANKS

Matthias

Posted

But i have tried a wariable as Integer, shortint, also as word.

Nothing.

The flag is at every time the same???

I will now continue with my work and try to find my error.

Please check things out with FSInterrogate. You'll find it in the FSUIPC SDK. It is provided so folks can cross-check their own programming. Also use the FSUIPC IPC logging -- just checking the Log for your Reads will show what is actually being supplied to your program. Then you will know how to look.

BTW FSInterrogate was written in Delphi.

Can you give me a LITLE code snipsel

that creates a submenu in the modules menu ( eg test ) . Now,

when i click Modules->test a litle program must open...eg a message box.

FSUIPC can do that for you, whether you are doing it from a Module or an external program. Check the section in the Programmer's Guide entitled "MODULES MENU access for Applications". There are step by step instructions there. You shouldn't need anyone else to actually code it for you, it's that detailed it's almost code already. :wink:

Regards,

Pete

Guest goose30
Posted

OK Pete,

give me a litle time to do this...then i will answer again with

the result.

At this time thanks a lot for your help !!

Regards

Matthias

Posted

Some threads in this forum are about the pros and cons about module programming for FS2002/4. Pete always says that it is a nightmare (serach this forum for module), especially when you wan't to add your own threads, dialog boxes, timers,and Pete is wrong. It is 1000 times a nightmare :!:

I also didn't want to believe and tried it. After some weeks I'm back to normal application programming with the nice features of FSUIPC (menus, hotkeys). It's really easy and I have full control of my program and FS, even over a network with WideFS. Inside FS (module/dll/gauge) there is magic and chaos, but no control ;)

Thanks Pete for the great FSUIPC and WideFS!

But if you still can't resist, here is an C/C++ example for an FS module with menus:

http://library.avsim.net/esearch.php?DLID=&Name=&FileName=fsmenu.zip&Author=&CatID=root

Bye,

Holger

Guest goose30
Posted

Thanks for your help,

bit i have no C++ and the code is too high vor me, so i cant use it for delphi.

BTW The Ground Flag will always not work.

I have now found the correct variable type, smallint ( 2 bytes ),

but the result are always 32768. If the AC is on ground ore not.

In the FSUIPC LOG the read process is correct ( i think )

7584047 READ0 [P2948] 0366, 2 bytes: 01 00

and if airborne

2 bytes: 00 00

it shows correct, or not ?

I dont now what here is incorrect.

But thanks !!!

Matthias

Guest goose30
Posted

Hi Pete,

i have found the problem.I forgot the FSUIPC_Process() command after any Read command :-)

Now also the Ground flag works :-)

But now i have another question about to register my application Programm.

How does it works ?

Thanks

Matthias

Posted

BTW The Ground Flag will always not work.

I have now found the correct variable type, smallint ( 2 bytes ),

but the result are always 32768. If the AC is on ground ore not.

In the FSUIPC LOG the read process is correct ( i think )

7584047 READ0 [P2948] 0366, 2 bytes: 01 00

and if airborne

2 bytes: 00 00

it shows correct, or not ?

Yes, assuming Program 2948 is your program (that will be identified earlier in the Log file), then FSUIPC is most certainly supplying your program the correct data.

So, I'm afraid there is something wrong in your code. But you need someone who knows Delphi to help. Maybe it is all to do with differences between passing things by value instead of address or vice versa, but I really don't know. Sorry.

Regards,

Pete

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.