Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi,

I am currently writing an instructor software for my student association's simulator.

(C langage, FSUIPC 3.8.1.0 registered, FSUIPC link opened and working, FS version: 9.1)

I'd like to make a replay control box.

The thing is that I cannot set a value in the replay flag (offset 0628).

I tryed several solution, but everytime I test the software, the simulator is paused.

the code is:

int SetReplayMode(Uint32 valeur)
{
	DWORD dwResult;
	FSUIPC_Write(0x0628, 4, &valeur, &dwResult);
	FSUIPC_Process(&dwResult);
	return 1;
}

int SetReplayTime(Uint32 valeur)
{
	DWORD dwResult;
	FSUIPC_Write(0x062C, 4, &valeur, &dwResult);
	FSUIPC_Process(&dwResult);
	return 1;
}

These functions are called in this order:

SetReplayTime(60);
SetReplayMode(1);

That is my first problem. The second is that I tried to get the COM and NAV frequencies. I read that I am supposed to get, for example 1825 if the frequency is 118.25.

I get:

COM1: 8853 (so 188.53 instead of 122.95) - offset 034E

COM2: 6544 (so 165.44 instead of 119.90) - offset 3118

NAV1: 4144 (so 141.44 instead of 110.30) - offset 0350

NAV2: 5760 (so 157.60 instead of 116.80) - offset 0352

the code is:

Uint16 GetCOM1()			//034E
{
	DWORD dwResult;
	Uint16 valeur;
	FSUIPC_Read(0x034E, 2, &valeur, &dwResult);
	FSUIPC_Process(&dwResult);
	return valeur;
}

(it is the same code for COM2, NAV1 and NAV2, with the corresponding offsets)

I hope you're able to help me!

Thanks anyway for FSUIPC, this is really the best FS add-on !

Stéphane - dPm

President of IPSAFlight association

Posted

The thing is that I cannot set a value in the replay flag (offset 0628).

This is not something I've ever used. Have you tried operating this though FSInterrogate? If it very useful to see things through that program before actually constructing code. Maybe pause needs releasing?

One thing in your code I notice which is inefficient (though it shouldn't matter in this case) is having a separate Process call for each Write. It would be better to do both writes then the Process.

I tryed several solution, but everytime I test the software, the simulator is paused.

Have you tried enabling the FSUIPC Logging to see what is happening? IPC read and write logging, plus maybe Event logging.

That is my first problem. The second is that I tried to get the COM and NAV frequencies. I read that I am supposed to get, for example 1825 if the frequency is 118.25.

I get:

COM1: 8853 (so 188.53 instead of 122.95) - offset 034E

COM2: 6544 (so 165.44 instead of 119.90) - offset 3118

NAV1: 4144 (so 141.44 instead of 110.30) - offset 0350

NAV2: 5760 (so 157.60 instead of 116.80) - offset 0352

You misread the documentation? You are interpreting the values incorrectly. They are in BCD (binary coded decimal) -- that is each decimal digit, 0-9, is in its own 4 bits. Express the values above in hexadecimal and you will see immediately that they are correct:

8853 = 0x2295

6544 = 0x1990

4144 = 0x1030

5760 = 0x1680

Please do try using the tools provided. Both the Logging in FSUIPC and FSInterrogate would have shown you your error immediately.

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.