Jump to content
The simFlight Network Forums

WideClient, Lua, and AP_ALT_VAR


Recommended Posts

Is there anything unusual about the AP_ALT_VAR_INC/DEC offsets?

(Surely not ... but)

GoFLight GF46 connected to WideClient computer with controls and display run by my lua code on the WideClient computer. The pushbutton changes what is displayed and the rotary knob changes the value (or when pressed and rotated, changes a related offset). This all works except for access to the autopilot altitude offsets. (The fast offsets work as expected). Data is sent to FSX but nothing changes. I've included below a chunk of the WideServer log and the WideClient log as well as the two lua tables that determine what control offsets go with what and what is read and then displayed. Since everything in the table works as desired except the two offsets at 65892/3, I'm both perplexed and wondering where to look for my mistake.

In the logs below, I start on the VS (Autopilot vertical speed) and rotate the knob twice to the right and then press it and rotate once more to the right. This has the desired effect of increasing the vertical speed by 100 twice and then by 1000, just as one expects from the descriptions of the offsets. I then press the button to switch to the ALT display (which reads correctly) and repeat ... twice clockwise and then once while pressed. As can be seen from the logs, when the knob is rotated for ALT, the correct offset information and param value (=1) is sent, but unlike the other instances, nothing is returned. (For VS, VS FAST and ALT FAST, everything works).

Puzzled.

********* WideServer.DLL Log [version 7.654] *********
Blocksize guide = 4096 (double allowed)
Date (dmy): 09/02/11, Time 18:08:37.667: Server name is GIUSEPPE
	15242 Initialising TCP/IP server
	15257 Initialising IPX/SPX server
	15257 IPX/SPX socket() failed [Error=10044] Socket type not supported
	15257 Failed to start IPX/SPX Server
	15257 Initialising UDP/IP server
	16100 Broadcasting service every 1000 mSecs
	33041 Incoming connection Accepted ok (skt=9140) TCP
	33166 Restarting service due to zero reception!
	33182 Failed to start IPX/SPX Server
	36177 Incoming connection Accepted ok (skt=9084) TCP
	36333 Connected to computer "FRANZ" running WideClient version 6.841 (skt=9084) TCP

   ....break connection, reconnect more than once but this doesn't change the behavior


   331612 Incoming connection Accepted ok (skt=8680) TCP
   331674 Connected to computer "FRANZ" running WideClient version 6.841 (skt=8680) TCP
   331674 Read: Offset=81FF, Size=0101
   331674 Read: Offset=3320, Size=0002
   331674 Read: Offset=D000, Size=0014
   331674 Read: Offset=C824, Size=0004
   331674 Read: Offset=CC04, Size=03FC
   331674 Read: Offset=0FF0, Size=0110
   331674 Read: Offset=0371, Size=0001
   331674 Read: Offset=0598, Size=0018
   331674 Read: Offset=3F02, Size=0002
   331674 Read: Offset=3BD2, Size=0002
   331674 Read: Offset=32FC, Size=0002
   331674 Read: Offset=3304, Size=000A
   331674 Read: Offset=3D00, Size=0200
   331674 Read: Offset=5B00, Size=0080
   331674 Read: Offset=5400, Size=0006
   331674 Read: Offset=320C, Size=00E4
   333843 Read: Offset=330F, Size=0013
   333843 Read: Offset=0371, Size=0001
   336027 Read: Offset=330F, Size=0013
   336027 Read: Offset=0598, Size=0018
   338211 Read: Offset=330F, Size=0013
   338211 Read: Offset=0FF0, Size=0110
   340410 Read: Offset=330F, Size=0013
   340410 Read: Offset=320C, Size=00E4
   342594 Read: Offset=330F, Size=0013
   342594 Read: Offset=32FC, Size=0002
   344778 Read: Offset=330F, Size=0013
   344778 Read: Offset=3304, Size=000A
   346947 Read: Offset=330F, Size=0013
   346947 Read: Offset=330F, Size=0013
   349131 Read: Offset=330F, Size=0013
   349131 Read: Offset=3BD2, Size=0002
   351330 Read: Offset=330F, Size=0013
   351330 Read: Offset=3D00, Size=0200
   351876 Read: Offset=07F2, Size=0002
   352391 Read: Offset=07D4, Size=0004
   352890 Read: Offset=07CC, Size=0002
   353389 Read: Offset=0352, Size=0002
   353889 Read: Offset=0354, Size=0002
   354388 Read: Offset=0C4E, Size=0002
   356634 Read: Offset=330F, Size=0013
   356634 Read: Offset=3F02, Size=0002
   357648 Write: Offset=3110, Size=0008
        	66 01 01 00 01 00 00 00 
   358382 Write: Offset=3110, Size=0008
        	66 01 01 00 01 00 00 00 
   358818 Read: Offset=330F, Size=0013
   358818 Read: Offset=5400, Size=0006
   359567 Write: Offset=3110, Size=0008
        	FF 03 00 00 01 00 00 00 
   361002 Read: Offset=330F, Size=0013
   361002 Read: Offset=5B00, Size=0080
   363186 Read: Offset=330F, Size=0013
   363186 Read: Offset=81FF, Size=0101
   364809 Write: Offset=3110, Size=0008
        	64 01 01 00 01 00 00 00 
   365355 Read: Offset=330F, Size=0013
   365355 Read: Offset=C824, Size=0004
   365807 Write: Offset=3110, Size=0008
        	64 01 01 00 01 00 00 00 
   367118 Write: Offset=3110, Size=0008
        	F9 03 00 00 01 00 00 00 
   367554 Read: Offset=330F, Size=0013
   367554 Read: Offset=CC04, Size=0410
   369738 Read: Offset=330F, Size=0013
   371938 Read: Offset=330F, Size=0013
   371938 Read: Offset=0352, Size=0004
   372702 Error 10053: client socket disconnected at Client: removing (skt=8680) TCP
   421858 Close signalled to clients
   422950 Closing down now ...
