Hello from Austria!
Years ago I built a MotorizedThrottle together with a friend. It consists of two levers and a trimwheel which are motorized by DC-motors 30V.
Additional there are an airbrake- and a flaps-axe.
We used the DC-Motor card from OpenCockpits and an I/O card.
The program I wrote in SIOC is based on some scripts from Manuel Velez from OC.
Everything run well for many years.
Two years ago came FS2020. It was not difficult to adapt the program for it.
But now, with PMDG Boeing 737-700 the problems started:
PMDG makes a big secret about the variables. Only outputs are available, no inputs.
So after some frustating weeks I found the solution here with the programs for the connection to OpenCockpits.
But: the program code for PMDG 737 ist very large and it was very hard for me to avoid interferences with my throttle program.
After many tries I stopped programming, because it was quite impossible to find some gaps for my program.
But after long searches in many groups I found an easy solution now:
I start my script with SIOC 5 (as usual) and the script for PMDG737 with SIOC 7.
Only the IOCP_Ports must be different: in SIOC7 I use 8092, in SIOC5 8093.
At first I start FSUIPC7, then SIOC5, then IOCDCmotors, then SIOC7 and at last OiPMDG737
I think you can start both scrips with two instances of SIOC7 too.
All run very good but some variables for the Throttle are still missing. Therefor the AutoThrottle has some interrupts while flying.
Eg. the address for TOGA is not active for the throttle (althoug set in cockpit).
I hope that we get the missing variables after publishing the SDK from PMDG soon.
The script for the MotorizedThrottle I will send as freeware later.
Rgds Hermann
Motorized Throttle together with Autopilot via OiPMDG737
-
- Posts: 14
- Joined: Tue Jul 19, 2022 7:23 pm
Re: Motorized Throttle together with Autopilot via OiPMDG737
Here is a list of Events(inputs) for the Control Stand (TQ) tha can be used with the PMDG 737 driver software(OiPMDG737)PMDG makes a big secret about the variables. Only outputs are available, no inputs.
All Controll Stand settings can be controlled via these SIOC events:
using value -1 will work for most of them
2321 = CONTROL_STAND_AT1_DISENGAGE_SWITCH
2322 = CONTROL_STAND_AT2_DISENGAGE_SWITCH
2323 = CONTROL_STAND_ENG1_START_LEVER
2324 = CONTROL_STAND_ENG2_START_LEVER
2325 = CONTROL_STAND_FLAPS_LEVER
2326 = CONTROL_STAND_FLAPS_LEVER_0
2327 = CONTROL_STAND_FLAPS_LEVER_1
2328 = CONTROL_STAND_FLAPS_LEVER_10
2329 = CONTROL_STAND_FLAPS_LEVER_15
2330 = CONTROL_STAND_FLAPS_LEVER_2
2331 = CONTROL_STAND_FLAPS_LEVER_25
2332 = CONTROL_STAND_FLAPS_LEVER_30
2333 = CONTROL_STAND_FLAPS_LEVER_40
2334 = CONTROL_STAND_FLAPS_LEVER_5
2335 = CONTROL_STAND_FWD_THRUST1_LEVER (use 2815)
2336 = CONTROL_STAND_FWD_THRUST2_LEVER (use 2816)
2337 = CONTROL_STAND_HORN_CUTOUT_SWITCH
2338 = CONTROL_STAND_PARK_BRAKE_LEVER
2339 = CONTROL_STAND_REV_THRUST1_LEVER (use 2815)
2340 = CONTROL_STAND_REV_THRUST2_LEVER (use 2816)
2341 = CONTROL_STAND_SPEED_BRAKE_LEVER ( 8192 will move up, 16384 will move down)
2342 = CONTROL_STAND_SPEED_BRAKE_LEVER_DOWN ( -1 will set )
2343 = CONTROL_STAND_SPEED_BRAKE_LEVER_ARM ( -1 will set )
2344 = CONTROL_STAND_SPEED_BRAKE_LEVER_50PCT ( -1 will set )
2345 = CONTROL_STAND_SPEED_BRAKE_LEVER_FLT_DET ( -1 will set )
2346 = CONTROL_STAND_SPEED_BRAKE_LEVER_UP ( -1 will set )
2347 = CONTROL_STAND_STABTRIM_AP_SWITCH
2348 = CONTROL_STAND_STABTRIM_AP_SWITCH_GUARD
2349 = CONTROL_STAND_STABTRIM_ELEC_SWITCH
2350 = CONTROL_STAND_STABTRIM_ELEC_SWITCH_GUARD
2351 = CONTROL_STAND_TOGA1_SWITCH
2352 = CONTROL_STAND_TOGA2_SWITCH
2353 = CONTROL_STAND_TRIM_WHEEL ( 8192 will move up, 16384 will move down)
2815 = THROTTLE1_LEVER (0-16383 set Throttle1 Lever, - -4096 set REVERSE1 LEVER)
2816 = THROTTLE2_LEVER (0-16383 set Throttle2 Lever, - -4096 set REVERSE2 LEVER)
Control Stand outputs:
1814 = SPOILER_Lever
1815 = THROTTLE1_Lever
1816 = THROTTLE2_Lever
1817 = Stab_Trim
No reason for using FSUIPC then as it only put an extra layer of code without adding anything.
-
- Posts: 14
- Joined: Tue Jul 19, 2022 7:23 pm
Re: Motorized Throttle together with Autopilot via OiPMDG737
You are welcome
Re: Motorized Throttle together with Autopilot via OiPMDG737
Here is the script for motorized TQ. I do not know if it is complete. I guess it is a work in progress. It is a user script and it is not supported by by me.
Re: Motorized Throttle together with Autopilot via OiPMDG737
Hi Hermann,hermann2441 wrote: ↑Thu Sep 08, 2022 9:17 am Hello from Austria!
Years ago I built a MotorizedThrottle together with a friend. It consists of two levers and a trimwheel which are motorized by DC-motors 30V.
Additional there are an airbrake- and a flaps-axe.
We used the DC-Motor card from OpenCockpits and an I/O card.
The program I wrote in SIOC is based on some scripts from Manuel Velez from OC.
Everything run well for many years.
Two years ago came FS2020. It was not difficult to adapt the program for it.
But now, with PMDG Boeing 737-700 the problems started:
PMDG makes a big secret about the variables. Only outputs are available, no inputs.
So after some frustating weeks I found the solution here with the programs for the connection to OpenCockpits.
But: the program code for PMDG 737 ist very large and it was very hard for me to avoid interferences with my throttle program.
After many tries I stopped programming, because it was quite impossible to find some gaps for my program.
But after long searches in many groups I found an easy solution now:
I start my script with SIOC 5 (as usual) and the script for PMDG737 with SIOC 7.
Only the IOCP_Ports must be different: in SIOC7 I use 8092, in SIOC5 8093.
At first I start FSUIPC7, then SIOC5, then IOCDCmotors, then SIOC7 and at last OiPMDG737
I think you can start both scrips with two instances of SIOC7 too.
All run very good but some variables for the Throttle are still missing. Therefor the AutoThrottle has some interrupts while flying.
Eg. the address for TOGA is not active for the throttle (althoug set in cockpit).
I hope that we get the missing variables after publishing the SDK from PMDG soon.
The script for the MotorizedThrottle I will send as freeware later.
Rgds Hermann
Even though your post is a little old, I would like to know if you managed to make your throttle dcmotors work correctly with the A/T and TOGA of the PMDG737 in MSFS2020.
In my simulator I use a REV TQ that uses two dcmotor boards from Opencockpit and both work with a SIOC script as well. As I am migrating from Project Magenta to the PMDG737 and I came across the problem with the autopilot offsets, not knowing how to resolve the issue to get them working as before.
If you don't mind sharing your script to test in my sim, I would be very grateful as all I have to do is get the dcmotors working for the accelerators with A/T and the speebrake UP after landing.
I was able to make the axis for flaps and speedbrake to work with the PMDG events with a help of a friend, as the throttles and reversers are working correct with the same script I used with Project Magenta running P3D4.5, without touching inside the script.
Best regards,
Charlie
-
- Posts: 14
- Joined: Tue Jul 19, 2022 7:23 pm
Re: Motorized Throttle together with Autopilot via OiPMDG737
Hello Charlie,
very sorry for the long delay. I didnot receive a message that you wrote and I did not visit the site for a long time.
The throttle runs well with PMDG 737, only TOGA or N1 is not working, you must lift off by hand throttle. Later everything work, both levers and elevator trim.
With PMDG 777 TOGA and N1 work well, but the script for it is not fully operational. But I am still working on it.
I hope, that ROAR can help me with 737 and TOGA/N1, because both are showen in PFD but not at the MCP output.
I will send you the latest script. I works only for Standard planes and both PMDG 737 and 777. All other planes I removed from the script.
very sorry for the long delay. I didnot receive a message that you wrote and I did not visit the site for a long time.
The throttle runs well with PMDG 737, only TOGA or N1 is not working, you must lift off by hand throttle. Later everything work, both levers and elevator trim.
With PMDG 777 TOGA and N1 work well, but the script for it is not fully operational. But I am still working on it.
I hope, that ROAR can help me with 737 and TOGA/N1, because both are showen in PFD but not at the MCP output.
I will send you the latest script. I works only for Standard planes and both PMDG 737 and 777. All other planes I removed from the script.
-
- Posts: 14
- Joined: Tue Jul 19, 2022 7:23 pm
Re: Motorized Throttle together with Autopilot via OiPMDG737
Here is the TXT file:
// *****************************************************************************
// * Config_SIOC ver 5.0B5 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
//
// * Editor: Hermann Hummer
//
// * FileName : Motorized_Throttle_2022_2.11_PMDG.txt
// * Für Standard und PMDG jetzt (11/2022) dasselbe Script
// * Der Autopilot wird mit SIOC 7 getrennt gestartet
// * Date : 11.12.2007/24.12.2020/4.2.2021/4.2.2022, 16.8.2022, 4.11.2022, 19.10.2024
// * some variables shiftet
// * Subroutine for motor-lever/trim movement start every 50ms
// * Some improvements for AP: eg. when APP is active then V/S is set to -2000D
// * Pause modus is now dedected, so levers and trim stop in pause mode
// * Airbus with relais to connect levers to game port
// * Flusi 9, FSX, P3D, MSFS2020
// * Levermotoren starten nun auch in MSFS2020
// * Wenn ALT_Hold aktiv, dann VerticalSpeedAnzeige auf 0
// * LVLCHG über Keyboard-Codes realisiert (STRG + ALT + L) (muss in FSUIPC auf virtuellen Joystick zugewiesen werden)
// * VS über Keyboard-Codes realisiert (STRG + ALT + V)
// * LED für VS über Variable 07EC ansteuern (Read-Only)
// * Variable für PMDG geändert. PMDG für FSX läuft nun nicht mehr
// * LNAV und VNAV für PMDG hinzugefügt
// * für PMDG 737 und 777 ergänzt
Var 1000, Value 0 // Initialisation
{
&Lever_Elevator = TIMER 999 , 0,5 // Subroutine for Lever and Elevator Motors starts every 50ms
}
Var 0004, name 2020_211_PMDG // Version number
Var 0000, name lever2_motor // Motor control
Var 0001, name lever1_motor, value 1 // starts program
Var 0002, name elevator_motor // Motor control
// for (futur) Airbus only
Var 0003, name Relais // Relais switches from upper to lower printed board
// The following variables depend on the used Potentiometers
// You must check these values by using IOCPConsole for each Potentiometer
// 1)for 100 percent thrust: 'LeverX_upper' 2)idle: 'LeverX_idle' 3)reverser: 'LeverX_lower'.
// In my case here the potentiometer values are the following:
Var 0100, name Lever1_upper, Value 122 // Upper potentiometer value of Lever1
Var 0101, name Lever2_upper, Value 119 // Upper potentiometer value of Lever2
Var 0102, name Lever1_idle, Value 23 // Idle potentiometer value of Lever1
Var 0103, name Lever2_idle, Value 23 // Idle potentiometer value of Lever2
Var 0104, name Lever1_lower, Value 6 // Lower potentiometer value of Lever1
Var 0105, name Lever2_lower, Value 7 // Lower potentiometer value of Lever2
// Airbus only:
Var 0106, name Lever1_CL, Value 65 // CL potentiometer value of Lever1
Var 0107, name Lever2_CL, Value 68 // CL potentiometer value of Lever2
Var 0108, name Lever1_FLX, Value 90 // FLX potentiometer value of Lever1
Var 0109, name Lever2_FLX, Value 93 // FLX potentiometer value of Lever2
Var 0014, name dead_area1 // to avoid jitter, we define a 'dead area' for the potentiometers
Var 0015, name break_dist1 // how many points we need for break the motors to zero
Var 0016, name current_break1 // we can define a break current for the motor
Var 0017, name current_run1 // Speed for motor when running
Var 0034, name dead_area2
Var 0035, name break_dist2
Var 0036, name current_break2
Var 0037, name current_run2
Var 0041, name dead_area3, Value 8
Var 0042, name break_dist3, Value 30
Var 0043, name current_break3, Value 40
Var 0044, name current_run3, Value 50 // Speed for motor when big difference
Var 0110, name Lever1_factor // Distance FS / PointPot
Var 0111, name Lever2_factor // Apply Distance_Pot to Distance FS
Var 0112, name Pot1_factor // Distance Pot / PointPot
Var 0113, name Pot2_factor // Apply Distance_Pot to Distance Lever
Var 0038, name Flusi, Link FSUIPC_IN, Offset $3308, Length 2 // what Flusi-version is in use?
{
&dead_area1 = 1 // to avoid jitter, we define a 'dead area' for the potentiometers
&break_dist1 = 8 // how many points we need for break the motors to zero
¤t_break1 = 50 // we can define a break current for the motor
¤t_run1 = 80 // Speed for motor when running
&dead_area2 = 2
&break_dist2 = 8
¤t_break2 = 50
¤t_run2 = 80
}
Var 0005, name Leverdiscon, Link FSUIPC_OUT, Offset $310A, Length 1 // Disconnect both LeverPotentiometers from FS
// Var 0045, name Lever1_from_FS, Link FSUIPC_OUT, Offset $3330, Length 2
// Var 0046, name Lever2_from_FS, Link FSUIPC_OUT, Offset $3332, Length 2
// read 16 letters of the name of the airplane form AIR-file
// to see if it is a standard- or non-standard plane
Var 0140, name AIRFILE1, Link FSUIPC_IN, Offset $3c09, Length 1 // 1st letter of Airplane name in FS9
Var 0141, name AIRFILE2, Link FSUIPC_IN, Offset $3c0a, Length 1 // 2nd letter of Airplane name
Var 0142, name AIRFILE3, Link FSUIPC_IN, Offset $3c0b, Length 1 // 3rd letter of Airplane name
Var 0143, name AIRFILE4, Link FSUIPC_IN, Offset $3c0c, Length 1 // 4th letter of Airplane name
Var 0144, name AIRFILE5, Link FSUIPC_IN, Offset $3c0d, Length 1 // 5th letter of Airplane name
Var 0145, name AIRFILE6, Link FSUIPC_IN, Offset $3d00, Length 1 // 1st letter of Airplane name in FSX
Var 0146, name AIRFILE7, Link FSUIPC_IN, Offset $3d01, Length 1 // 2nd letter of Airplane name
Var 0147, name AIRFILE8, Link FSUIPC_IN, Offset $3d02, Length 1 // 3rd letter of Airplane name
Var 0148, name AIRFILE9, Link FSUIPC_IN, Offset $3d03, Length 1 // 4th letter of Airplane name
Var 0149, name AIRFILE10, Link FSUIPC_IN, Offset $3d04, Length 1 // 5th letter of Airplane name
Var 0150, name AIRFILE11, Link FSUIPC_IN, Offset $3d05, Length 1 // 6th letter of Airplane name
Var 0151, name AIRFILE12, Link FSUIPC_IN, Offset $3d06, Length 1 // 7th letter of Airplane name
Var 0152, name AIRFILE13, Link FSUIPC_IN, Offset $3d07, Length 1 // 8th letter of Airplane name
Var 0153, name AIRFILE14, Link FSUIPC_IN, Offset $3d08, Length 1 // 8th letter of Airplane name
Var 0154, name AIRFILE15, Link FSUIPC_IN, Offset $3d09, Length 1 // 10th letter of Airplane name
Var 0155, name AIRFILE16, Link FSUIPC_IN, Offset $3d0a, Length 1 // 11thletter of Airplane name
Var 0156, name AIRFILE17, Link FSUIPC_IN, Offset $3d0b, Length 1 // 12letter of Airplane name
Var 0157, name AIRFILE18, Link FSUIPC_IN, Offset $3d0c, Length 1 // 13thletter of Airplane name
Var 0158, name AIRFILE19, Link FSUIPC_IN, Offset $3d0d, Length 1 // 14th letter of Airplane name
Var 0159, name AIRFILE20, Link FSUIPC_IN, Offset $3d0e, Length 1 // 15thletter of Airplane name
Var 0160, name AIRFILE21, Link FSUIPC_IN, Offset $3d0f, Length 1 // 16th letter of Airplane name
// Standard- or Non-Standard Planes?
Var 0057, name PMDG // PMDG 737
Var 0180, name PMDG7 // PMDG 777
Var 0054, name Std // Standard Plane
// Variables for PMDG
Var 0091, name IAS_PMDG, Link FSUIPC_IN, Offset $65dc, Length 1 // PMDG 737:is IAS_HOLD active?
Var 0088, name ALT_PMDG, Link FSUIPC_IN, Offset $65e3, Length 1 // PMDG 737: is ALT hold active?
Var 0089, name AP_PMDG, Link FSUIPC_IN, Offset $65e5, Length 1 // PMDG 737: is AP active
Var 0090, name VS_PMDG, Link FSUIPC_IN, Offset $65e4, Length 1 // PMDG 737: is V/S active?
Var 0046, name IASMACH_PMDG, Link FSUIPC_IN, Offset $65C4, Length 4 // PMDG 737: Speed vom MCP
Var 0093, name APP_PMDG, Link FSUIPC_IN, Offset $65e2, Length 1
Var 0094, name CMD_B_PMDG, Link FSUIPC_IN, Offset $65e7, Length 1
Var 0045, name N1_PMDG, Link FSUIPC_IN, Offset $65DB, Length 1
Var 0098, name SPD_PMDG, Link FSUIPC_IN, Offset $65dC, Length 1
Var 0121, name LNAV_PMDG, Link FSUIPC_IN, Offset $65E0, Length 1
Var 0122, name VNAV_PMDG, Link FSUIPC_IN, Offset $65DD, Length 1
Var 0047, name IAS // is IAS_HOLD active?
Var 0049, name ALT_hold // ist ALT_HOLD active?
Var 0050, name APP // Autopilot APP-mode
Var 0051, name N1 // Autopilot N1-mode
Var 0052, name SPD // Autopilot Speed-hold-mode
Var 0053, name VS // Autopilot V/S-mode
// Variables for PMDG 777
Var 0170, name IAS_PMDG7, Link FSUIPC_IN, Offset $657e, Length 1 // PMDG 777:is IAS_HOLD active?
Var 0171, name ALT_PMDG7, Link FSUIPC_IN, Offset $658c, Length 1 // PMDG 777: is ALT hold active?
Var 0172, name AP_PMDG7, Link FSUIPC_IN, Offset $6584, Length 2 // PMDG 777: is AP active
Var 0173, name VS_PMDG7, Link FSUIPC_IN, Offset $658b, Length 1 // PMDG 777: is V/S active?
Var 0175, name APP_PMDG7, Link FSUIPC_IN, Offset $658e, Length 1
// Var 0176, name CMD_B_PMDG7, Link FSUIPC_IN, Offset $65e7, Length 1
// Var 0174, name IASMACH_PMDG7, Link FSUIPC_IN, Offset $657e, Length 4 // PMDG 777: Speed vom MCP
Var 0177, name N1_PMDG7, Link FSUIPC_IN, Offset $65DB, Length 1
Var 0178, name SPD_PMDG7, Link FSUIPC_IN, Offset $6586, Length 1
Var 0179, name LNAV_PMDG7, Link FSUIPC_IN, Offset $6587, Length 1
Var 0190, name VNAV_PMDG7, Link FSUIPC_IN, Offset $6588, Length 1
// Variables for Standard Planes
Var 0019, name Pause, Link FSUIPC_IN, Offset $0264, Length 2 // is Pause mode active?
Var 0021, name ALT_STD, Link FSUIPC_IN, Offset $07D0, Length 4 // Standard planes: AutoPilot ALT hold active?
Var 0022, name IAS_STD, Link FSUIPC_IN, Offset $07DC, Length 4 // Standard planes: is IAS_HOLD active?
Var 0029, name APP_STD, Link FSUIPC_IN, Offset $07FC, Length 4 // is Glideslope hold active?(GS and APP exchanged!!)
Var 0030, name TOGA, Link FSUIPC_IN, Offset $080C, Length 4 // is TO/GA switch active?
Var 0048, name MACH, Link FSUIPC_IN, Offset $07E4, Length 4 // is MACH_HOLD active?
Var 0055, name AP_STD, Link FSUIPC_IN, Offset $07bc, Length 4 // is AutoPilot MasterSwitch Standard-Planes active?
Var 0039, name AP
Var 0040, name GS, Link FSUIPC_IN, Offset $0800, Length 4 // is ApproachMode active? (GS and APP exchanged!!)
Var 0020, name Trim_to_FS, Link FSUIPC_OUT, Offset $0BC0, Length 2 // Send value of PitchTrim to FS
Var 0023, name Lever2_to_FS, Link FSUIPC_OUT, Offset $0932, Length 2 // Send value of Lever2 to FS
Var 0024, name Lever1_to_FS, Link FSUIPC_OUT, Offset $089A, Length 2 // Send value of Lever1 to FS
Var 0031, name EngineNumbers, Link FSUIPC_IN, Offset $0AEC, Length 2 // how many engines has the plane?
Var 0032, name Lever3_to_FS, Link FSUIPC_OUT, Offset $09CA, Length 2 // Send value of Lever3 to FS
Var 0033, name Lever4_to_FS, Link FSUIPC_OUT, Offset $0A62, Length 2 // Send value of Lever4 to FS
Var 0097, name LEVER_START // Motor for levers should start
Var 0096, name ELEV_START // Motor for elevator trim should start
Var 0068, name lever2_diff // difference where the Lever2 is and where it should be
Var 0069, name lever1_diff // difference where the Lever1 is and where it should be
Var 0027, name corr_Trim_pos // Where ElevTrim should be (corrected to potentiometer values)
Var 0028, name trim_diff // difference where the Trim is and where it should be
Var 0013, Link FSUIPC_IN, name Lever1_target, Offset $088c, Length 2 // 88c Where Lever1 should be
{
// becouse the potentiometer differ in value, we align the potentiometer value to the leverlength
L0 = &Lever1_upper - &Lever1_idle // Upper Potentiomer Value - Idle Potentiomer Value
L1 = 12800 / L0 // Distance Pot = 128 * 100 becouse in SIOC are no decimal values possible
&Pot1_factor = L1
L0 = &Lever1_Pot - &Lever1_idle // Corrected value from Pot to FS
L1 = L0 * &Pot1_factor // apply length lever to pot
L1 = L1 / 100 // same as above, becouse of no decimal value possible
L2 = &Lever1_target / 128 // value from FSUIPC must be adjusted to pot value
&Lever1_diff = L1 - L2 // where the lever is and where it should be
IF &LEVER_START = 1 // A/T is on
{
&Leverdiscon = 192 // Disconnect both LeverPotentiometers from FS
CALL &MOTOR_LEVER // subroutine for motor motion
}
}
Var 0012, Link FSUIPC_IN, name Lever2_target, Offset $0924, Length 2 // 924 Where Lever2 should be
{
L0 = &Lever2_upper - &Lever2_idle // Upper Potentiomer Value - Idle Potentiomer Value
L1 = 12800 / L0 // Distance Pot = 128
&Pot2_factor = L1
L0 = &Lever2_Pot - &Lever2_idle // Corrected value from Pot to FS
L1 = L0 * &Pot2_factor
L1 = L1 / 100
L2 = &Lever1_target / 128
&Lever2_diff = L1 - L2
IF &LEVER_START = 1 // A/T is on
{
// &Leverdiscon = 192
CALL &MOTOR_LEVER // subroutine for motor2 motion
}
}
Var 0018, Link FSUIPC_IN, name Trim_target, Offset $0BC2, Length 2 // Where Elevator Trim should be
{
IF &Trim_target > 33000
{
L0 = 81918 - &Trim_target // Trim down (49153 .. 65535)
L1 = L0 / 128 // 65535 + 16383 = 81918
L1 = TRUNC L1
}
ELSE
{
L0 = 16383 - &Trim_target // Trim up (0 .. 16383)
L1 = L0 / 128
L1 = TRUNC L1
}
&corr_Trim_pos = L1
&trim_diff = &corr_Trim_pos - &Trim_Pot
}
Var 0006, name Lever1_Pot, Link USB_ANALOGIC, Input 1, PosL 0, PosC 127, PosR 254 // Lever1 Pot position
{
L0 = &Lever1_upper - &Lever1_idle // Upper Potentiomer Value - Idle Potentiomer Value
L1 = 16383 / L0 // Distance FS = 16383
L1 = TRUNC L1
&Lever1_factor = L1
L0 = &Lever1_Pot - &Lever1_idle // Corrected value from Pot to FS
L1 = L0 * &Lever1_factor
L1 = TRUNC L1
IF &LEVER_START = 0 // A/T is OFF
{
&lever1_motor = 0 // motor stops
&Leverdiscon = 0 // Connect both LeverPotentiometers to FS
}
IF &EngineNumbers <= 2 // here we look how many engines the plane has
{
&Lever1_to_FS = L1 // Send Lever1 Position to FS
}
IF &EngineNumbers = 4
{
&Lever1_to_FS = L1 // Send Lever1 Position to FS
&Lever2_to_FS = L1 // Send Lever2 Position to FS
}
}
Var 0007, name Lever2_Pot, Link USB_ANALOGIC, Input 2, PosL 0, PosC 127, PosR 254 // Lever2 Pot position
{
L0 = &Lever2_upper - &Lever2_idle // Upper Potentiomer Value - Idle Potentiomer Value
L1 = 16383 / L0 // Distance FS = 16383
L1 = TRUNC L1
&Lever2_factor = L1
L0 = &Lever2_Pot - &Lever2_idle // Corrected value from Pot to FS
L1 = L0 * &Lever2_factor
L1 = TRUNC L1
IF &LEVER_START = 0 // A/T is OFF
{
&lever2_motor = 0 // motor stops
&Leverdiscon = 0 // Connect both LeverPotentiometers to FS
}
IF &EngineNumbers <= 2 // here we look how many engines the plane has
{
&Lever2_to_FS = L1 // Send Lever2 Position to FS
}
IF &EngineNumbers = 4
{
&Lever3_to_FS = L1 // Send Lever3 Position to FS
&Lever4_to_FS = L1 // Send Lever4 Position to FS
}
}
Var 0008, name Trim_Pot, Link USB_ANALOGIC, Input 3, PosL 0, PosC 128, PosR 254 // Trim Potentiometer position
{
L0 = &Trim_Pot * 128
L1 = 16383 - L0
IF &ELEV_START = 0 // Trimwheel steered by hand
{
&Trim_to_FS = L1 // send Trimwheel to FS
&elevator_motor = 0 // Elevator motor stops
}
}
Var 0120, name Lever_Elevator, Link SUBRUTINE // Subroutine for Lever and Trim Motor movement
{
// Dedection if Standard- or Non-Standard-Plane
&PMDG = 0
IF &AIRFILE6 = 80
{
IF &AIRFILE7 = 77
{
IF &AIRFILE8 = 68
{
IF &AIRFILE9 = 71
{
IF &AIRFILE12 = 51
{
&PMDG = 1 // Plane is PMDG 737
}
}
}
}
}
&PMDG7 = 0
IF &AIRFILE6 = 80
{
IF &AIRFILE7 = 77
{
IF &AIRFILE8 = 68
{
IF &AIRFILE9 = 71
{
IF &AIRFILE12 = 55
{
&PMDG7 = 1 // Plane is PMDG 777
}
}
}
}
}
IF &PMDG = 1 // Airplane is PMDG 737
{
&IAS = &IAS_PMDG
&N1 = &N1_PMDG
&ALT_hold = &ALT_PMDG
IF &IAS_PMDG >= 1
{
&IAS = 1
}
ELSE
{
&IAS = 0
}
&APP = &APP_PMDG // ist APP_PMDG APP
&VS = &VS_PMDG
&SPD = &SPD_PMDG
// &TOGA = &TOGA_PMDG
}
IF &AP_PMDG >= 1
{
&AP = 1
}
ELSE
{
&AP = 0
}
IF &ALT_PMDG >= 1
{
&ALT_hold = 1
}
ELSE
{
&ALT_hold = 0
}
IF &PMDG7 = 1 // Airplane is B777
{
&IAS = &IAS_PMDG7
&APP = &APP_PMDG7
&VS = &VS_PMDG7
&SPD = &SPD_PMDG7
&N1 = &N1_PMDG7
&ALT_hold = &ALT_PMDG7
IF &AP_PMDG7 >= 1
{
&AP = 1
}
ELSE
{
&AP = 0
}
IF &ALT_PMDG7 >= 1
{
&ALT_hold = 1
}
ELSE
{
&ALT_hold = 0
}
}
IF &Std = 1 // Standard Airplane
{
&AP = &AP_STD
&IAS = &IAS_STD
&ALT_hold = &ALT_STD
&APP = &APP_STD
}
&Std = 0
IF &PMDG = 0
{
IF &PMDG7 = 0
{
&Std = 1 // FeelThere in the moment is standard plane
}
}
// Start Relais for Airbus Platzhalter für Airbus
// IF &Airbus = 1
// {
// &Relais = 120
// }
// ELSE
// {
// &Relais = 0
// }
// now we look if the levermotors should start or stop
//
// {
//
// }
&LEVER_START = 1
IF &IAS = 0
{
IF &IAS_PMDG = 0
{
IF &MACH = 0
{
IF &TOGA = 0
{
IF &Pause = 0
{
IF &N1 = 0
{
IF &SPD = 0
{
IF &LNAV_PMDG = 0
{
IF &VNAV_PMDG = 0
{
&LEVER_START = 0
}
}
}
}
}
}
}
}
}
// ========================================================
// now we look if the elevator motor should start or stop
// IF &Pause = 0
// {
// IF &AP = 1
// {
//
// }
// ELSE
// {
// &ELEV_START = 0
// }
// }
// ELSE
// {
// &ELEV_START = 0
// }
&ELEV_START = 1
IF &ALT_hold = 0 // ALT hold is on
{
IF &Pause = 0
{
IF &APP = 0 // APP hold is on
{
IF &VS = 0 // V/S mode is on
{
IF &AP = 0 // Autopilot is off
{
&ELEV_START = 0 // Elevator Motor stop
}
}
}
}
}
IF &ELEV_START = 1 // Elevator Motor should start
{
CALL &Motor_Elevator // subroutine for motor motion
}
}
// =======================================================
Var 0125, name Motor_Lever, Link SUBRUTINE // USB_DC controls motors for Lever1&2
// Motor control 0-127 = left; 129-255 =Right; 0 stops
{
L0 = &lever1_diff
L1 = 0
IF L0 < 0
{
L1 = 128 // Motor run direction
}
L0 = ABS L0
L2 = ¤t_run1 + L1 // Lever1 Motor runs with full current
IF L0 <= &break_dist1
{
L2 = ¤t_break1 + L1 // Lever1 Motor runs with break current
}
L0 = ABS L0
IF L0 <= &dead_area1
{
L2 = 0
}
IF &LEVER_START = 0
{
L2 = 0 // Lever1 Motor stops
}
&lever1_motor = L2
L0 = &lever2_diff
L1 = 128
IF L0 < 0
{
L1 = 0
}
L0 = ABS L0
L2 = ¤t_run2 + L1 // Lever2 Motor runs with full current
IF L0 <= &break_dist2
{
L2 = ¤t_break2 + L1 // Lever2 Motor runs with break current
}
L0 = ABS L0
IF L0 <= &dead_area2
{
L2 = 0
}
IF &LEVER_START = 0
{
L2 = 0 // Lever2 Motor stops
}
&lever2_motor = L2
}
Var 0130, name Motor_Elevator, Link SUBRUTINE // USB_DC controls motor for Elevator
// Motor control 0-127=left, 128 stops, 129-255=right
{
L0 = &trim_diff
IF &Flusi = 7 // FS2004 Elevator direction is revers
{
IF L0 < 0
{
L1 = 128
}
ELSE
{
L1 = 0
}
}
IF &Flusi >= 8 // FSX, P3D, 2020
{
IF L0 > 0
{
L1 = 0
}
ELSE
{
L1 = 128
}
}
L0 = ABS L0
L2 = ¤t_break3 + L1
IF L0 <= &break_dist3
{
L2 = ¤t_run3 + L1
}
L0 = ABS L0
IF L0 <= &dead_area3
{
L2 = 0
}
IF &ELEV_START = 0 // Motor Elevator trim stop
{
L2 = 0
}
&elevator_motor = L2
}
// *** End of TQ
// *****************************************************************************
// * Config_SIOC ver 5.0B5 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
//
// * Editor: Hermann Hummer
//
// * FileName : Motorized_Throttle_2022_2.11_PMDG.txt
// * Für Standard und PMDG jetzt (11/2022) dasselbe Script
// * Der Autopilot wird mit SIOC 7 getrennt gestartet
// * Date : 11.12.2007/24.12.2020/4.2.2021/4.2.2022, 16.8.2022, 4.11.2022, 19.10.2024
// * some variables shiftet
// * Subroutine for motor-lever/trim movement start every 50ms
// * Some improvements for AP: eg. when APP is active then V/S is set to -2000D
// * Pause modus is now dedected, so levers and trim stop in pause mode
// * Airbus with relais to connect levers to game port
// * Flusi 9, FSX, P3D, MSFS2020
// * Levermotoren starten nun auch in MSFS2020
// * Wenn ALT_Hold aktiv, dann VerticalSpeedAnzeige auf 0
// * LVLCHG über Keyboard-Codes realisiert (STRG + ALT + L) (muss in FSUIPC auf virtuellen Joystick zugewiesen werden)
// * VS über Keyboard-Codes realisiert (STRG + ALT + V)
// * LED für VS über Variable 07EC ansteuern (Read-Only)
// * Variable für PMDG geändert. PMDG für FSX läuft nun nicht mehr
// * LNAV und VNAV für PMDG hinzugefügt
// * für PMDG 737 und 777 ergänzt
Var 1000, Value 0 // Initialisation
{
&Lever_Elevator = TIMER 999 , 0,5 // Subroutine for Lever and Elevator Motors starts every 50ms
}
Var 0004, name 2020_211_PMDG // Version number
Var 0000, name lever2_motor // Motor control
Var 0001, name lever1_motor, value 1 // starts program
Var 0002, name elevator_motor // Motor control
// for (futur) Airbus only
Var 0003, name Relais // Relais switches from upper to lower printed board
// The following variables depend on the used Potentiometers
// You must check these values by using IOCPConsole for each Potentiometer
// 1)for 100 percent thrust: 'LeverX_upper' 2)idle: 'LeverX_idle' 3)reverser: 'LeverX_lower'.
// In my case here the potentiometer values are the following:
Var 0100, name Lever1_upper, Value 122 // Upper potentiometer value of Lever1
Var 0101, name Lever2_upper, Value 119 // Upper potentiometer value of Lever2
Var 0102, name Lever1_idle, Value 23 // Idle potentiometer value of Lever1
Var 0103, name Lever2_idle, Value 23 // Idle potentiometer value of Lever2
Var 0104, name Lever1_lower, Value 6 // Lower potentiometer value of Lever1
Var 0105, name Lever2_lower, Value 7 // Lower potentiometer value of Lever2
// Airbus only:
Var 0106, name Lever1_CL, Value 65 // CL potentiometer value of Lever1
Var 0107, name Lever2_CL, Value 68 // CL potentiometer value of Lever2
Var 0108, name Lever1_FLX, Value 90 // FLX potentiometer value of Lever1
Var 0109, name Lever2_FLX, Value 93 // FLX potentiometer value of Lever2
Var 0014, name dead_area1 // to avoid jitter, we define a 'dead area' for the potentiometers
Var 0015, name break_dist1 // how many points we need for break the motors to zero
Var 0016, name current_break1 // we can define a break current for the motor
Var 0017, name current_run1 // Speed for motor when running
Var 0034, name dead_area2
Var 0035, name break_dist2
Var 0036, name current_break2
Var 0037, name current_run2
Var 0041, name dead_area3, Value 8
Var 0042, name break_dist3, Value 30
Var 0043, name current_break3, Value 40
Var 0044, name current_run3, Value 50 // Speed for motor when big difference
Var 0110, name Lever1_factor // Distance FS / PointPot
Var 0111, name Lever2_factor // Apply Distance_Pot to Distance FS
Var 0112, name Pot1_factor // Distance Pot / PointPot
Var 0113, name Pot2_factor // Apply Distance_Pot to Distance Lever
Var 0038, name Flusi, Link FSUIPC_IN, Offset $3308, Length 2 // what Flusi-version is in use?
{
&dead_area1 = 1 // to avoid jitter, we define a 'dead area' for the potentiometers
&break_dist1 = 8 // how many points we need for break the motors to zero
¤t_break1 = 50 // we can define a break current for the motor
¤t_run1 = 80 // Speed for motor when running
&dead_area2 = 2
&break_dist2 = 8
¤t_break2 = 50
¤t_run2 = 80
}
Var 0005, name Leverdiscon, Link FSUIPC_OUT, Offset $310A, Length 1 // Disconnect both LeverPotentiometers from FS
// Var 0045, name Lever1_from_FS, Link FSUIPC_OUT, Offset $3330, Length 2
// Var 0046, name Lever2_from_FS, Link FSUIPC_OUT, Offset $3332, Length 2
// read 16 letters of the name of the airplane form AIR-file
// to see if it is a standard- or non-standard plane
Var 0140, name AIRFILE1, Link FSUIPC_IN, Offset $3c09, Length 1 // 1st letter of Airplane name in FS9
Var 0141, name AIRFILE2, Link FSUIPC_IN, Offset $3c0a, Length 1 // 2nd letter of Airplane name
Var 0142, name AIRFILE3, Link FSUIPC_IN, Offset $3c0b, Length 1 // 3rd letter of Airplane name
Var 0143, name AIRFILE4, Link FSUIPC_IN, Offset $3c0c, Length 1 // 4th letter of Airplane name
Var 0144, name AIRFILE5, Link FSUIPC_IN, Offset $3c0d, Length 1 // 5th letter of Airplane name
Var 0145, name AIRFILE6, Link FSUIPC_IN, Offset $3d00, Length 1 // 1st letter of Airplane name in FSX
Var 0146, name AIRFILE7, Link FSUIPC_IN, Offset $3d01, Length 1 // 2nd letter of Airplane name
Var 0147, name AIRFILE8, Link FSUIPC_IN, Offset $3d02, Length 1 // 3rd letter of Airplane name
Var 0148, name AIRFILE9, Link FSUIPC_IN, Offset $3d03, Length 1 // 4th letter of Airplane name
Var 0149, name AIRFILE10, Link FSUIPC_IN, Offset $3d04, Length 1 // 5th letter of Airplane name
Var 0150, name AIRFILE11, Link FSUIPC_IN, Offset $3d05, Length 1 // 6th letter of Airplane name
Var 0151, name AIRFILE12, Link FSUIPC_IN, Offset $3d06, Length 1 // 7th letter of Airplane name
Var 0152, name AIRFILE13, Link FSUIPC_IN, Offset $3d07, Length 1 // 8th letter of Airplane name
Var 0153, name AIRFILE14, Link FSUIPC_IN, Offset $3d08, Length 1 // 8th letter of Airplane name
Var 0154, name AIRFILE15, Link FSUIPC_IN, Offset $3d09, Length 1 // 10th letter of Airplane name
Var 0155, name AIRFILE16, Link FSUIPC_IN, Offset $3d0a, Length 1 // 11thletter of Airplane name
Var 0156, name AIRFILE17, Link FSUIPC_IN, Offset $3d0b, Length 1 // 12letter of Airplane name
Var 0157, name AIRFILE18, Link FSUIPC_IN, Offset $3d0c, Length 1 // 13thletter of Airplane name
Var 0158, name AIRFILE19, Link FSUIPC_IN, Offset $3d0d, Length 1 // 14th letter of Airplane name
Var 0159, name AIRFILE20, Link FSUIPC_IN, Offset $3d0e, Length 1 // 15thletter of Airplane name
Var 0160, name AIRFILE21, Link FSUIPC_IN, Offset $3d0f, Length 1 // 16th letter of Airplane name
// Standard- or Non-Standard Planes?
Var 0057, name PMDG // PMDG 737
Var 0180, name PMDG7 // PMDG 777
Var 0054, name Std // Standard Plane
// Variables for PMDG
Var 0091, name IAS_PMDG, Link FSUIPC_IN, Offset $65dc, Length 1 // PMDG 737:is IAS_HOLD active?
Var 0088, name ALT_PMDG, Link FSUIPC_IN, Offset $65e3, Length 1 // PMDG 737: is ALT hold active?
Var 0089, name AP_PMDG, Link FSUIPC_IN, Offset $65e5, Length 1 // PMDG 737: is AP active
Var 0090, name VS_PMDG, Link FSUIPC_IN, Offset $65e4, Length 1 // PMDG 737: is V/S active?
Var 0046, name IASMACH_PMDG, Link FSUIPC_IN, Offset $65C4, Length 4 // PMDG 737: Speed vom MCP
Var 0093, name APP_PMDG, Link FSUIPC_IN, Offset $65e2, Length 1
Var 0094, name CMD_B_PMDG, Link FSUIPC_IN, Offset $65e7, Length 1
Var 0045, name N1_PMDG, Link FSUIPC_IN, Offset $65DB, Length 1
Var 0098, name SPD_PMDG, Link FSUIPC_IN, Offset $65dC, Length 1
Var 0121, name LNAV_PMDG, Link FSUIPC_IN, Offset $65E0, Length 1
Var 0122, name VNAV_PMDG, Link FSUIPC_IN, Offset $65DD, Length 1
Var 0047, name IAS // is IAS_HOLD active?
Var 0049, name ALT_hold // ist ALT_HOLD active?
Var 0050, name APP // Autopilot APP-mode
Var 0051, name N1 // Autopilot N1-mode
Var 0052, name SPD // Autopilot Speed-hold-mode
Var 0053, name VS // Autopilot V/S-mode
// Variables for PMDG 777
Var 0170, name IAS_PMDG7, Link FSUIPC_IN, Offset $657e, Length 1 // PMDG 777:is IAS_HOLD active?
Var 0171, name ALT_PMDG7, Link FSUIPC_IN, Offset $658c, Length 1 // PMDG 777: is ALT hold active?
Var 0172, name AP_PMDG7, Link FSUIPC_IN, Offset $6584, Length 2 // PMDG 777: is AP active
Var 0173, name VS_PMDG7, Link FSUIPC_IN, Offset $658b, Length 1 // PMDG 777: is V/S active?
Var 0175, name APP_PMDG7, Link FSUIPC_IN, Offset $658e, Length 1
// Var 0176, name CMD_B_PMDG7, Link FSUIPC_IN, Offset $65e7, Length 1
// Var 0174, name IASMACH_PMDG7, Link FSUIPC_IN, Offset $657e, Length 4 // PMDG 777: Speed vom MCP
Var 0177, name N1_PMDG7, Link FSUIPC_IN, Offset $65DB, Length 1
Var 0178, name SPD_PMDG7, Link FSUIPC_IN, Offset $6586, Length 1
Var 0179, name LNAV_PMDG7, Link FSUIPC_IN, Offset $6587, Length 1
Var 0190, name VNAV_PMDG7, Link FSUIPC_IN, Offset $6588, Length 1
// Variables for Standard Planes
Var 0019, name Pause, Link FSUIPC_IN, Offset $0264, Length 2 // is Pause mode active?
Var 0021, name ALT_STD, Link FSUIPC_IN, Offset $07D0, Length 4 // Standard planes: AutoPilot ALT hold active?
Var 0022, name IAS_STD, Link FSUIPC_IN, Offset $07DC, Length 4 // Standard planes: is IAS_HOLD active?
Var 0029, name APP_STD, Link FSUIPC_IN, Offset $07FC, Length 4 // is Glideslope hold active?(GS and APP exchanged!!)
Var 0030, name TOGA, Link FSUIPC_IN, Offset $080C, Length 4 // is TO/GA switch active?
Var 0048, name MACH, Link FSUIPC_IN, Offset $07E4, Length 4 // is MACH_HOLD active?
Var 0055, name AP_STD, Link FSUIPC_IN, Offset $07bc, Length 4 // is AutoPilot MasterSwitch Standard-Planes active?
Var 0039, name AP
Var 0040, name GS, Link FSUIPC_IN, Offset $0800, Length 4 // is ApproachMode active? (GS and APP exchanged!!)
Var 0020, name Trim_to_FS, Link FSUIPC_OUT, Offset $0BC0, Length 2 // Send value of PitchTrim to FS
Var 0023, name Lever2_to_FS, Link FSUIPC_OUT, Offset $0932, Length 2 // Send value of Lever2 to FS
Var 0024, name Lever1_to_FS, Link FSUIPC_OUT, Offset $089A, Length 2 // Send value of Lever1 to FS
Var 0031, name EngineNumbers, Link FSUIPC_IN, Offset $0AEC, Length 2 // how many engines has the plane?
Var 0032, name Lever3_to_FS, Link FSUIPC_OUT, Offset $09CA, Length 2 // Send value of Lever3 to FS
Var 0033, name Lever4_to_FS, Link FSUIPC_OUT, Offset $0A62, Length 2 // Send value of Lever4 to FS
Var 0097, name LEVER_START // Motor for levers should start
Var 0096, name ELEV_START // Motor for elevator trim should start
Var 0068, name lever2_diff // difference where the Lever2 is and where it should be
Var 0069, name lever1_diff // difference where the Lever1 is and where it should be
Var 0027, name corr_Trim_pos // Where ElevTrim should be (corrected to potentiometer values)
Var 0028, name trim_diff // difference where the Trim is and where it should be
Var 0013, Link FSUIPC_IN, name Lever1_target, Offset $088c, Length 2 // 88c Where Lever1 should be
{
// becouse the potentiometer differ in value, we align the potentiometer value to the leverlength
L0 = &Lever1_upper - &Lever1_idle // Upper Potentiomer Value - Idle Potentiomer Value
L1 = 12800 / L0 // Distance Pot = 128 * 100 becouse in SIOC are no decimal values possible
&Pot1_factor = L1
L0 = &Lever1_Pot - &Lever1_idle // Corrected value from Pot to FS
L1 = L0 * &Pot1_factor // apply length lever to pot
L1 = L1 / 100 // same as above, becouse of no decimal value possible
L2 = &Lever1_target / 128 // value from FSUIPC must be adjusted to pot value
&Lever1_diff = L1 - L2 // where the lever is and where it should be
IF &LEVER_START = 1 // A/T is on
{
&Leverdiscon = 192 // Disconnect both LeverPotentiometers from FS
CALL &MOTOR_LEVER // subroutine for motor motion
}
}
Var 0012, Link FSUIPC_IN, name Lever2_target, Offset $0924, Length 2 // 924 Where Lever2 should be
{
L0 = &Lever2_upper - &Lever2_idle // Upper Potentiomer Value - Idle Potentiomer Value
L1 = 12800 / L0 // Distance Pot = 128
&Pot2_factor = L1
L0 = &Lever2_Pot - &Lever2_idle // Corrected value from Pot to FS
L1 = L0 * &Pot2_factor
L1 = L1 / 100
L2 = &Lever1_target / 128
&Lever2_diff = L1 - L2
IF &LEVER_START = 1 // A/T is on
{
// &Leverdiscon = 192
CALL &MOTOR_LEVER // subroutine for motor2 motion
}
}
Var 0018, Link FSUIPC_IN, name Trim_target, Offset $0BC2, Length 2 // Where Elevator Trim should be
{
IF &Trim_target > 33000
{
L0 = 81918 - &Trim_target // Trim down (49153 .. 65535)
L1 = L0 / 128 // 65535 + 16383 = 81918
L1 = TRUNC L1
}
ELSE
{
L0 = 16383 - &Trim_target // Trim up (0 .. 16383)
L1 = L0 / 128
L1 = TRUNC L1
}
&corr_Trim_pos = L1
&trim_diff = &corr_Trim_pos - &Trim_Pot
}
Var 0006, name Lever1_Pot, Link USB_ANALOGIC, Input 1, PosL 0, PosC 127, PosR 254 // Lever1 Pot position
{
L0 = &Lever1_upper - &Lever1_idle // Upper Potentiomer Value - Idle Potentiomer Value
L1 = 16383 / L0 // Distance FS = 16383
L1 = TRUNC L1
&Lever1_factor = L1
L0 = &Lever1_Pot - &Lever1_idle // Corrected value from Pot to FS
L1 = L0 * &Lever1_factor
L1 = TRUNC L1
IF &LEVER_START = 0 // A/T is OFF
{
&lever1_motor = 0 // motor stops
&Leverdiscon = 0 // Connect both LeverPotentiometers to FS
}
IF &EngineNumbers <= 2 // here we look how many engines the plane has
{
&Lever1_to_FS = L1 // Send Lever1 Position to FS
}
IF &EngineNumbers = 4
{
&Lever1_to_FS = L1 // Send Lever1 Position to FS
&Lever2_to_FS = L1 // Send Lever2 Position to FS
}
}
Var 0007, name Lever2_Pot, Link USB_ANALOGIC, Input 2, PosL 0, PosC 127, PosR 254 // Lever2 Pot position
{
L0 = &Lever2_upper - &Lever2_idle // Upper Potentiomer Value - Idle Potentiomer Value
L1 = 16383 / L0 // Distance FS = 16383
L1 = TRUNC L1
&Lever2_factor = L1
L0 = &Lever2_Pot - &Lever2_idle // Corrected value from Pot to FS
L1 = L0 * &Lever2_factor
L1 = TRUNC L1
IF &LEVER_START = 0 // A/T is OFF
{
&lever2_motor = 0 // motor stops
&Leverdiscon = 0 // Connect both LeverPotentiometers to FS
}
IF &EngineNumbers <= 2 // here we look how many engines the plane has
{
&Lever2_to_FS = L1 // Send Lever2 Position to FS
}
IF &EngineNumbers = 4
{
&Lever3_to_FS = L1 // Send Lever3 Position to FS
&Lever4_to_FS = L1 // Send Lever4 Position to FS
}
}
Var 0008, name Trim_Pot, Link USB_ANALOGIC, Input 3, PosL 0, PosC 128, PosR 254 // Trim Potentiometer position
{
L0 = &Trim_Pot * 128
L1 = 16383 - L0
IF &ELEV_START = 0 // Trimwheel steered by hand
{
&Trim_to_FS = L1 // send Trimwheel to FS
&elevator_motor = 0 // Elevator motor stops
}
}
Var 0120, name Lever_Elevator, Link SUBRUTINE // Subroutine for Lever and Trim Motor movement
{
// Dedection if Standard- or Non-Standard-Plane
&PMDG = 0
IF &AIRFILE6 = 80
{
IF &AIRFILE7 = 77
{
IF &AIRFILE8 = 68
{
IF &AIRFILE9 = 71
{
IF &AIRFILE12 = 51
{
&PMDG = 1 // Plane is PMDG 737
}
}
}
}
}
&PMDG7 = 0
IF &AIRFILE6 = 80
{
IF &AIRFILE7 = 77
{
IF &AIRFILE8 = 68
{
IF &AIRFILE9 = 71
{
IF &AIRFILE12 = 55
{
&PMDG7 = 1 // Plane is PMDG 777
}
}
}
}
}
IF &PMDG = 1 // Airplane is PMDG 737
{
&IAS = &IAS_PMDG
&N1 = &N1_PMDG
&ALT_hold = &ALT_PMDG
IF &IAS_PMDG >= 1
{
&IAS = 1
}
ELSE
{
&IAS = 0
}
&APP = &APP_PMDG // ist APP_PMDG APP
&VS = &VS_PMDG
&SPD = &SPD_PMDG
// &TOGA = &TOGA_PMDG
}
IF &AP_PMDG >= 1
{
&AP = 1
}
ELSE
{
&AP = 0
}
IF &ALT_PMDG >= 1
{
&ALT_hold = 1
}
ELSE
{
&ALT_hold = 0
}
IF &PMDG7 = 1 // Airplane is B777
{
&IAS = &IAS_PMDG7
&APP = &APP_PMDG7
&VS = &VS_PMDG7
&SPD = &SPD_PMDG7
&N1 = &N1_PMDG7
&ALT_hold = &ALT_PMDG7
IF &AP_PMDG7 >= 1
{
&AP = 1
}
ELSE
{
&AP = 0
}
IF &ALT_PMDG7 >= 1
{
&ALT_hold = 1
}
ELSE
{
&ALT_hold = 0
}
}
IF &Std = 1 // Standard Airplane
{
&AP = &AP_STD
&IAS = &IAS_STD
&ALT_hold = &ALT_STD
&APP = &APP_STD
}
&Std = 0
IF &PMDG = 0
{
IF &PMDG7 = 0
{
&Std = 1 // FeelThere in the moment is standard plane
}
}
// Start Relais for Airbus Platzhalter für Airbus
// IF &Airbus = 1
// {
// &Relais = 120
// }
// ELSE
// {
// &Relais = 0
// }
// now we look if the levermotors should start or stop
//
// {
//
// }
&LEVER_START = 1
IF &IAS = 0
{
IF &IAS_PMDG = 0
{
IF &MACH = 0
{
IF &TOGA = 0
{
IF &Pause = 0
{
IF &N1 = 0
{
IF &SPD = 0
{
IF &LNAV_PMDG = 0
{
IF &VNAV_PMDG = 0
{
&LEVER_START = 0
}
}
}
}
}
}
}
}
}
// ========================================================
// now we look if the elevator motor should start or stop
// IF &Pause = 0
// {
// IF &AP = 1
// {
//
// }
// ELSE
// {
// &ELEV_START = 0
// }
// }
// ELSE
// {
// &ELEV_START = 0
// }
&ELEV_START = 1
IF &ALT_hold = 0 // ALT hold is on
{
IF &Pause = 0
{
IF &APP = 0 // APP hold is on
{
IF &VS = 0 // V/S mode is on
{
IF &AP = 0 // Autopilot is off
{
&ELEV_START = 0 // Elevator Motor stop
}
}
}
}
}
IF &ELEV_START = 1 // Elevator Motor should start
{
CALL &Motor_Elevator // subroutine for motor motion
}
}
// =======================================================
Var 0125, name Motor_Lever, Link SUBRUTINE // USB_DC controls motors for Lever1&2
// Motor control 0-127 = left; 129-255 =Right; 0 stops
{
L0 = &lever1_diff
L1 = 0
IF L0 < 0
{
L1 = 128 // Motor run direction
}
L0 = ABS L0
L2 = ¤t_run1 + L1 // Lever1 Motor runs with full current
IF L0 <= &break_dist1
{
L2 = ¤t_break1 + L1 // Lever1 Motor runs with break current
}
L0 = ABS L0
IF L0 <= &dead_area1
{
L2 = 0
}
IF &LEVER_START = 0
{
L2 = 0 // Lever1 Motor stops
}
&lever1_motor = L2
L0 = &lever2_diff
L1 = 128
IF L0 < 0
{
L1 = 0
}
L0 = ABS L0
L2 = ¤t_run2 + L1 // Lever2 Motor runs with full current
IF L0 <= &break_dist2
{
L2 = ¤t_break2 + L1 // Lever2 Motor runs with break current
}
L0 = ABS L0
IF L0 <= &dead_area2
{
L2 = 0
}
IF &LEVER_START = 0
{
L2 = 0 // Lever2 Motor stops
}
&lever2_motor = L2
}
Var 0130, name Motor_Elevator, Link SUBRUTINE // USB_DC controls motor for Elevator
// Motor control 0-127=left, 128 stops, 129-255=right
{
L0 = &trim_diff
IF &Flusi = 7 // FS2004 Elevator direction is revers
{
IF L0 < 0
{
L1 = 128
}
ELSE
{
L1 = 0
}
}
IF &Flusi >= 8 // FSX, P3D, 2020
{
IF L0 > 0
{
L1 = 0
}
ELSE
{
L1 = 128
}
}
L0 = ABS L0
L2 = ¤t_break3 + L1
IF L0 <= &break_dist3
{
L2 = ¤t_run3 + L1
}
L0 = ABS L0
IF L0 <= &dead_area3
{
L2 = 0
}
IF &ELEV_START = 0 // Motor Elevator trim stop
{
L2 = 0
}
&elevator_motor = L2
}
// *** End of TQ