-
Notifications
You must be signed in to change notification settings - Fork 0
/
Analog_WASD_Functions.ttm
160 lines (149 loc) · 6.84 KB
/
Analog_WASD_Functions.ttm
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// Part of Analog_WSAD_Profile#.# keybinds packages
//---------------------------------------------------------------------------
// Variable Initalisation
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Multi-Function Scripts
//---------------------------------------------------------------------------
int initLEDController(){
ActKey(PULSE+KEYON+LED(&Throttle, LED_INTENSITY, 255)); // Initiate LED status below
ActKey(PULSE+KEYON+LED(&Throttle, LED_INTENSITY, 129)); // Set backlight for Throttle
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1)); // Analog WASD Function
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED2));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED3));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED4));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED5));
if(Verbose) printf("LED's Reset \xa");
}
//---------------------------------------------------------------------------
// Control Setup Functions
//---------------------------------------------------------------------------\
int ControlAxisCurveSetup(){ //exclusion switching for Duals or Warthog HOTAS
if(Verbose) printf("\xa");
if (WarthogStick == 1 & T16000Right == 0){ //Selection of Warthog Stick for Right Side
if (T16000Left == 0) {
Configure(&T16000, MODE_EXCLUDED);
}
printf("---Warthog Joystick Loading \xa");
JoyA10Set();
}
else if (T16000Right == 1 & WarthogStick == 0){
Configure(&Joystick, MODE_EXCLUDED);
if(Verbose) printf("---T16000.m Right Loading \xa");
JoyT16RSet();
}
else{
SettingError('R');
}
if (WarthogThrottle == 1 & T16000Left == 0){
if (T16000Right == 0) {
Configure(&T16000, MODE_EXCLUDED);
}
if(Verbose) printf("---Warthog Throttle Loading \xa");
ThrA10Set();
}
else if (T16000Left==1 & WarthogThrottle == 0){
Configure(&Throttle, MODE_EXCLUDED);
if(Verbose) printf("---T16000.m Left Loading \xa");
JoyT16LSet();
}
else{
SettingError('L');
}
}
int JoyA10Set(){
MapAxis(&Joystick, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Joystick, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
//Warthog Joystick Curves
SetSCurve(&Joystick, JOYX, 0,JSDeadZone,0,(JSCurve[JSProfile]/2),JSZoom[JSProfile]);
SetSCurve(&Joystick, JOYY, 0,JSDeadZone,0,(JSCurve[JSProfile]/2),JSZoom[JSProfile]);
if(Verbose) printf("---Warthog Joystick Curves Set \xa");
WarthogJoyBinds();
}
int ThrA10Set(){
MapAxis(&Throttle, SCX, MOUSE_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Throttle, SCY, MOUSE_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Throttle, THR_RIGHT, DX_THROTTLE_AXIS, AXIS_REVERSED, MAP_ABSOLUTE);
MapAxis(&Throttle, THR_LEFT, DX_SLIDER_AXIS, AXIS_REVERSED, MAP_ABSOLUTE);
MapAxis(&Throttle, THR_FC, DX_ZROT_AXIS, AXIS_REVERSED, MAP_ABSOLUTE);
//Warthog Throttle Curves
SetSCurve(&Throttle, SCX, 0, JSDeadZone, 0, 0, 0);
SetSCurve(&Throttle, SCY, 0, JSDeadZone, 0, 0, 0);
SetJCurve(&Throttle, THR_RIGHT, 50, 50);
SetJCurve(&Throttle, THR_LEFT, 50, 50);
SetJCurve(&Throttle, THR_FC, 50, 50);
if(Verbose) printf("---Warthog Throttle Curves Set \xa");
WarthogThrottleBinds();
}
int JoyT16LSet(){ //T16000.m Left Curves
if (T16000Left == 1 ){
MapAxis(&T16000L, JOYX, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&T16000L, JOYY, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&T16000L, RUDDER, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
//Joystick Curves Left
SetSCurve(&T16000L, JOYX, 0,JSDeadZone,0,JSCurve[JSProfile],JSZoom[JSProfile]);
SetSCurve(&T16000L, JOYY, 0,JSDeadZone,0,JSCurve[JSProfile],JSZoom[JSProfile]);
SetSCurve(&T16000L, RUDDER, 0,JSDeadZone,0,JSCurve[JSProfile],JSZoom[JSProfile]);
if(Verbose) printf("---T16000.m Left Joystick Curves Set \xa") ;
T16LeftBinds();
}
}
int JoyT16RSet(){ //T16000.m Right Curves
if (T16000Right == 1 ){
MapAxis(&T16000, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&T16000, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&T16000, RUDDER, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
//Joystick Curves Right
SetSCurve(&T16000, JOYX, 0,JSDeadZone,0,JSCurve[JSProfile],JSZoom[JSProfile]);
SetSCurve(&T16000, JOYY, 0,JSDeadZone,0,JSCurve[JSProfile],JSZoom[JSProfile]);
SetSCurve(&T16000, RUDDER, 0,JSDeadZone,0,JSCurve[JSProfile],JSZoom[JSProfile]);
if(Verbose) printf("---T16000.m Right Joystick Curves Set \xa");
T16RightBinds();
}
}
int SettingError(char side){
printf("--------------------------- Settings Error ---------------------------\xa");
printf("\xa");
printf("You can not have more than one device per side (left or right) set to 1 'on'.\xa");
printf("\xa");
printf("Your error is on %c side.\xa",side);
printf("\xa");
printf("Correct this in the Analog_WSAD_User_Settings.ttm by changing the\xa");
printf("\xa");
if (side =='R'){
printf("WarthogStick or T16000Right to 0 'Off' ");
}
if (side =='L'){
printf("WarthogThrottle or T16000Left to 0 'Off' ");
}
printf("for the one you are not using.\xa");
printf("\xa");
printf("Once done save and re-run the script.\xa");
printf("\xa");
printf("--------------------------- End Error ---------------------------\xa");
abort(Settings_Failure);//will cause Runtime Error as this is to force close on the script
}
//---------------------------------------------------------------------------
// External, Game and Prox Game comms switching
//---------------------------------------------------------------------------
int ExtComms(){
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT+LED2));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED3));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED4));
MapKey(&Throttle, MSP, ExtVoice);
if(Verbose) printf("External Comms Enabled \xa");
}
int IntComms(){
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED2));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT+LED3));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED4));
MapKey(&Throttle, MSP, IntVoice);
if(Verbose) printf("Internal Comms Enabled \xa");
}
int BothComms(){
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED2));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED3));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT+LED4));
MapKey(&Throttle, MSP, CHAIN(ExtVoice,IntVoice));
if(Verbose) printf("Both Comms Enabled \xa");
}