Thanks for the code Michi - fab stuff! I understood most of it - I've only just got into using the Winsock controller for my gauge project.
Great to hear, that my code is readable to others, too ;-)
The F4Lib module and SimData class I will need to see working to better get my head around...
FULL ACK ;-). Even I have to rethink it, when I haven't worke some time on the code *g*
I'll give you a short overview, maybe this can clear thinks up a bit:
SimData is easy ;-): The main variable is
Private siocIndex(500) As Long
It's simply an array of LongInteger numbers, that represent the SIOC vars 1-500. So, i.e. siocIndex(23) will hold the value of SIOC's VAR0023.
It's quite hard to remember, which index in the array represents which data from Falcon ;-) That's, when F4Lib.bas comes into play *g*:
Public Enum SIOC_index
just maps a meaningful name to the appropriate number, ie.
' altimeter data
mAltBaro = 20 ' // 0 - 80000
mAltRadar = 21 ' // usually 0 - 1500 ' feet
mAltSetting = 22 ' // altimeter setting (2992)
mKias = 23 ' // 0 - 850
mMach = 24 ' // 0 - 2.0, convert from float to int and back!
That would be the place for you, if you want to change the names to the data that you get out of EHComms. The rest of the enums and Data Models is Falcon specific and usually you should not need to keep it anyway.
The most important changes would be in SimData. FillFlightData holds the code that puts the data from Falcon into the different indizes of siocIndex. I think, one example should explain the rest (I commented each line)
With FDAF // tells me to use the AF DataModel
actualAlt = (-1) * CLng(.ShipDown) // actualAlt is a temp var, .ShipDown is the value in F4's shared memory
If actualAlt < 0 Then
altBaro = actualAlt // altBaro is the same as siocIndex(mAltBaro) or siocIndex(20) (see example above)
altRadar = 0 // same as altBaro
altBaro = actualAlt
altRadar = actualAlt ' // N/A in AF
In your code, you would substitue .ShipDown with the needed value from EHComm. I don't know EHC's data structure, but I if it's data is also ordered in arrays, it would even be easier to just say
for i=0 to 499
siocIndex(i) = ehcdata(i)
as discussed some posts earlier. So you wouldn't even need the "Enum SIOC_Index" part, just send EHCs data to SIOC in a 1:1 mapping. If you don't mind, I'll have a look at EHCs data structure, maybe I will find some "quick and dirty" solution ;-)
Sometime after Xmas, I think I will order the Master card from OpenCockpits and give this a go. Do you know if the Master card has the same "3 switches on" limit as Leo Bodnars USB controller please?
AFAIK, no (I don't use IOCards for inputs, just for outputs). And IIRC, there shouldn't be a problem on Leo's parts with diodes in the matrix.