PDA

View Full Version : ALT , FLT LDG, Displays and ENC SIOC code



dcutugno
12-10-2007, 07:10 PM
OPENCOCKPITS SIOC CODE for PMsystems

Hi guys, after a lot of effort, trial and error:twisted: i got the Flight Altitude and Landing Altitude Displays and encoder knobs working as i like it!:D

The difficult part for me and a nice FEATURE:) was get the LDG Display recursively blank or light up the single Digits!:o For example when 0(zero) is selected only one digit must show it all other balnk not multiple zeros, same thing for 50, 100, 1000 and back, only the needed digits works.

The way OpenCockpits Display cards and Sioc work is to put zeros before the last digit.
So after a lot of trial got it working try it and let me know what you think.

Note: I have implemented the routine for Flight Altitude in steps of 500ft instead of PMsystem own logic 1000ft and for the Landing steps of 50ft.
I did this 'cause i had read those was the correct steps, can someone confirm this? I will modify it if it is wrong.
I can add also a dimming control if you want it!

Here is the code 'cause the attachements doesn't work admin?



// SIOC code for:
// Landing, Flight Altitude Displays and Knobs For PMSystems
// Vers. 1.0 by Davide Cutugno
// email: willycutu@hotmail.com

Var 0000, Value 0
Var 0005, name MLightTest, Link FSUIPC_IN, Offset $560D, Length 1 // Master Light Test
{
If V0005 = 1
{
V0603 = 8888
}
Else
{
V0603 = &LandAlt
}
}
Var 0006, name FltAlt, Link FSUIPC_INOUT, Offset $56AC, Length 2 // FltAlt
{
V0601 = &FltAlt * 10
}
Var 0009, name LandAlt, Link FSUIPC_INOUT, Offset $56AA, Length 2 // LandAlt
{
L0 = &LandAlt * 10
If L0 = 0
{
V0604 = -999999
V0605 = L0
}

If L0 > 0
{
If L0 < 100
{
V0605 = -999999
V0602 = -999999
V0604 = L0
}
}
If L0 > 99
{
If L0 < 999
{
V0604 = -999999
V0603 = -999999
V0602 = L0
}
}
If L0 > 999
{
V0602 = -999999
V0603 = L0
}
}

// Encoder Knobs
Var 0100, name FLTENC, Link IOCARD_ENCODER, Input 3, Aceleration 2, Type 2 // FLT ALT Enc
{
L0 = &FLTENC * 50
&FltAlt = LIMIT 1000, 4500, L0
}
Var 0110, name LDGENC, Link IOCARD_ENCODER, Input 0, Aceleration 2, Type 2 // LDG ALT Enc
{
L0 = &LDGENC * 5
&LandAlt = LIMIT 0, 900, L0
}

// Displays Flight and Landing Altitude

Var 0601, Link IOCARD_DISPLAY, Digit 5, Numbers 5 // D_FLT ALT
Var 0602, Link IOCARD_DISPLAY, Digit 0, Numbers 3 // D_LDG ALT
Var 0603, Link IOCARD_DISPLAY, Digit 0, Numbers 4 // D_LDG ALT Digit 4
Var 0604, Link IOCARD_DISPLAY, Digit 0, Numbers 2 // D_LDG ALT Digit 2
Var 0605, Link IOCARD_DISPLAY, Digit 0, Numbers 1 // D_LDG ALT Digit 1