Jump to content
The simFlight Network Forums

VB.NET SDK Errors & Questions


Recommended Posts

This is for the VB.net gurus:

I just downloaded the updated vb.net sdk hoping it might solve a nasty bug in my app that seems to come from within the old sdk code I adapted.

However there are 2 build errors in the sample:

505: VersionGet = FSUIPC_Get(t_FSUIPC_Lib_Version, FSUIPC_Lib_Version)

"t_FSUIPC_Lib_Version" is never declared. Looks like it should be declared as an integer within FSUIPC_Open, correct?

636: Marshal.FreeHGlobal(heapbuf);

Perhaps a late night translating C++ code ? Stray semicolon alert.

My original issue was this: The following function is called as a helper function from other functions that are called from a timing loop every 90ms. It's used to obtain values from Project Magenta to be displayed on the autopilot:

Private Function ReadPMAPDigits(ByVal _Address As Integer) As Integer

'This function reads appropriate Digits from MCP or FCU and returns in _Data

'Declare Vars

Dim blnStatus As Boolean

Dim t_PMAP, _intError As Integer

Dim _Data As Integer

blnStatus = myFSUIPC.FSUIPC_Read(_Address, 2, t_PMAP, _intError) 'Obtain value

If blnStatus Then

'Read Successful

blnStatus = myFSUIPC.FSUIPC_Process(_intError)

If blnStatus Then

'Process Successful

blnStatus = myFSUIPC.FSUIPC_Get(t_PMAP, _Data)

If blnStatus Then

'Get Successful

Console.WriteLine("Address: " & _Address.ToString & " Data: " & _Data.ToString)

Return _Data

End If

End If

End If

End Function

The debug output to the console produces a steady stream of the offset address & data for about 5 minutes and then - anywhere from 127 to multitudes of iterations of nonsense values (correct address, nonsense value). FSInterrogate verifies that PM is not to blame - it's buffer value never wavers. Here's my trace:

Address: 1252 Data: 240

Address: 1252 Data: 240

Address: 1252 Data: 240

Address: 1252 Data: -86114064

86114064 Error# 1

Address: 1252 Data: 262384

262384 Error# 2

Address: 1252 Data: 262384

262384 Error# 3

Address: 1252 Data: 262384

and so on 127 times before reverting back to the correct value (240, which is multiplied by 100 to get current ALT setting of FL240 in this example).

Are these "nonsense" values error codes? If so, is there an xref table or some way I can trap them cleanly?

"MyFSUIPC" is just an instance of a class I created with the fsuipc vb.net functionality. I'm utilizing the procedures as written in the (original) SDK.

I'm going to rework the new sdk into a class but was wondering if anyone had heard of this behavior and if it might relate to a known bug. I seemed to remember a post here about some errors in the original code but I couldnt turn it up in a search (I think it was archived from the server).

Thanks for any advice!

Scott

Link to comment
Share on other sites

A few more possible errors found:

Public FSUIPC_FS_Version As Short

Public FSUIPC_Lib_Version As Short

FSUIPC_Open fails unless these are declared as Integers due to truncation when checking FSUIPC FS Version.

For those of us who code with Option strict:

643: Dim idx = Token + 4 should be:

Dim idx as Integer = Token + 4

--> keeps idx from being created as generic object and then being boxed to Integer.

The declaration of t_FSUIPC_Lib_Version was originally done as part of debug code and may have been cut out with that in the latest version. Works fine for me if I just enter the declaration back in.

Prior bug is still with me...

Address: 1252 Data: 262384

262384 Error# 1925

Address: 1252 Data: 262384

262384 Error# 1926

Address: 1252 Data: 240

Address: 1252 Data: 240

Translates into 1,926 iterations where I got back "262384" from fsuipc instead of the "240" I should have (and which FSInterrogate displayed constantly).

I'm sure hoping that this is an error code of some sort...

-Scott

This is for the VB.net gurus:

However there are 2 build errors in the sample:

505: VersionGet = FSUIPC_Get(t_FSUIPC_Lib_Version, FSUIPC_Lib_Version)

"t_FSUIPC_Lib_Version" is never declared. Looks like it should be declared as an integer within FSUIPC_Open, correct?

636: Marshal.FreeHGlobal(heapbuf);

Perhaps a late night translating C++ code ? Stray semicolon alert.

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.