-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSC_Functions-v0.1.ttm
177 lines (155 loc) · 8.26 KB
/
SC_Functions-v0.1.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// Part of Star_Citizen_Zeplin_Profile#.# keybinds packages
//---------------------------------------------------------------------------
// Multi-Function Scripts
//---------------------------------------------------------------------------
int setExclusion(){//following lines turn off other thrustmaster devices
Configure(&HCougar, MODE_EXCLUDED);
Configure(&JoystickF18, MODE_EXCLUDED);
Configure(&LMFD, MODE_EXCLUDED);
Configure(&RMFD, MODE_EXCLUDED);
Configure(&TWCSThrottle, MODE_EXCLUDED);
Configure(&T16000, MODE_EXCLUDED);
}
int initLEDClear(){//reset of LEDs to allow proper states to be displayed
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED1));
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");
}
int initShieldManagment(){//Shield Reinforcing
MapKeyIO(&Joystick,H4U,PULSE+ShieldTop,PULSE+ShieldFore);
MapKeyIO(&Joystick,H4D,PULSE+ShieldBottom,PULSE+ShieldAft);
MapKey(&Joystick,H4P,PULSE+ShieldReset);
MapKeyIO(&Joystick,H4L,0,PULSE+ShieldLeft);
MapKeyIO(&Joystick,H4R,0,PULSE+ShieldRight);
if (Verbose) printf("Shield Managment Loaded \xa");
}
int initScanViewHAT(){//view,scan,gimbal Hat 1 functions
MapKeyIO(&Joystick,H1U,DownLook,ScanMode);
MapKeyIO(&Joystick,H1D,ExitSeat,RearLook);
MapKeyIO(&Joystick,H1L,LeftLook,GimbalStab);
MapKeyIO(&Joystick,H1R,RightLook,GimbalMode);
}
int initDoorManagment(){//Full Open/Close and Lock Operation
if (DLSet==1 & !Joystick[S4]){ActKey(KEYON+PULSE+CloseAllDr);if (Verbose) printf("All Doors Closed \xa");}
if (DLSet==2 & !Joystick[S4]){ActKey(KEYON+PULSE+OpenAllDr);if (Verbose) printf("All Doors Open \xa");}
if (DLSet==1 & Joystick[S4]){ActKey(KEYON+PULSE+LockAllDr);if (Verbose) printf("All Doors Locked \xa");}
if (DLSet==2 & Joystick[S4]){ActKey(KEYON+PULSE+UnlockAllDr);if (Verbose) printf("All Doors Unlocked \xa");}
}
//---------------------------------------------------------------------------
// External, Game and Prox Game comms switching
//---------------------------------------------------------------------------
int extComms(){
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT+LED1));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED2));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED3));
MapKey(&Throttle, MSP, Ext_Voice);
if(Verbose) printf("External Comms Enabled \xa");
}
int intProxComms(){
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED1));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT+LED2));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED3));
MapKey(&Throttle, MSP, Int_VoiceProx);
if(Verbose) printf("Internal Proximity Comms Enabled \xa");
}
int intComms(){
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED1));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT-LED2));
ActKey(KEYON+PULSE+LED(&Throttle, LED_ONOFF,LED_CURRENT+LED3));
MapKey(&Throttle, MSP, Int_Voice);
if(Verbose) printf("Internal Comms Enabled \xa");
}
//---------------------------------------------------------------------------
// Throttle maping controls
//---------------------------------------------------------------------------
int RJCurveThrSet(int a){SetJCurve(&Throttle, THR_RIGHT, TJAct[a],TJOut[a]);}//Right throttle J curve hardware setup
int RSCurveThrSet(int a){SetSCurve(&Throttle, THR_RIGHT, 0, TSDeadZone[a], 0, TSCurve[a], TSZoom[a]);}//Right throttle S curve hardware setup
int RCCurveThrSet(int a){SetCustomCurve(&Throttle,THR_RIGHT,a);}//Right throttle custom curve hardware setup
int LJCurveThrSet(int a){SetJCurve(&Throttle, THR_LEFT, TJAct[a],TJOut[a]);}//Left throttle J curve hardware setup
int LSCurveThrSet(int a){SetSCurve(&Throttle, THR_LEFT, 0, TSDeadZone[a], 0, TSCurve[a], TSZoom[a]);}//Left throttle S curve hardware setup
int LCCurveThrSet(int a){SetCustomCurve(&Throttle,THR_LEFT,a);}//Left throttle custom curve hardware setup
int JCurveSlideSet(int a){SetJCurve(&Throttle, THR_FC, TJAct[a],TJOut[a]);}//Friction slider S curve setup
int SCurveSlideSet(int a){SetSCurve(&Throttle, THR_FC, 0, TSDeadZone[a], 0, TSCurve[a], TSZoom[a]);}//Friction slider S curve setup
int LCCurveSlideSet(int a){SetCustomCurve(&Throttle,THR_FC,a);}//Friction slider custom curve setup
int LeftCustCurve(int a,int b){//wraping for custom curves to follow the Right Throttle curves
if (LeftThrFollow){TrimDXAxis(DX_SLIDER_AXIS, SET(b));LCCurveThrSet(a);}
else {TrimDXAxis(DX_SLIDER_AXIS, SET(b));LSCurveThrSet(0);}
}
int LeftFollowCurve(int a,int b,int c){//wraping for S andJ curves to follow the Right Throttle curves
if (c==1){
if (LeftThrFollow){TrimDXAxis(DX_SLIDER_AXIS, SET(b));LSCurveThrSet(a);}
else{TrimDXAxis(DX_SLIDER_AXIS, SET(0));LSCurveThrSet(0);}
}
else if(c==0){
if (LeftThrFollow){TrimDXAxis(DX_SLIDER_AXIS, SET(b));LJCurveThrSet(a);}
else{TrimDXAxis(DX_SLIDER_AXIS, SET(0));LSCurveThrSet(0);}
}
}
int FricSliderCustCurve(int a,int b){//wraping for custom curves to follow the Right Throttle curves
if (SliderFollow){TrimDXAxis(DX_ZROT_AXIS, SET(b));LCCurveSlideSet(a);}
else{TrimDXAxis(DX_ZROT_AXIS, SET(0));SCurveSlideSet(0);}
}
int FricSliderFollowCurve(int a, int b,int c){//wraping for S andJ curves to follow the Right Throttle curves
if (c){
if (SliderFollow){TrimDXAxis(DX_ZROT_AXIS, SET(b));SCurveSlideSet(a);}
else{TrimDXAxis(DX_ZROT_AXIS, SET(0));SCurveSlideSet(0);}
}
else if (!c){
if (SliderFollow){TrimDXAxis(DX_ZROT_AXIS, SET(b));JCurveSlideSet(a);}
else{TrimDXAxis(DX_ZROT_AXIS, SET(0));SCurveSlideSet(0);}
}
}
int initZeroIdle(){//ensure that on 'idle' stops/button throttle will be zero.
if(Throttle[IDLERON]){
LockAxis(&Throttle,THR_RIGHT,1);//lock out changes to axis value
LockAxis(&Throttle,THR_LEFT,1);
if(Throttle[FLAPD]){
DXAxis(DX_THROTTLE_AXIS,0);//force axis to zero
DXAxis(DX_SLIDER_AXIS,0);}
if(Throttle[FLAPM]){
DXAxis(DX_THROTTLE_AXIS,0);//force axis to zero
DXAxis(DX_SLIDER_AXIS,0);}
if(Throttle[FLAPU]){
DXAxis(DX_THROTTLE_AXIS,32767);//force axis to zero
DXAxis(DX_SLIDER_AXIS,32767);}
}
if(!Throttle[IDLERON]){
LockAxis(&Throttle,THR_RIGHT,0);//lock out changes to axis value
LockAxis(&Throttle,THR_LEFT,0);
}
}
int SetThrottle() { // Prevents Throttle jumping around on mode changes
DXAxis(DX_THROTTLE_AXIS, -AxisVal(Throttle[THR_RIGHT], &axdata));
DXAxis(DX_SLIDER_AXIS, -AxisVal(Throttle[THR_LEFT], &axdata));
DXAxis(DX_ZROT_AXIS, -AxisVal(Throttle[THR_FC], &axdata));
}
//---------------------------------------------------------------------------
// SC Stalk controls
//---------------------------------------------------------------------------
int setSlewYawControl(int a){SetSCurve(&Throttle, SCX, 0, SCDeadZone, 0, SCCurve[a], SCZoom[a]);}//slew to yaw on throttle toggle statment
int initSlewControl(int a){
if (SlewToYaw){
if (SlewFollowJoy){setSlewYawControl(a);}
else {setSlewYawControl(1);}
}
}
//---------------------------------------------------------------------------
// Rudder maping controls
//---------------------------------------------------------------------------
int setFootAxisSCurve(int a){SetSCurve(&TFRPRudder,TRUDDER,0,FPDeadZone,0,FPCurve[a],FPZoom[a]);}//TRP Footpedal Curves
int FootSCurve(int a){//wraping for custom curves to follow the Right Throttle curves
if (TFRPedalUsage){
if (FootFollowJoy){setFootAxisSCurve(a);}
else {setFootAxisSCurve(0);}
}
}
//---------------------------------------------------------------------------
// Joystick maping controls
//---------------------------------------------------------------------------
int JoyAxisCurveSet(int a){ //Warthog Joystick Curves
SetSCurve(&Joystick, JOYX, 0,JSDeadZone,0,(JSCurve[a]),JSZoom[a]);
SetSCurve(&Joystick, JOYY, 0,JSDeadZone,0,(JSCurve[a]),JSZoom[a]);
}