Memory managed:  Offset records: 780 alloc, 778 free
Read buffer usage:  208 alloc, 208 free, max in session: 1
Write buffer usage: 7179 alloc, 7179 free, max in session: 1
Throughput maximum achieved:  30 frames/sec, 820 bytes/sec
Throughput average achieved for complete session:  8 frames/sec, 212 bytes/sec
Average receive rate from "FRANZ":  0 frames/sec, 14 bytes/sec
********* Log file closed *********

********* WideClient Log [version 6.841] Class=FS98MAIN *********
Date (dmy): 09/02/11, Time 18:14:16.700: Client name is FRANZ
 	1887 Timing Thread Started
 	2402 SendReq Thread Started
 	2418 Trying TCP/IP host "Giuseppe" port 8002 ...
 	2418 ... Okay, IP Address = 192.168.1.102
 	2433 LUA: "C:\Do Flight\Initial.LUA": not found
 	2511 Sending computer name and requesting base data ...
 	2511 Button Thread Started
	13899 Lost contact with ASE WX requester
	23197  499 ReadOk: Offset=07F2, Size=0002
        	00 00 
	23696  499 ReadOk: Offset=07D4, Size=0004
        	00 00 00 00 
	24195  499 ReadOk: Offset=07CC, Size=0002
        	00 00 
	24695  500 ReadOk: Offset=0352, Size=0002
        	00 00 
	25194  499 ReadOk: Offset=0354, Size=0002
        	00 00 
	25693  499 ReadOk: Offset=0C4E, Size=0002
        	00 00 
	25693	0 ReadLocal: Offset=07F2, Size=0002
        	00 00 
	25709	0 ReadLocal: Offset=07F2, Size=0002
        	F4 01 
	25709	0 ReadLocal: Offset=07D4, Size=0004
        	D0 CC 2A 04 
	25709	0 ReadLocal: Offset=0352, Size=0002
        	60 10 
	25709	0 ReadLocal: Offset=0354, Size=0002
        	00 12 
	25709	0 ReadLocal: Offset=0C4E, Size=0002
        	54 01 
	28470 GF8.0: dwData= 00000001 03BFFF00 02C734C6 03BFFF94 02FFE650 00000000
	28470 GF8.0: Sending joy=125, dw=00004000
	28470 Preparing button change block
	28470 Button change block sent
	28485  	Write: Offset=3110, Size=0008
        	66 01 01 00 01 00 00 00 
	28579	0 ReadLocal: Offset=07F2, Size=0002
        	58 02 
	29203 GF8.0: dwData= 00000001 03BFFF00 02C734C6 03BFFF94 02FFE650 00000000
	29203 GF8.0: Sending joy=125, dw=00000000
	29203 Preparing button change block
	29203 Button change block sent
	29234  	Write: Offset=3110, Size=0008
        	66 01 01 00 01 00 00 00 
	29312	0 ReadLocal: Offset=07F2, Size=0002
        	BC 02 
	30389 GF8.0: dwData= 00010000 03BFFF00 02C734C6 03BFFF94 02FFE650 00000000
	30389 GF8.0: Sending joy=125, dw=00000400
	30389 Preparing button change block
	30389 Button change block sent
	30420  	Write: Offset=3110, Size=0008
        	FF 03 00 00 01 00 00 00 
	30498	0 ReadLocal: Offset=07F2, Size=0002
        	A4 06 
	33212 GF8.0: dwData= 00000000 03BFFF01 02C734C6 03BFFF94 02FFE650 00000000
	33212 GF8.0: Sending joy=125, dw=00000401
	33212 Preparing button change block
	33212 Button change block sent
	33243	0 ReadLocal: Offset=07D4, Size=0004
        	D0 CC 2A 04 
	33353 GF8.0: dwData= 00000000 03BFFF00 02C734C6 03BFFF94 02FFE650 00000000
	33353 GF8.0: Sending joy=125, dw=00000400
	33353 Preparing button change block
	33353 Button change block sent
	35583 GF8.0: dwData= 00000001 03BFFF00 02C734C6 03BFFF94 02FFE650 00000000
	35583 GF8.0: Sending joy=125, dw=00004400
	35583 Preparing button change block
	35583 Button change block sent
	35615  	Write: Offset=3110, Size=0008
        	64 01 01 00 01 00 00 00 
	36629 GF8.0: dwData= 00000001 03BFFF00 02C734C6 03BFFF94 02FFE650 00000000
	36629 GF8.0: Sending joy=125, dw=00000400
	36629 Preparing button change block
	36629 Button change block sent
	36660  	Write: Offset=3110, Size=0008
        	64 01 01 00 01 00 00 00 
	37908 GF8.0: dwData= 00010000 03BFFF00 02C734C6 03BFFF94 02FFE650 00000000
	37908 GF8.0: Sending joy=125, dw=00000000
	37908 Preparing button change block
	37908 Button change block sent
	37939  	Write: Offset=3110, Size=0008
        	F9 03 00 00 01 00 00 00 
	38048	0 ReadLocal: Offset=07D4, Size=0004
        	98 99 5B 05 
	43539 Timing Thread Terminated
	43539 Button Thread Terminated
	43539 SendReq Thread Terminated

	43555 ****** End of session performance summary ******
	43555 Total time connected = 39 seconds
	43555 Reception maximum:  50 frames/sec, 1292 bytes/sec
	43555 Reception average whilst connected:  28 frames/sec, 711 bytes/sec
	43555 Transmission maximum:  3 frames/sec, 104 bytes/sec
	43555 Transmission average whilst connected:  0 frames/sec, 40 bytes/sec
	43555 Max receive buffer = 2163, Max send depth = 2, Send frames lost = 0

	43555 ********* Log file closed (Buffers: MaxUsed 3, Alloc 1157 Freed 1157 Refused 0) *********

