No Longer Active
10-25-2009, 06:57 AM
Can someone please help me understand this little piece of SIOC code as I have ordered an opencockpits servo card to control 3 of 4 of my engine instruments for my Cessna.
Here is the code for a vertical speed instrument which will work in the same way as an engine instrument:
Var 0010, Link FSUIPC_IN, Offset $02C8, Length 4, Type 1 // Vertical Speed
{
L0 = V0010 * 0.7895 // FSUIPC conversion
L1 = L0 * 0.085166 // 12000 FPM = 1022 positions
L2 = 511 - L1 // Center
IF L2 > 1022 // Upper limit
{
L2 = 1022
}
IF L2 < 1 // Lower Limit
{
L2 = 1
}
V0000 = L2
}
Var 0000 // Servo Motor
First Line: Communicates with FSUIPC, names the offset which is the vertical speed indicator...
When it states LENGTH does that mean the number of movements (and it will move between these movements)....
So a vertical speed indicator has 4 movements... from the centre up 2... and from the center down 2.
What does the ''Type 1 // Vertical Speed'' mean? Is this strictly just a name only?
The rest of the code confuses me, as I don't know what the characters are supposed to represent.
As you can see its pretty crazy inside my head trying to understand, if I only know what the characters were such as L2 = 1, V0000 = L2 etc etc etc...
I just cant wait to get some gauges working!
Can anyone put me out of my misery?
Thank you very much.
Alex
Here is the code for a vertical speed instrument which will work in the same way as an engine instrument:
Var 0010, Link FSUIPC_IN, Offset $02C8, Length 4, Type 1 // Vertical Speed
{
L0 = V0010 * 0.7895 // FSUIPC conversion
L1 = L0 * 0.085166 // 12000 FPM = 1022 positions
L2 = 511 - L1 // Center
IF L2 > 1022 // Upper limit
{
L2 = 1022
}
IF L2 < 1 // Lower Limit
{
L2 = 1
}
V0000 = L2
}
Var 0000 // Servo Motor
First Line: Communicates with FSUIPC, names the offset which is the vertical speed indicator...
When it states LENGTH does that mean the number of movements (and it will move between these movements)....
So a vertical speed indicator has 4 movements... from the centre up 2... and from the center down 2.
What does the ''Type 1 // Vertical Speed'' mean? Is this strictly just a name only?
The rest of the code confuses me, as I don't know what the characters are supposed to represent.
As you can see its pretty crazy inside my head trying to understand, if I only know what the characters were such as L2 = 1, V0000 = L2 etc etc etc...
I just cant wait to get some gauges working!
Can anyone put me out of my misery?
Thank you very much.
Alex