-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDCS_AfterburnerDetent.tmc
More file actions
96 lines (73 loc) · 3.35 KB
/
DCS_AfterburnerDetent.tmc
File metadata and controls
96 lines (73 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
include "target.tmh"
// -------------------- INITIALISE --------------------
char afterburnerdetent_present = 0; // 0 - no detent present,
// 1 - detent present, at mil power
char afterburnerdetent_lifted = 0; // 0 - detent prevents throttle from going into afterburner,
// 1 - detent is lifted and throttle moves into afterburner
define AB 77 // detent position at AB% of full throttle reach
// -------------------- MAIN --------------------
int main()
{
Configure(&HCougar, MODE_EXCLUDED);
Configure(&JoystickF18, MODE_EXCLUDED);
Configure(&A320Pilot, MODE_EXCLUDED);
Configure(&A320Copilot, MODE_EXCLUDED);
Configure(&TCAQuadrant12, MODE_EXCLUDED);
Configure(&TCAQuadrant34, MODE_EXCLUDED);
Configure(&T16000, MODE_EXCLUDED);
Configure(&T16000L, MODE_EXCLUDED);
Configure(&LMFD, MODE_EXCLUDED);
Configure(&RMFD, MODE_EXCLUDED);
Configure(&TFRPRudder, MODE_EXCLUDED);
Configure(&TWCSThrottle, MODE_EXCLUDED);
Configure(&TFRPHARudder, MODE_EXCLUDED);
if(Init(&EventHandle)) return 1;
SetKBRate(40, 50); // (a,b) a = pulse duration, b = delay duration
SetKBLayout(KB_ENG);
// -------------------- IOUMD Buttons --------------------
SetShiftButton(&Joystick, S4, &Throttle, BSF, BSB, 0);
// -------------------- THROTTLE --------------------
// Left Throttle Button
MapKey(&Throttle, LTB, EXEC( "if (afterburnerdetent_present) {" // If detent present
"afterburnerdetent(0);" // Engage afterburner
"afterburnerdetent_lifted = 1;" // Lift detent
"DXAxis( DX_ZROT_AXIS, -AMAX );" // Left throttle to full afterburner
"DXAxis( DX_Z_AXIS, -AMAX );" // Right throttle to full afterburner
"}" ));
// EORMOTOR
MapKey(&Throttle, EORMOTOR, EXEC( "afterburnerdetent_present = 1;" // Engage afterburner detent
"afterburnerdetent(1);" ));
MapKeyR(&Throttle, EORMOTOR, EXEC( "afterburnerdetent_present = 0;" // Disengage afterburner detent
"afterburnerdetent(0);" ));
// THR_LEFT
MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, THR_LEFT, 0, 0, 0, 0, 0);
// THR_RIGHT
MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, THR_RIGHT, 0, 0, 0, 0, 0);
} // ------- end main -------
// -------------------- AFTERBURNER DETENT --------------------
int afterburnerdetent(int x)
{
if (x == 1) { // Activate detent
SetCustomCurve(&Throttle, THR_LEFT, LIST(0,0, 25,25, 50,50, AB,AB, 100,AB));
SetCustomCurve(&Throttle, THR_RIGHT, LIST(0,0, 25,25, 50,50, AB,AB, 100,AB));
}
else { // Throttle back to full reach
SetSCurve(&Throttle, THR_LEFT, 0, 0, 0, 0, 0);
SetSCurve(&Throttle, THR_RIGHT, 0, 0, 0, 0, 0);
}
}
// -------------------- EVENTHANDLE --------------------
int EventHandle(int type, alias o, int x)
{
if ((&o == &Throttle) & (x == THR_LEFT)) { // Detect left throttle position for afterburner detent
if (afterburnerdetent_present & afterburnerdetent_lifted) { // If afterburnerdetent present and detent is lifted
if (Throttle[THR_LEFT] < (100-AB)*(2*AMAX)/100) { // If left throttle below afterburner detent value of AB%
afterburnerdetent(1); // Re-engage detent
afterburnerdetent_lifted = 0; // Detent is no longer lifted
}
}
}
DefaultMapping(&o, x);
}