-------------------------------------------------------------------------
Lua code snippet

gfrdata = {}
gfcdata = {}

gfrdata[1] = { "VS" ,  0x7F2, "SW", ipc.readSW, 1, 1, "%d" }
gfrdata[2] = { "ALT",  0x7D4, "SD", ipc.readSD, 1, 19974, "%d" }
gfrdata[3] = { "HDG",  0x7CC, "UW", ipc.readUW, 360, 65536, "%d" }
gfrdata[4] = { "NAV2", 0x352, "UW", ipc.readUW, 1, 1, util.bcd, 4, 2, "1" }
gfrdata[5] = { "TPDR", 0x354, "UW", ipc.readUW, 1, 1, util.bcd, 4, 0, ""}
gfrdata[6] = { "OBS1", 0xC4e, "UW", ipc.readUW, 1, 1, "%d" }

--       	knob+  knob-   pressed cw/ccw
gfcdata[1] = { 65894, 65895,  1023,   1022 }
gfcdata[2] = { 65892, 65893,  1017,   1016 }
gfcdata[3] = { 65879, 65880,  1025,   1024 }
gfcdata[4] = { 65645, 65644,  65647, 65646 }
gfcdata[5] = {  1057,  1056,   1055,  1054 }
gfcdata[6] = { 65663, 65662,   1027,  1026 } -- Vor1 Obi


