O/C Flaps SIOC Script

Original Source

 

// *****************************************************************************
// * Config_SIOC ver 4.2   -     By Bahadir Tubay    -    www.opencockpits.com
// *****************************************************************************
// * FileName : flaps_script_pmdg_ngx.txt
// * Date : 26/11/2012
// * You have to find out your own numbers for servo location as explained in OC Flaps Manual

Var 0000, Value 0
{
  &ind_le_extend = 0    
  &ind_le_trans = 0    
}

Var 0001, name servo_flaps, Link USB_SERVOS, Output 1, PosL 0, PosC 511, PosR 1023

Var 0002, name flaps_fsuipc, Link FSUIPC_IN, Offset $0BE0, Length 4
{
  L0 = &flaps_fsuipc    
  L0 = ABS L0
  IF L0 = 0
  {
    &ind_le_extend = 0    
    &ind_le_trans = 0    
  }
  ELSE
  {
    L1 = 0    
    &ind_le_trans = 1    
    IF L0 = 3640
    {
      L1 = 1    
      &ind_le_trans = 0    
    }
    IF L0 = 7509
    {
      L1 = 1    
      &ind_le_trans = 0    
    }
    IF L0 = 10239
    {
      L1 = 1    
      &ind_le_trans = 0    
    }
    IF L0 = 12742
    {
      L1 = 1    
      &ind_le_trans = 0    
    }
    IF L0 = 13652
    {
      L1 = 1    
      &ind_le_trans = 0    
    }
    IF L0 = 14335
    {
      L1 = 1    
      &ind_le_trans = 0    
    }
    IF L0 = 15017
    {
      L1 = 1    
      &ind_le_trans = 0    
    }
    IF L0 = 16383
    {
      L1 = 1    
      &ind_le_trans = 0    
    }
    &ind_le_extend = L1    
  }
  L2 = L0    
  C0 = L0 >= 0
  C1 = L0 <= 3640
  IF C0 AND C1
  {
    &flaps_low_val = 0    
    &flaps_high_val = 3640    
    &servo_high_val = 1023    
    &servo_low_val = 912         // 0 and 1
  }
  C0 = L0 >= 3640
  C1 = L0 <= 7509
  IF C0 AND C1
  {
    &flaps_low_val = 3640    
    &flaps_high_val = 7509    
    &servo_high_val = 912    
    &servo_low_val = 775         // 1 and 2 
  }
  C0 = L0 >= 7509
  C1 = L0 <= 10239
  IF C0 AND C1
  {
    &flaps_low_val = 7509    
    &flaps_high_val = 10239    
    &servo_high_val = 775    
    &servo_low_val = 638         // 2 and 5 
  }
  C0 = L0 >= 10239
  C1 = L0 <= 12742
  IF C0 AND C1
  {
    &flaps_low_val = 10239    
    &flaps_high_val = 12742    
    &servo_high_val = 638    
    &servo_low_val = 501         // 5 and 10 
  }
  C0 = L0 >= 12742
  C1 = L0 <= 13652
  IF C0 AND C1
  {
    &flaps_low_val = 12742    
    &flaps_high_val = 13652    
    &servo_high_val = 501    
    &servo_low_val = 400         // 10 and 15 
  }
  C0 = L0 >= 13652
  C1 = L0 <= 14335
  IF C0 AND C1
  {
    &flaps_low_val = 13652    
    &flaps_high_val = 14335    
    &servo_high_val = 400    
    &servo_low_val = 314         // 15 and 25 
  }
  C0 = L0 >= 14335
  C1 = L0 <= 15017
  IF C0 AND C1
  {
    &flaps_low_val = 14335    
    &flaps_high_val = 15017    
    &servo_high_val = 314    
    &servo_low_val = 228         // 25 and 30 
  }
  C0 = L0 >= 15017
  C1 = L0 <= 16383
  IF C0 AND C1
  {
    &flaps_low_val = 15017    
    &flaps_high_val = 16383    
    &servo_high_val = 228    
    &servo_low_val = 192         // 30 and 40 
  }
  &servo_calc = &servo_low_val - &servo_high_val
  &flaps_calc = &flaps_high_val - &flaps_low_val
  &flaps_val = L0 - &flaps_low_val
  &servo_val = &servo_calc * &flaps_val
  &servo_val = &servo_val / &flaps_calc
  L1 = &servo_high_val + &servo_val
  &servo_flaps = L1    
}

Var 0003, name servo_val

Var 0004, name flaps_calc

Var 0005, name servo_calc

Var 0006, name flaps_val

Var 0007, name flaps_low_val

Var 0008, name flaps_high_val

Var 0009, name servo_high_val

Var 0010, name servo_low_val

Var 0011, name ind_le_extend, Link IOCARD_OUT, Output 22

Var 0012, name ind_le_trans, Link IOCARD_OUT, Output 11

Add a Comment

Your email address will not be published. Required fields are marked *

LIVE NOW! CLICK TO VIEW.
CURRENTLY OFFLINE