Results 1 to 1 of 1
  1. #1
    New Member
    Join Date
    Sep 2013
    Location
    Quebec
    Posts
    2
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Sioc flaps indicator usbservos script problem

    i have a problem with my home made flaps indicator for a C172N from carenado.

    i just have no reaction of my servos and my card is correctly plug


    Code:
    Var 0000, Value 0
    {
    &ind_le_extend = 0 
    &ind_le_trans = 0 
    }
    Var 0001, name servo_flaps, Link USB_SERVOS, Device 37, Output 1, PosL 357, PosC 511, PosR 657
    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 = 409
    {
    L1 = 1 
    &ind_le_trans = 0 
    }
    IF L0 = 819
    {
    L1 = 1 
    &ind_le_trans = 0 
    }
    IF L0 = 2047
    {
    L1 = 1 
    &ind_le_trans = 0 
    }
    IF L0 = 4095
    {
    L1 = 1 
    &ind_le_trans = 0 
    }
    IF L0 = 6143
    {
    L1 = 1 
    &ind_le_trans = 0 
    }
    IF L0 = 10239
    {
    L1 = 1 
    &ind_le_trans = 0 
    }
    IF L0 = 12287
    {
    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 <= 409
    IF C0 AND C1
    {
    &flaps_low_val = 0 
    &flaps_high_val = 409 
    &servo_high_val = 357 
    &servo_low_val = 365 
    }
    C0 = L0 >= 409
    C1 = L0 <= 819
    IF C0 AND C1
    {
    &flaps_low_val = 409 
    &flaps_high_val = 819 
    &servo_high_val = 365 
    &servo_low_val = 375 
    }
    C0 = L0 >= 819
    C1 = L0 <= 2047
    IF C0 AND C1
    {
    &flaps_low_val = 819 
    &flaps_high_val = 2047 
    &servo_high_val = 375 
    &servo_low_val = 400 
    }
    C0 = L0 >= 2047
    C1 = L0 <= 4095
    IF C0 AND C1
    {
    &flaps_low_val = 2047 
    &flaps_high_val = 4095 
    &servo_high_val = 400 
    &servo_low_val = 437 
    }
    &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 1
    Var 0012, name ind_le_trans, Link IOCARD_OUT, Output 1
    Var 0013, Link FSUIPC_OUT, Offset $0BDC, Length 4
    Var 0014, Link USB_ANALOGIC, Input 1, PosL 0, PosC 126, PosR 253
    {
    IF V0014 > 0 // Pot/Handle @ position 0 degree
    {
    IF V0014 < 10 // 0 degree
    {
    V0013 = 2047.875 
    }
    ELSE
    {
    IF V0014 > 22 // Pot/Handle @ position 10 degree
    {
    IF V0014 < 48 // 10 degree
    {
    V0013 = 4095.75 
    }
    ELSE
    {
    IF V0014 > 52 // Pot/Handle @ position 20 degree
    {
    IF V0014 < 75 // 20 degree
    {
    V0013 = 8191.5 
    }
    ELSE
    {
    IF V0014 > 77 // Pot/Handle @ position 30 degree
    {
    IF V0014 < 120 // 30 degree
    {
    V0013 = 16383 
    }
    }
    }
    }
    }
    }
    }
    }
    ELSE
    {
    V0013 = 0 
    }
    }
    Last edited by Matt Olieman; 09-02-2013 at 07:55 AM. Reason: Put code in code box, added code quotes