Link to comment
Share on other sites

Is there anything unusual about the AP_ALT_VAR_INC/DEC offsets?

There's no such thing as those offsets -- they are FS controls, not values in FSUIPC offsets.

GoFLight GF46 connected to WideClient computer with controls and display run by my lua code on the WideClient computer. The pushbutton changes what is displayed and the rotary knob changes the value (or when pressed and rotated, changes a related offset). This all works except for access to the autopilot altitude offsets. (The fast offsets work as expected). Data is sent to FSX but nothing changes. I've included below a chunk of the WideServer log and the WideClient log as well as the two lua tables that determine what control offsets go with what and what is read and then displayed. Since everything in the table works as desired except the two offsets at 65892/3, I'm both perplexed and wondering where to look for my mistake.

65892 and 3 refer to FS controls, just like those you can assign in FS itself, or in the dropdowns in FSUIPC. They are not "offsets", which are the hexadecimal addresses of values in the FSUIPC data and range from 0x0000 to 0xFFFF (decimal 65535 max).

As can be seen from the logs, when the knob is rotated for ALT, the correct offset information and param value (=1) is sent

FS INC and DEC controls do not take any parameter in any case. They just do increments and decrements. You might as well just send the 4 bytes for 3110.

Puzzled.

I cannot tell what is going on from the information you supply. Please use FSUIPC logging so we can see what's happening in FS. Enable event logging. You should also set offset 3110 as a "U32" for monitoring on the right-hand side of the Logging tab. Don't worry about the parameter at 3114 as that's not used in the INC/DEC controls in any case.

Regards

Pete

Link to comment
Share on other sites

There's no such thing as those offsets -- they are FS controls, not values in FSUIPC offsets.

65892 and 3 refer to FS controls, just like those you can assign in FS itself, or in the dropdowns in FSUIPC. They are not "offsets", which are the hexadecimal addresses of values in the FSUIPC data and range from 0x0000 to 0xFFFF (decimal 65535 max).

Yes, that was just stupid of me. Of course they are controls, written using ipc.control()

FS INC and DEC controls do not take any parameter in any case. They just do increments and decrements. You might as well just send the 4 bytes for 3110.

That fixed the problem. Instead of ipc.control(65892, 1) where the "1" value from the event call and which is sometimes 2 or more (fast knob turn), I changed as you suggested to ipc.control(65892) and the problem went away. Permanently, I trust.

Link to comment
Share on other sites

That fixed the problem. Instead of ipc.control(65892, 1) where the "1" value from the event call and which is sometimes 2 or more (fast knob turn), I changed as you suggested to ipc.control(65892) and the problem went away. Permanently, I trust.

Hmm. Strange that a parameter I though would be ignored actually does something. That's interesting. Quite often the parameters are used to address different copies, but I can't imaging there being another AP altitude register. Maybe a bug in SimConnect.

Regards

Pete

Link to comment
Share on other sites

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.