PDA

View Full Version : Flaps with servo script



Abrupto
07-06-2009, 02:47 AM
Hello!

I'm searching for a SIOC script for the flaps gauge with servo. Can anyone please tell me where to find it?

Tank you

Regards
Henrique

fordgt40
07-06-2009, 04:03 AM
Henrique

Here you are

Regards

David


// **************************************

Var 0095, name LE_EXT_LED, Link IOCARD_OUT, Output 41

Var 0096, name LE_TRANS_LED, Link IOCARD_OUT, Output 39

Var 0099, name FLAPS_IN, Link FSUIPC_INOUT, Offset $0BE0, Length 4
{
L0 = &FLAPS_IN
L0 = ABS L0
L2 = L0
IF L0 < 10
{
&LE_EXT_LED = 0
&LE_TRANS_LED = 0
}
C0 = L0 >= 10
C1 = L0 <= 408
IF C0 AND C1
{
&LE_TRANS_LED = 1
&LE_EXT_LED = 0
}
IF L0 > 408
{
C0 = L0 > 2049
C1 = L0 < 4095
IF C0 AND C1
{
&LE_TRANS_LED = 1
&LE_EXT_LED = 0
}
ELSE
{
&LE_TRANS_LED = 0
&LE_EXT_LED = 1
}
}
C0 = L0 >= 0
C1 = L0 <= 409
IF C0 AND C1
{
&x1 = 0 // between 0 and 1
&x2 = 409
&y1 = 1023
&y2 = 950
}
C0 = L0 >= 409
C1 = L0 <= 819
IF C0 AND C1
{
&x1 = 409
&x2 = 819
&y1 = 950
&y2 = 760 // between 1 and 2
}
C0 = L0 >= 819
C1 = L0 <= 2047
IF C0 AND C1
{
&x1 = 819
&x2 = 2047
&y1 = 760
&y2 = 650 // between 2 and 5
}
C0 = L0 >= 2047
C1 = L0 <= 4095
IF C0 AND C1
{
&x1 = 2047
&x2 = 4095
&y1 = 650
&y2 = 500 // between 5 and 10
}
C0 = L0 >= 4095
C1 = L0 <= 6143
IF C0 AND C1
{
&x1 = 4095
&x2 = 6143
&y1 = 500
&y2 = 400 // between 10 and 15
}
C0 = L0 >= 6143
C1 = L0 <= 10239
IF C0 AND C1
{
&x1 = 6143
&x2 = 10239
&y1 = 400
&y2 = 300 // between 15 and 25
}
C0 = L0 >= 10239
C1 = L0 <= 12287
IF C0 AND C1
{
&x1 = 10239
&x2 = 12287
&y1 = 300
&y2 = 220 // between 25 and 30
}
C0 = L0 >= 12287
C1 = L0 <= 16383
IF C0 AND C1
{
&x1 = 12287
&x2 = 16383
&y1 = 220
&y2 = 179 // between 30 and 40
}
&dy21 = &y2 - &y1
&dx21 = &x2 - &x1
&dx = L0 - &x1
&dy = &dy21 * &dx
&dy = &dy / &dx21
L1 = &y1 + &dy
&FLAPSERVO = L1
}

Var 0086, name dy

Var 0087, name dx21

Var 0088, name dy21

Var 0089, name dx

Var 0090, name x1

Var 0091, name x2

Var 0092, name y1

Var 0093, name y2

var 0022, name FLAPSERVO, Link USB_SERVOS,Output 1, POSL 177, POSC 512, POSR 1024

Abrupto
07-06-2009, 07:28 AM
Tank you very much David!

Regards
Henrique