diff --git a/Default Keybinds - Elite Dangerous/ED+HCS V2.2.03.3b.1.8.binds b/Default Keybinds - Elite Dangerous/ED+HCS V2.2.03.3R.1.8.binds similarity index 99% rename from Default Keybinds - Elite Dangerous/ED+HCS V2.2.03.3b.1.8.binds rename to Default Keybinds - Elite Dangerous/ED+HCS V2.2.03.3R.1.8.binds index 4f33ca2..e03791f 100644 --- a/Default Keybinds - Elite Dangerous/ED+HCS V2.2.03.3b.1.8.binds +++ b/Default Keybinds - Elite Dangerous/ED+HCS V2.2.03.3R.1.8.binds @@ -1,5 +1,5 @@ - + en-GB {NoDevice} diff --git a/README.md b/README.md index 6cc2cde..7f8ae31 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Elite Dangerous Warthog Target Script (HCS Keys Binding) 2.2.03.3b 2017/02/02 +# Elite Dangerous Warthog Target Script (HCS Keys Binding) 2.2.03.3R 2017/02/05 ![ED LOGO](http://edassets.org/img/preview/elite-dangerous-logo_grey.png) @@ -55,7 +55,7 @@ Almost ALL Optional Extra (OptimalPIPMode, Stop Fire Retract Hardpoints, Silent - [x] HMD / TrackIR Option for Some Function : Head Reset, Pause (TrackIr), Led Intensity. - [ ] Easy Switch resest On The Fly for Landing Gear, Cargo Scoop, Light, Hardpoints, Rotational Correction (if misaligned with game states just switch (it's should work) Or Press S3 + Switch) - [x] Easy Debug Msg OFF (Debugmode OFF (0) Or ON (1) In Settings File) -- [x] Supercruise On Throttle when boosting if throttle at 100%. (Can be switched ON/OFF On The Fly) +- [ ] Supercruise On Throttle when throttle > 99% (Can be switched ON/OFF On The Fly, Disable by default). If you use Hardware Afterburner Detent you need to pass detent to supercruise. - [x] Game Menu Up on Idle Throttle states. (Off by Default) - [x] Secure Retract Mode : Automatic Retract of Hardpoint Gear and cargo when engaging Escape Fight Mode, Supercruise, FrameshiftDrive,... - [x] Dual stage trigger Combined Fire on Triger 1 to allow combined Primary & Secondary fire or for the trigger to be separated to Primary fire only. Can be switched ON/OFF On The Fly @@ -95,6 +95,8 @@ Almost ALL Optional Extra (OptimalPIPMode, Stop Fire Retract Hardpoints, Silent - [x] 3 Joystick Curve Switchable On The Fly (Slew stick is include in this function) Switch In Game With Throttle FLAPS - [x] 2 Throttle Curve Switchable On The Fly (normal & precison). Can be switched On & Off On The Fly (S3 (Joystick Nosewhell Steering Button) + Press RED Button on Throttle Arm) - [x] Enhanced Joystick Curves tailored for Flight Assist Off (Joystick Curve will return to previous state when FAON is release) +- [ ] Support Joystick Axis trimming : memorize the X and Y axis position and calculate the difference to the +center of the axis, and then apply it to the X and Y axis (Throttle Coolie Switch [S3]UP to engage, [S3]DOWN to reset : Check Chart) OR Trim Old Way with Offset you can chose in Setting (Trim_INC)(Check Throttle Chart) ### AUTOPILOT MODE: diff --git a/Thrustmaster Warthog Chart/Elite Dangerous - Thrustmaster Warthog Chart - Joystick.jpg b/Thrustmaster Warthog Chart/Elite Dangerous - Thrustmaster Warthog Chart - Joystick.jpg index b57f665..fc77eea 100644 Binary files a/Thrustmaster Warthog Chart/Elite Dangerous - Thrustmaster Warthog Chart - Joystick.jpg and b/Thrustmaster Warthog Chart/Elite Dangerous - Thrustmaster Warthog Chart - Joystick.jpg differ diff --git a/Thrustmaster Warthog Chart/Elite Dangerous - Thrustmaster Warthog Chart - Throttle.jpg b/Thrustmaster Warthog Chart/Elite Dangerous - Thrustmaster Warthog Chart - Throttle.jpg index 4536bf2..5b41220 100644 Binary files a/Thrustmaster Warthog Chart/Elite Dangerous - Thrustmaster Warthog Chart - Throttle.jpg and b/Thrustmaster Warthog Chart/Elite Dangerous - Thrustmaster Warthog Chart - Throttle.jpg differ diff --git a/Thrustmaster Warthog Script/ED+HCS v2.2.tmc b/Thrustmaster Warthog Script/ED+HCS v2.2.tmc index be6eeb2..2eb5980 100644 --- a/Thrustmaster Warthog Script/ED+HCS v2.2.tmc +++ b/Thrustmaster Warthog Script/ED+HCS v2.2.tmc @@ -1,5 +1,5 @@ // Copyright (C) 2017 Thomas Duployez (CMDR Touille) -// V2.2.03.3b 2017/02 +// V2.2.03.3R 2017/02 // Distributed freely under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -44,7 +44,7 @@ int main() Configure(&TWCSThrottle, MODE_EXCLUDED); //Rudders - if(Rudders < 2)Configure(&TFRPRudder, MODE_EXCLUDED); + if(Rudders < 2) Configure(&TFRPRudder, MODE_EXCLUDED); else Configure(&TFRPRudder, MODE_FILTERED); //MFD @@ -62,34 +62,43 @@ int main() SetKBRate(PulseTime, DelayTime); SetKBLayout(KBLayout); - if(DebugMode | DebugMMode)printf("-------------------------Hardware Initialisation--------------------------\x0a"); + if(DebugMode | DebugMMode) printf("-------------------------Hardware Initialisation--------------------------\x0a"); // Initiate Axis Mappings - if(DebugMode | DebugMMode)printf("Initialising Joystick Axis\x0a");initJoystickAxis(); - if(DebugMode | DebugMMode)printf("Initialising Throttle Axis\x0a");initThrottleAxis(); - if(Rudders == 2){if(DebugMode | DebugMMode)printf("Initialising Rudders Axis\x0a");initRudders();} + if(DebugMode | DebugMMode) printf("Initialising Joystick Axis\x0a"); initJoystickAxis(); + if(DebugMode | DebugMMode) printf("Initialising Throttle Axis\x0a"); initThrottleAxis(); + if(Rudders == 2){ + if(DebugMode | DebugMMode) printf("Initialising Rudders Axis\x0a"); + initRudders(); + } // Initiate Curve Mappings - if(DebugMode | DebugMMode)printf("Initialising Joystick Curve\x0a");initSetJoystickCurves(); - if(DebugMode | DebugMMode)printf("Initialising Throttle Curve\x0a");initSetThrottleCurves(); + if(DebugMode | DebugMMode) printf("Initialising Joystick Curve\x0a"); initSetJoystickCurves(); + if(DebugMode | DebugMMode) printf("Initialising Throttle Curve\x0a"); initSetThrottleCurves(); //Initiate MFD - if(USEMFD > 0){if(DebugMode | DebugMMode)printf("Initialising Right MFD\x0a");initRightMFD();} - if(USEMFD > 1){if(DebugMode | DebugMMode)printf("Initialising Left MFD\x0a");initLeftMFD();} + if(USEMFD > 0){ + if(DebugMode | DebugMMode) printf("Initialising Right MFD\x0a"); + initRightMFD(); + } + if(USEMFD > 1){ + if(DebugMode | DebugMMode) printf("Initialising Left MFD\x0a"); + initLeftMFD(); + } // Initiate Led State - if(DebugMode | DebugMMode)printf("Initialising LED States\x0a");initLEDStates(); + if(DebugMode | DebugMMode) printf("Initialising LED States\x0a"); initLEDStates(); // Initiate Custom & PIP Functions (ED+HCS_Macros_v2.2.tmh) initCustomCommands(); - if(DebugMode)initPrintState(); + if(DebugMode) initPrintState(); //--------------------------------------------------------------------------------------------------------------------------------------------------------------// // ;) // //--------------------------------------------------------------------------------------------------------------------------------------------------------------// - printf("--------------------------V2.2.03.3b----2017/02/03------------------------\x0a"); + printf("--------------------------V2.2.03.3R----2017/02/05------------------------\x0a"); printf("---------Enhanced Elite Dangerous Warthog Profile by CMDR Touille---------\x0a"); printf("------------------------------Fly Safe CMDR! o7---------------------------\x0a"); printf("-o/--o/--o/-Aussiedroid-DarKcyde0-WraithMG11235-Synkc-Solarfly-o/--o/--o/-\x0a"); @@ -183,17 +192,17 @@ int main() MapKeyIO(&Throttle, MSR, TEMPO(PULSE+FighterHoldFire, PULSE+FighterAggressive, LongPressDelay), PULSE+SelectWingman3); // RIGHT // -------------------------Coolie Hat Switch - MapKey(&Throttle, CSU, ThrustUp); // UP - MapKey(&Throttle, CSD, ThrustDown); // DOWN - MapKey(&Throttle, CSL, ThrustLeft); // LEFT - MapKey(&Throttle, CSR, ThrustRight); // RIGHT + MapKeyIO(&Throttle, CSU, TEMPO(EXEC("TrimDXAxis(DX_Y_AXIS, - Trim_INC);"), EXEC("TrimDXAxis(DX_X_AXIS, CURRENT);TrimDXAxis(DX_Y_AXIS, CURRENT);"), LongPressDelay), ThrustUp); // UP + MapKeyIO(&Throttle, CSD, TEMPO(EXEC("TrimDXAxis(DX_Y_AXIS, Trim_INC);"), EXEC("TrimDXAxis(DX_X_AXIS, SET(0));TrimDXAxis(DX_Y_AXIS, SET(0));"), LongPressDelay), ThrustDown); // DOWN + MapKeyIO(&Throttle, CSL, EXEC("TrimDXAxis(DX_X_AXIS, -Trim_INC);"), ThrustLeft); // LEFT + MapKeyIO(&Throttle, CSR, EXEC("TrimDXAxis(DX_X_AXIS, Trim_INC);"), ThrustRight); // RIGHT //--THROTTLE ARM SWITCH-----------------------------------------------------------------------------------------------------------------------------------------// // -------------------------Speedbrake MapKey (&Throttle, SPDF, TEMPO(EXEC("initFrameShiftDrive();"), EXEC("initSystemJump();"), ExtraPressDelay)); // Switch FORWARD // MapKey (&Throttle, SPDM, 0); // Switch MIDDLE - MapKeyIO(&Throttle, SPDB, EXEC("initToggleSuperCruiseMode();"), TEMPO(EXEC("initThrottleBoost();"), EXEC("initSuperCruise();"), LongPressDelay)); // Switch BACK HOLD + MapKeyIO(&Throttle, SPDB, EXEC("initToggleSuperCruiseMode();"), TEMPO(EXEC("initThrottleBoost();"), EXEC("initSuperCruise();"), LongPressDelay)); // Switch BACK HOLD // -------------------------Boat Switch MapKey(&Throttle, BSF, PULSE+GalaxyMap); // Switch FORWARD @@ -325,7 +334,7 @@ int main() // MapKey(&RMFD, BRTD, 0); // MapKey(&RMFD, CONU, 0); // MapKey(&RMFD, COND, 0); - if(DebugMode)printf("...Done\x0a"); + if(DebugMode) printf("...Done\x0a"); } //Set Left MFD @@ -356,7 +365,7 @@ int main() // MapKey(&LMFD, BRTD, 0); // MapKey(&LMFD, CONU, 0); // MapKey(&LMFD, COND, 0); - if(DebugMode)printf("...Done\x0a"); + if(DebugMode) printf("...Done\x0a"); } //--------------------------------------------------------------------------------------------------------------------------------------------------------------// @@ -370,7 +379,7 @@ int EventHandle(int type, alias o, int x) // Throttle: LED On-The-FLy Backlight Control if(&o == &Throttle & x == THR_FC & Joystick[S3]){ vThrottleLightBackup = (AxisVal(Throttle[THR_FC], &axdata) - 32766) / 256 * -1; //HOLD S3 on Joystick & Move Friction Control Axis - ActKey(PULSE+KEYON+LED (&Throttle, LED_INTENSITY, vThrottleLightBackup)); + initBACKLIGHT(Throttle_BL, vThrottleLightBackup); } // Combine rudder toe brakes into new axis, mapped to DX_THROTTLE_AXIS diff --git a/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_CORE.tmh b/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_CORE.tmh index 213c6bb..72a99ac 100644 --- a/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_CORE.tmh +++ b/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_CORE.tmh @@ -1,5 +1,5 @@ // Copyright (C) 2017 Thomas Duployez (CMDR Touille) -// V2.2.03.3b 2017/02 +// V2.2.03.3R 2017/02 // Distributed freely under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -96,22 +96,22 @@ if(j != vOptimalPIP){ // Send Good Backup PIPS only if previous PIP Swith is != of Backuped Value //if(DebugMode){printf("Reset PIP ?: PIPRestore [%d] vOptimalPIP [%d]\x0a", j, vOptimalPIP);} if(DebugMode) printf("Restore Previous PIP [%d] (preset PIP 1-12)\x0a",j); - if (j == 0) initPIPPower(); //2 SYS 2 ENG 2 WEP (0) - else if(j == 1) initPIPPower(ENG,SYS); //4 ENG 2 SYS (1) - else if(j == 2) initPIPPower(ENG,WEP); //4 ENG 2 WEP (2) - else if(j == 3) initPIPPower(SYS,ENG); //4 SYS 2 ENG (3) - else if(j == 4) initPIPPower(SYS,WEP); //4 SYS 2 WEP (4) - else if(j == 5) initPIPPower(WEP,ENG); //4 WEP 2 ENG (5) - else if(j == 6) initPIPPower(WEP,SYS); //4 WEP 2 SYS (6) - else if(j == 7) initPIPPower(SYS,ENG,MID); //3 SYS 3 ENG (7) - else if(j == 8) initPIPPower(ENG,WEP,MID); //3 ENG 3 WEP (8) - else if(j == 9) initPIPPower(SYS,WEP,MID); //3 SYS 3 WEP (9) - else if(j == 10)initPIPPower(SYS); //4 SYS 1 ENG 1 WEP (10) - else if(j == 11)initPIPPower(ENG); //4 ENG 1 SYS 1 WEP (11) - else if(j == 12)initPIPPower(WEP); //4 WEP 1 SYS 1 ENG (12) + if (j == 0) initPIPPower(); //2 SYS 2 ENG 2 WEP (0) + else if(j == 1) initPIPPower(ENG,SYS); //4 ENG 2 SYS (1) + else if(j == 2) initPIPPower(ENG,WEP); //4 ENG 2 WEP (2) + else if(j == 3) initPIPPower(SYS,ENG); //4 SYS 2 ENG (3) + else if(j == 4) initPIPPower(SYS,WEP); //4 SYS 2 WEP (4) + else if(j == 5) initPIPPower(WEP,ENG); //4 WEP 2 ENG (5) + else if(j == 6) initPIPPower(WEP,SYS); //4 WEP 2 SYS (6) + else if(j == 7) initPIPPower(SYS,ENG,MID); //3 SYS 3 ENG (7) + else if(j == 8) initPIPPower(ENG,WEP,MID); //3 ENG 3 WEP (8) + else if(j == 9) initPIPPower(SYS,WEP,MID); //3 SYS 3 WEP (9) + else if(j == 10) initPIPPower(SYS); //4 SYS 1 ENG 1 WEP (10) + else if(j == 11) initPIPPower(ENG); //4 ENG 1 SYS 1 WEP (11) + else if(j == 12) initPIPPower(WEP); //4 WEP 1 SYS 1 ENG (12) } else{ - //if(DebugMode) printf("This PIP is Already OK [%d]\x0a", vOptimalPIP); + //if(DebugMode)printf("This PIP is Already OK [%d]\x0a", vOptimalPIP); } } @@ -146,7 +146,7 @@ if(DebugMode) printf("Shut Down Silent Runing\x0a"); initToggleSilentRuning(); } - if(HardPointsonFireGameMode & !sHardPoints){initToggleHardpoints();} //Deploy Hardpoint if HardPointsonFireGameMode is Enable + if(HardPointsonFireGameMode & !sHardPoints) initToggleHardpoints(); //Deploy Hardpoint if HardPointsonFireGameMode is Enable if(OptimalPIPMode & !sExplorerMode){ //Backup Actual PIP Mode initBackupPIPPower(OptimalPIPFireBackup); //Backup Actual PIP Mode OptimalPIPFireBackup (1) initPIPPower(WEP,SYS); //4 WEP 2 SYS (6) @@ -158,10 +158,8 @@ initSecondaryFire(); if(!Joystick[TG1] & !Joystick[S2]){ - if(OptimalPIPMode & !sExplorerMode){ //Restore Previous PIP Mode - initRestorePIPPower(vOptimalPIPFireBackup); //Restore Previous PIP Mode - } - if(HardPointsonFireGameMode & StopFireRetractHardpoints & sHardPoints & !sExplorerMode){initToggleHardpoints();}//Retract Hardpoint if StopFireRetractHardpoints & HardPointsonFireGameMode are Enable + if(OptimalPIPMode & !sExplorerMode) initRestorePIPPower(vOptimalPIPFireBackup); //Restore Previous PIP Mode + if(HardPointsonFireGameMode & StopFireRetractHardpoints & sHardPoints & !sExplorerMode) initToggleHardpoints();//Retract Hardpoint if StopFireRetractHardpoints & HardPointsonFireGameMode are Enable if(vSilentRuningBackup!=0){ //Restore Silent Runing if it was running before fire vSilentRuningBackup = 0; if(DebugMode) printf("Restore Silent Runing\x0a"); @@ -184,7 +182,7 @@ DeferCall(TG1ScanDelay, &ActKey, KEYON+UP+PrimaryFire); //if(DebugMode) printf("TG1 Up ExplorerMode\x0a"); } - else{ActKey(KEYON+UP+PrimaryFire);} //if(DebugMode) printf("TG1 Up\x0a"); + else ActKey(KEYON+UP+PrimaryFire); //if(DebugMode) printf("TG1 Up\x0a"); vPrimaryFire=!vPrimaryFire; } } @@ -201,7 +199,7 @@ DeferCall(S2ScanDelay, &ActKey, KEYON+UP+SecondaryFire); //if(DebugMode) printf("S2 Up ExplorerMode\x0a"); } - else{ActKey(KEYON+UP+SecondaryFire);} //if(DebugMode) printf("S2 Up\x0a"); + else ActKey(KEYON+UP+SecondaryFire); //if(DebugMode) printf("S2 Up\x0a"); vSecondaryFire=!vSecondaryFire; } } @@ -211,13 +209,35 @@ //FUNCTION: Jettison All Cargo int initJettisonCargo(){ if(Throttle[APUON]){ - if(sCargo){ActKey(KEYON+PULSE+JettisonAllCargo);if(DebugMode | DebugMMode) printf("Jettison All Cargo\x0a");} - else { if(DebugMode | DebugMMode) printf("Jettison Need Cargo Scoop Open\x0a");} + if(sCargo){ + ActKey(KEYON+PULSE+JettisonAllCargo); + if(DebugMode | DebugMMode) printf("Jettison All Cargo\x0a"); + } + else{ + if(DebugMode | DebugMMode) printf("Jettison Need Cargo Scoop Open\x0a"); + } } } + //FUNCTION: Engine Boost + int initThrottleBoost(){ +// if(OptimalPIPMode){ +// initBackupPIPPower(OptimalPIPBoostBackup); //Backup Actual PIP Mode OptimalPIPBoostBackup (6) +// initPIPPower(ENG, SYS); //4 ENG 2 SYS (1) +// DeferCall(2000, &initRestorePIPPower, vOptimalPIPBoostBackup); //Restore Previous PIP Mode If vOptimalPIPBoostBackup != 4 ENG 2 SYS (1) +// } + initSecureRectract(); + ActKey(KEYON+PULSE+EngineBoost); + if(DebugMode | DebugMMode) printf("Engine Boost\x0a"); + } + //FUNCTION: Init Supercruise int initSuperCruise(){ +// if(OptimalPIPMode){ +// initBackupPIPPower(OptimalPIPBoostBackup); //Backup Actual PIP Mode OptimalPIPBoostBackup (6) +// initPIPPower(ENG, SYS); //4 ENG 2 SYS (1) +// DeferCall(2000, &initRestorePIPPower, vOptimalPIPBoostBackup); //Restore Previous PIP Mode If vOptimalPIPBoostBackup != 4 ENG 2 SYS (1) +// } initSecureRectract(); ActKey(KEYON+PULSE+Supercruise); if(DebugMode | DebugMMode) printf("Engage SuperCruise\x0a"); @@ -225,6 +245,11 @@ //FUNCTION: Init FrameShiftDrive int initFrameShiftDrive(){ +// if(OptimalPIPMode){ +// initBackupPIPPower(OptimalPIPBoostBackup); //Backup Actual PIP Mode OptimalPIPBoostBackup (6) +// initPIPPower(ENG, SYS); //4 ENG 2 SYS (1) +// DeferCall(2000, &initRestorePIPPower, vOptimalPIPBoostBackup); //Restore Previous PIP Mode If vOptimalPIPBoostBackup != 4 ENG 2 SYS (1) +// } initSecureRectract(); ActKey(KEYON+PULSE+FrameShiftDrive); if(DebugMode | DebugMMode) printf("Engage FSD\x0a"); @@ -238,37 +263,19 @@ int initSecureRectract(){ if(SecureRetract & (sHardPoints | sCargo | sGears)){ //only if SecureRetract is ON & HardPoints or C Scoop Or L Gears is Deployed vSecureEscapeFight=!vSecureEscapeFight; - if(sHardPoints)initToggleHardpoints(); - if(sGears) initToggleLandingGear(); - if(sCargo) initToggleCargoScoop(); + if(sHardPoints) initToggleHardpoints(); + if(sGears) initToggleLandingGear(); + if(sCargo) initToggleCargoScoop(); vSecureEscapeFight=!vSecureEscapeFight; } } - //FUNCTION: Engine Boost Or Use Supercruise while boosting if Throttle is 100% - int initThrottleBoost(){ -// if(OptimalPIPMode){ -// initBackupPIPPower(OptimalPIPBoostBackup); //Backup Actual PIP Mode OptimalPIPBoostBackup (6) -// initPIPPower(ENG, SYS); //4 ENG 2 SYS (1) -// DeferCall(2000, &initRestorePIPPower, vOptimalPIPBoostBackup); //Restore Previous PIP Mode If vOptimalPIPBoostBackup != 4 ENG 2 SYS (1) -// } - if(SupecruiseOnThrottle & AxisVal(Throttle[THR_RIGHT], &axdata) >= 32767){ //Throttle All the Way Up & SupecruiseOnThrottle is Actived? - initSecureRectract(); - ActKey(KEYON+PULSE+Supercruise); - if(DebugMode | DebugMMode) printf("SuperCruise On Throttle Engaged\x0a"); - } - else{ - ActKey(KEYON+PULSE+EngineBoost); - if(DebugMode | DebugMMode) printf("Engine Boost\x0a"); - } - } - //FUNCTION: SystemJump int initSystemJump(){ if(!SecureRetract & (sHardPoints | sCargo | sGears))initFrameShiftDrive();//IF SecureRectract = 0 Engage FSD To match the game mechanic and don't launch the speed to 0 from mSystemJump Macro if HardPoints or Cargo Scoop Or L Gears Deployed else{ initSecureRectract(); - if(OptimalPIPMode){initPIPPower(ENG, SYS);} //4 ENG 2 SYS (1) + if(OptimalPIPMode) initPIPPower(ENG, SYS); //4 ENG 2 SYS (1) ActKey(KEYON+PULSE+mSystemJump); if(DebugMode | DebugMMode) printf("Engage System Jump\x0a"); } @@ -282,7 +289,7 @@ DeferCall(11000, &ActKey, KEYON+PULSE+EXEC("initBACKLIGHT(Throttle_BL, vThrottleLightBackup, 250);")); //Throttle BackLigtt Flashing OFF, we need to Send it again to toggle the flag and stop the flashing //END OF TEST if(!SecureRetract){ //if SecureRetract is Disable - if(DebugMode | DebugMMode){printf("Secure Retract was OFF we switch it to ON for 2 sec for Escaping Fight\x0a");} + if(DebugMode) printf("Secure Retract was OFF we switch it to ON for 2 sec for Escaping Fight\x0a"); SecureRetract=!SecureRetract; //we Enable it DeferCall(2000, &ActKey, KEYON+PULSE+EXEC("SecureRetract=!SecureRetract;")); //Then we Disable it after the initSecureRectract() below is done (2s should be ok) } @@ -300,19 +307,17 @@ ActKey(KEYON+PULSE+mEscapeFight); if(sSilentRuning){ //Disable Silent Runing previouly Enable DeferCall(4000, &ActKey, KEYON+PULSE+EXEC("initToggleSilentRuning();")); - if(vSLonEscapeFight){ - DeferCall(5000, &ActKey, KEYON+PULSE+EXEC("vSLonEscapeFight=!vSLonEscapeFight;")); - } + if(vSLonEscapeFight) DeferCall(5000, &ActKey, KEYON+PULSE+EXEC("vSLonEscapeFight=!vSLonEscapeFight;")); } if(DebugMode | DebugMMode) printf("Escape Mode Engaged : CHECK IF GEARS AND CARGO STATE IS OK (SWITCH CS and LG) \x0a"); } //FUNCTION: Request Docking int initRCDocking(){ - if(DebugMode) printf("Docking Initialisation\x0a"); + if(DebugMode | DebugMMode) printf("Docking Initialisation\x0a"); initSecureRectract(); ActKey(KEYON+PULSE+mRequestCancelDock); - if(OptimalPIPMode){DeferCall(3000, &ActKey, KEYON+PULSE+EXEC("initPIPPower(SYS, ENG);"));} //4 SYS 2 ENG (3) + if(OptimalPIPMode) DeferCall(3000, &ActKey, KEYON+PULSE+EXEC("initPIPPower(SYS, ENG);")); //4 SYS 2 ENG (3) } //--------------------------------------------------------------------------------------------------------------------------------------------------------------// @@ -323,14 +328,23 @@ int initFPSCONNECTION(){ ActKey(KEYON+PULSE+ShowFramerate); ActKey(KEYON+PULSE+ShowConnectionStatus); - if(DebugMode)printf("FPS & CONNECTION STATUS\x0a"); + if(DebugMode) printf("FPS & CONNECTION STATUS\x0a"); } //FUNCTION: Head Center int initHeadCenter(){ - if (HMD) {ActKey(KEYON+PULSE+HMDCenter); if(DebugMode)printf("HMD Center\x0a");} - else if(TrackIR){ActKey(KEYON+PULSE+TrackIRCenter); if(DebugMode)printf("TrackIR Center\x0a");} - else {ActKey(KEYON+PULSE+UIFocus); if(DebugMode)printf("UI Focus\x0a");} + if(HMD){ + ActKey(KEYON+PULSE+HMDCenter); + if(DebugMode) printf("HMD Center\x0a"); + } + else if(TrackIR){ + ActKey(KEYON+PULSE+TrackIRCenter); + if(DebugMode) printf("TrackIR Center\x0a"); + } + else{ + ActKey(KEYON+PULSE+UIFocus); + if(DebugMode) printf("UI Focus\x0a"); + } } //FUNCTION: Capture Video @@ -339,15 +353,17 @@ sNVidiaCaptureVideo=!sNVidiaCaptureVideo; ActKey(KEYON+PULSE+NVidiaCaptureVideo); initLED(NVidiaCaptureVideo_LED, sNVidiaCaptureVideo, 500); - if(DebugMode | DebugMMode)printf("NVidia ShadowPlay Capture Video [%d]\x0a", sNVidiaCaptureVideo); + if(DebugMode | DebugMMode) printf("NVidia ShadowPlay Capture Video [%d]\x0a", sNVidiaCaptureVideo); } else if(GFXVideo == 2){ //AMD Relive sAMDCaptureVideo=!sAMDCaptureVideo; ActKey(KEYON+PULSE+AMDCaptureVideo); initLED(AMDCaptureVideo_LED, sAMDCaptureVideo, 500); - if(DebugMode | DebugMMode)printf("AMD Relive Capture Video [%d]\x0a", sAMDCaptureVideo); + if(DebugMode | DebugMMode) printf("AMD Relive Capture Video [%d]\x0a", sAMDCaptureVideo); + } + else{ + if(DebugMode | DebugMMode) printf("No Software selected for Capture Video\x0a"); //None } - else { if(DebugMode | DebugMMode)printf("No Software selected for Capture Video\x0a");} //None } //FUNCTION: Streaming Video @@ -356,15 +372,17 @@ sNVidiaStreaming=!sNVidiaStreaming; ActKey(KEYON+PULSE+NVidiaStreaming); initLED(NVidiaStreaming_LED, sNVidiaStreaming, 250); - if(DebugMode | DebugMMode)printf("NVidia ShadowPlay Streaming [%d]\x0a", sNVidiaStreaming); + if(DebugMode | DebugMMode) printf("NVidia ShadowPlay Streaming [%d]\x0a", sNVidiaStreaming); } else if(GFXVideo == 2){ //AMD Relive sAMDStreaming=!sAMDStreaming; ActKey(KEYON+PULSE+AMDStreaming); initLED(AMDStreaming_LED, sAMDStreaming, 250); - if(DebugMode | DebugMMode)printf("AMD Relive Streaming [%d]\x0a", sAMDStreaming); + if(DebugMode | DebugMMode) printf("AMD Relive Streaming [%d]\x0a", sAMDStreaming); + } + else{ + if(DebugMode | DebugMMode) printf("No Software selected for Streaming Video\x0a"); //None } - else { if(DebugMode | DebugMMode)printf("No Software selected for Streaming\x0a");} //None } //FUNCTION: Screenshot @@ -375,12 +393,12 @@ // if(DebugMode)printf("HD Screenshot\x0a"); //}else{ ActKey(KEYON+PULSE+Screenshot); - if(DebugMode | DebugMMode)printf("Screenshot\x0a"); + if(DebugMode | DebugMMode) printf("Screenshot\x0a"); //} } else{ ActKey(KEYON+PULSE+TakeSteamScreenshot); - if(DebugMode | DebugMMode)printf("Steam Screenshot\x0a"); + if(DebugMode | DebugMMode) printf("Steam Screenshot\x0a"); } } @@ -395,7 +413,7 @@ ActKey(KEYON+PULSE+vPTT); if(DebugMode) printf("Mic Toggle [%d] [Actived[1] DesActived[0] / PTT [%d] [External:[0]Internal:[1]] / Mode [%d] [HOLD:[0] TOGGLE:[1]]\x0a", vVoicePTT, sPTTState, sPTTMode); } - else{ActKey(KEYON+DOWN+vPTT);} //Talk [HOLD] + else ActKey(KEYON+DOWN+vPTT); //Talk [HOLD] } if(!Throttle[MSP] & !sPTTMode){ //Silence [HOLD] vVoicePTT=!vVoicePTT; diff --git a/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_HARDWARE.tmh b/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_HARDWARE.tmh index 7644ffc..5558343 100644 --- a/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_HARDWARE.tmh +++ b/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_HARDWARE.tmh @@ -1,5 +1,5 @@ // Copyright (C) 2017 Thomas Duployez (CMDR Touille) -// V2.2.03.3b 2017/02 +// V2.2.03.3R 2017/02 // Distributed freely under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -27,28 +27,31 @@ // -------------------------LED & BACKLIGHT FUNCTIONS //--------------------------------------------------------------------------------------------------------------------------------------------------------------// -// -------------------------INITIALISATION OF LED & THROTTLE BACLIGHT +// -------------------------INITIALISATION OF LED & THROTTLE BACKLIGHT int initLEDStates(){ - - //Initiate Throttle Backlight (0-255) - if(HMD){vThrottleLightBackup = ThrottleLightHMD; initBACKLIGHT(Throttle_BL, ThrottleLightHMD); if(DebugMode | DebugMMode)printf("HMD -> Backlight IDLE Throttle LED Set to %d\x0a", ThrottleLightHMD);} //With HMD - else {vThrottleLightBackup = ThrottleLight; initBACKLIGHT(Throttle_BL, ThrottleLight);if(DebugMode | DebugMMode)printf("No HMD Or TrackIR -> Backlight IDLE Throttle LED Set to %d\x0a", vThrottleLight);} //Without HMD - - //Initiate MFD's Backlight power (0-255) - if(USEMFD > 0){initBACKLIGHT(RMFD_BL, RMFDLight);} - if(USEMFD > 1){initBACKLIGHT(LMFD_BL, LMFDLight);} - //Initiate LED status all OFF + if(HMD){ //Initiate Throttle Backlight with HMD + vThrottleLightBackup = ThrottleLightHMD; + initBACKLIGHT(Throttle_BL, ThrottleLightHMD); + if(DebugMode | DebugMMode) printf("HMD -> Backlight IDLE Throttle LED Set to %d\x0a", ThrottleLightHMD); + } + else{ //Initiate Throttle Backlight without HMD + vThrottleLightBackup = ThrottleLight; + initBACKLIGHT(Throttle_BL, ThrottleLight); + if(DebugMode | DebugMMode) printf("No HMD Or TrackIR -> Backlight IDLE Throttle LED Set to %d\x0a", vThrottleLight); + } GameOutput(&Throttle, OUT_ID_LED_1, 0); //set Throttle LED 1 OFF GameOutput(&Throttle, OUT_ID_LED_2, 0); //set Throttle LED 2 OFF GameOutput(&Throttle, OUT_ID_LED_3, 0); //set Throttle LED 3 OFF GameOutput(&Throttle, OUT_ID_LED_4, 0); //set Throttle LED 4 OFF GameOutput(&Throttle, OUT_ID_LED_5, 0); //set Throttle LED 5 OFF if(USEMFD > 0){ + initBACKLIGHT(RMFD_BL, RMFDLight); //Set right MFD Backlight GameOutput(&RMFD, OUT_ID_LED_1, 0); //set right MFD LED 1 OFF GameOutput(&RMFD, OUT_ID_LED_2, 0); //set right MFD LED 2 OFF } if(USEMFD > 1){ + initBACKLIGHT(LMFD_BL, LMFDLight); //Set left MFD Backlight GameOutput(&LMFD, OUT_ID_LED_1, 0); //set left MFD LED 1 OFF GameOutput(&LMFD, OUT_ID_LED_2, 0); //set left MFD LED 2 OFF } @@ -98,27 +101,41 @@ //ex : initLED(ToogleNVidiaCaptureVideoLED, sNVidiaCaptureVideo, 250); --> Flashing LED (chose wich one in settings) with 250ms delay (2 flash / sec) according the sNVidiaCaptureVideo state //ex : initLED(LED1, 1, 125); --> Flashing LED1 with 125ms delay int initLED(int t = 0, int v = 0, int ms = 0){ + //Toggle LED if(t!=0 & ms == 0){ //LED Selected in Settings file & No Delay, Toggle LED ON/OFF - //Check Which Device + + //Check Which Device if (t == LED1 | t == LED2 | t == LED3 | t == LED4 | t == LED5) LED_DEVICE = &Throttle; else if(t == RMFD_LED1 | t == RMFD_LED2) LED_DEVICE = &RMFD; else if(t == LMFD_LED1 | t == LMFD_LED2) LED_DEVICE = &LMFD; - else if(DebugMode) printf("LED should be LED1, LED2, LED3, LED4, LED5 OR RMFD_LED1, RMFD_LED2, LMFD_LED1, LMFD_LED2\x0a"); - //Check Which LED Outpout + else{ + if(DebugMode) printf("LED should be LED1, LED2, LED3, LED4, LED5 OR RMFD_LED1, RMFD_LED2, LMFD_LED1, LMFD_LED2\x0a"); + } + + //Check Which LED Outpout if (t == LED1 | t == LMFD_LED1 | t == RMFD_LED1) LED_OUTPOUT = OUT_ID_LED_1; else if(t == LED2 | t == LMFD_LED2 | t == RMFD_LED2) LED_OUTPOUT = OUT_ID_LED_2; else if(t == LED3) LED_OUTPOUT = OUT_ID_LED_3; else if(t == LED4) LED_OUTPOUT = OUT_ID_LED_4; else if(t == LED5) LED_OUTPOUT = OUT_ID_LED_5; - else if(DebugMode) printf("LED should be LED1, LED2, LED3, LED4, LED5 OR RMFD_LED1, RMFD_LED2, LMFD_LED1, LMFD_LED2\x0a"); - //Push LED Toggle + else{ + if(DebugMode) printf("LED should be LED1, LED2, LED3, LED4, LED5 OR RMFD_LED1, RMFD_LED2, LMFD_LED1, LMFD_LED2\x0a"); + } + + //Push LED Toggle GameOutput(LED_DEVICE, LED_OUTPOUT, v); } + //Or Push LED Flashing else if(t!= 0 & ms !=0){ //LED Selected in Settings file & Delay, Flashing LED if(v == 1){ //OFF or ON? If ON Flash LED - if (ms < 250) {ms = 250;}else if(ms > 2000){ms = 2000;} //Flashing btw 250ms & 2000ms (2sec) + + //Flashing btw 250ms & 2000ms (2sec) + if(ms < 250) ms = 250; + else if(ms > 2000) ms = 2000; + + //Push LED Flashing if (t == LED1) {flagHover_T_LED1=!flagHover_T_LED1; flashing_T_LED1(ms);} else if(t == LED2) {flagHover_T_LED2=!flagHover_T_LED2; flashing_T_LED2(ms);} else if(t == LED3) {flagHover_T_LED3=!flagHover_T_LED3; flashing_T_LED3(ms);} @@ -128,23 +145,25 @@ else if(t == RMFD_LED2){flagHover_RMFD_LED2=!flagHover_RMFD_LED2;flashing_RMFD_LED2(ms);} else if(t == LMFD_LED1){flagHover_LMFD_LED1=!flagHover_LMFD_LED1;flashing_LMFD_LED1(ms);} else if(t == LMFD_LED2){flagHover_LMFD_LED2=!flagHover_LMFD_LED2;flashing_LMFD_LED2(ms);} - else if(DebugMode) printf("LED should be LED1, LED2, LED3, LED4, LED5 OR RMFD_LED1, RMFD_LED2, LMFD_LED1, LMFD_LED2\x0a"); + else{ + if(DebugMode) printf("LED should be LED1, LED2, LED3, LED4, LED5 OR RMFD_LED1, RMFD_LED2, LMFD_LED1, LMFD_LED2\x0a"); + } } } } //FUNCTIONS: Flashing Throttle LED's (FOR NOW THEY WILL RETURN TO 0 (OFF) STATES : WILL CHECK LATER TO MAKE THEM ON/OFF -> FLASH -> ON/OFF, INSTEAD OF ON/OFF -> FLASH -> OFF) - int flashing_T_LED1(int ms = 0){if(flagHover_T_LED1 > 0){GameOutput(&Throttle, OUT_ID_LED_1, 2);DeferCall(ms, &flashing_T_LED1, ms);} else {GameOutput(&Throttle, OUT_ID_LED_1, 0);}} - int flashing_T_LED2(int ms = 0){if(flagHover_T_LED2 > 0){GameOutput(&Throttle, OUT_ID_LED_2, 2);DeferCall(ms, &flashing_T_LED2, ms);} else {GameOutput(&Throttle, OUT_ID_LED_2, 0);}} - int flashing_T_LED3(int ms = 0){if(flagHover_T_LED3 > 0){GameOutput(&Throttle, OUT_ID_LED_3, 2);DeferCall(ms, &flashing_T_LED3, ms);} else {GameOutput(&Throttle, OUT_ID_LED_3, 0);}} - int flashing_T_LED4(int ms = 0){if(flagHover_T_LED4 > 0){GameOutput(&Throttle, OUT_ID_LED_4, 2);DeferCall(ms, &flashing_T_LED4, ms);} else {GameOutput(&Throttle, OUT_ID_LED_4, 0);}} - int flashing_T_LED5(int ms = 0){if(flagHover_T_LED5 > 0){GameOutput(&Throttle, OUT_ID_LED_5, 2);DeferCall(ms, &flashing_T_LED5, ms);} else {GameOutput(&Throttle, OUT_ID_LED_5, 0);}} + int flashing_T_LED1 (int ms = 0){ if(flagHover_T_LED1 > 0) {GameOutput(&Throttle, OUT_ID_LED_1, 2);DeferCall(ms, &flashing_T_LED1, ms);} else {GameOutput(&Throttle, OUT_ID_LED_1, 0);}} + int flashing_T_LED2 (int ms = 0){ if(flagHover_T_LED2 > 0) {GameOutput(&Throttle, OUT_ID_LED_2, 2);DeferCall(ms, &flashing_T_LED2, ms);} else {GameOutput(&Throttle, OUT_ID_LED_2, 0);}} + int flashing_T_LED3 (int ms = 0){ if(flagHover_T_LED3 > 0) {GameOutput(&Throttle, OUT_ID_LED_3, 2);DeferCall(ms, &flashing_T_LED3, ms);} else {GameOutput(&Throttle, OUT_ID_LED_3, 0);}} + int flashing_T_LED4 (int ms = 0){ if(flagHover_T_LED4 > 0) {GameOutput(&Throttle, OUT_ID_LED_4, 2);DeferCall(ms, &flashing_T_LED4, ms);} else {GameOutput(&Throttle, OUT_ID_LED_4, 0);}} + int flashing_T_LED5 (int ms = 0){ if(flagHover_T_LED5 > 0) {GameOutput(&Throttle, OUT_ID_LED_5, 2);DeferCall(ms, &flashing_T_LED5, ms);} else {GameOutput(&Throttle, OUT_ID_LED_5, 0);}} //FUNCTIONS: Flashing MFD's LED's (FOR NOW THEY WILL RETURN TO 0 (OFF) STATES : WILL CHECK LATER TO MAKE THEM ON/OFF -> FLASH -> ON/OFF, INSTEAD OF ON/OFF -> FLASH -> OFF) - int flashing_RMFD_LED1(int ms = 0){if(flagHover_RMFD_LED1 > 0){GameOutput(&RMFD, OUT_ID_LED_1, 2);DeferCall(ms, &flashing_RMFD_LED1, ms);} else {GameOutput(&RMFD, OUT_ID_LED_1, 0);}} - int flashing_RMFD_LED2(int ms = 0){if(flagHover_RMFD_LED2 > 0){GameOutput(&RMFD, OUT_ID_LED_2, 2);DeferCall(ms, &flashing_RMFD_LED2, ms);} else {GameOutput(&RMFD, OUT_ID_LED_2, 0);}} - int flashing_LMFD_LED1(int ms = 0){if(flagHover_LMFD_LED1 > 0){GameOutput(&LMFD, OUT_ID_LED_1, 2);DeferCall(ms, &flashing_LMFD_LED1, ms);} else {GameOutput(&LMFD, OUT_ID_LED_1, 0);}} - int flashing_LMFD_LED2(int ms = 0){if(flagHover_LMFD_LED2 > 0){GameOutput(&LMFD, OUT_ID_LED_2, 2);DeferCall(ms, &flashing_LMFD_LED2, ms);} else {GameOutput(&LMFD, OUT_ID_LED_2, 0);}} + int flashing_RMFD_LED1(int ms = 0){ if(flagHover_RMFD_LED1 > 0){GameOutput(&RMFD, OUT_ID_LED_1, 2); DeferCall(ms, &flashing_RMFD_LED1, ms);} else {GameOutput(&RMFD, OUT_ID_LED_1, 0);}} + int flashing_RMFD_LED2(int ms = 0){ if(flagHover_RMFD_LED2 > 0){GameOutput(&RMFD, OUT_ID_LED_2, 2); DeferCall(ms, &flashing_RMFD_LED2, ms);} else {GameOutput(&RMFD, OUT_ID_LED_2, 0);}} + int flashing_LMFD_LED1(int ms = 0){ if(flagHover_LMFD_LED1 > 0){GameOutput(&LMFD, OUT_ID_LED_1, 2); DeferCall(ms, &flashing_LMFD_LED1, ms);} else {GameOutput(&LMFD, OUT_ID_LED_1, 0);}} + int flashing_LMFD_LED2(int ms = 0){ if(flagHover_LMFD_LED2 > 0){GameOutput(&LMFD, OUT_ID_LED_2, 2); DeferCall(ms, &flashing_LMFD_LED2, ms);} else {GameOutput(&LMFD, OUT_ID_LED_2, 0);}} //FUNCTIONS: PANIC LED STATES (For the FUN :) ) int init_PANIC_LED(int ms = 0){ @@ -172,10 +191,10 @@ DeferCall(ms*7 , &ActKey, KEYON+PULSE+LED(&Throttle, LED_ONOFF, LED_CURRENT^LED4)); DeferCall(ms*5 , &ActKey, KEYON+PULSE+LED(&Throttle, LED_ONOFF, LED_CURRENT^LED5)); DeferCall(ms*6 , &ActKey, KEYON+PULSE+LED(&Throttle, LED_ONOFF, LED_CURRENT^LED5)); - //if(DebugMode){printf("PANIC LED\x0a");} DeferCall(ms*11, &init_PANIC_LED, ms); + //if(DebugMode) printf("PANIC LED\x0a"); } - else{PANIC_LED = 6;} + else PANIC_LED = 6; } // -------------------------BACKLIGHT FUNCTIONS @@ -184,59 +203,69 @@ //ex : initBACKLIGHT(Throttle_BL, vThrottleLightBackup, 500); --> Throttle BackLight(backup) Flashing with 500ms delay //ex : initBACKLIGHT(LMFD_BL, 150, 250); --> Left MFD BackLight Flashing with 150 intensity with 250ms delay int initBACKLIGHT(int a = 0, int v = 0, int ms = 0){ - if (v < 0) {v = 0;} else if(v > 255) {v = 255;} //If v is out of Standard value : Replace with min or max value + + //If v is out of Standard value : Replace with min or max value + if(v < 0) v = 0; + else if(v > 255) v = 255; //Check which Device - if (a == Throttle_BL)BACKLIGHT_DEVICE = &Throttle; - else if(a == RMFD_BL )BACKLIGHT_DEVICE = &RMFD; - else if(a == LMFD_BL )BACKLIGHT_DEVICE = &LMFD; - - else if(DebugMode){printf("BACKLIGHT_DEVICE Not Configured Correctly\x0a");} + if (a == Throttle_BL) BACKLIGHT_DEVICE = &Throttle; + else if(a == RMFD_BL ) BACKLIGHT_DEVICE = &RMFD; + else if(a == LMFD_BL ) BACKLIGHT_DEVICE = &LMFD; + else{ + if(DebugMode) printf("BACKLIGHT_DEVICE Not Configured Correctly\x0a"); + } //Change Backlight Intensity? - if (a == Throttle_BL & v != 0){GameOutput(BACKLIGHT_DEVICE, OUT_ID_LED_INTENSITY, v);} - else if(a == RMFD_BL & v != 0){GameOutput(BACKLIGHT_DEVICE, OUT_ID_LED_INTENSITY, v);} - else if(a == LMFD_BL & v != 0){GameOutput(BACKLIGHT_DEVICE, OUT_ID_LED_INTENSITY, v);} + if (a == Throttle_BL & v != 0) GameOutput(BACKLIGHT_DEVICE, OUT_ID_LED_INTENSITY, v); + else if(a == RMFD_BL & v != 0) GameOutput(BACKLIGHT_DEVICE, OUT_ID_LED_INTENSITY, v); + else if(a == LMFD_BL & v != 0) GameOutput(BACKLIGHT_DEVICE, OUT_ID_LED_INTENSITY, v); //Push BackLight Toggle Or Flashing? if(ms == 0){ //No Delay, Push BackLight Toggle - if(v > 0)GameOutput(BACKLIGHT_DEVICE, OUT_ID_LED_BACKLIGHT, 1); - else GameOutput(BACKLIGHT_DEVICE, OUT_ID_LED_BACKLIGHT, 0); + if(v > 0) GameOutput(BACKLIGHT_DEVICE, OUT_ID_LED_BACKLIGHT, 1); + else GameOutput(BACKLIGHT_DEVICE, OUT_ID_LED_BACKLIGHT, 0); } - else if(ms != 0 & v !=0){ //Delay, Push BackLight Flashing If BackLight Value (v) if OFF (0) we don't see Flashing ... - if(ms < 250) {ms = 250;}else if(ms > 2000){ms = 2000;} //Flashing btw 250ms & 2000ms (2sec) - if (BACKLIGHT_DEVICE == &Throttle){flagHover_T_BL =!flagHover_T_BL ; flashing_T_BL(ms) ;} + else if(ms != 0 & v !=0){ //Delay, Push BackLight Flashing + + //Flashing btw 250ms & 2000ms (2sec) + if(ms < 250) ms = 250; + else if(ms > 2000) ms = 2000; + + //Push BackLight Flashing + if(BACKLIGHT_DEVICE == &Throttle) {flagHover_T_BL =!flagHover_T_BL ; flashing_T_BL(ms) ;} else if(BACKLIGHT_DEVICE == &RMFD){flagHover_RMFD_BL=!flagHover_RMFD_BL; flashing_RMFD_BL(ms);} else if(BACKLIGHT_DEVICE == &LMFD){flagHover_LMFD_BL=!flagHover_LMFD_BL; flashing_LMFD_BL(ms);} - else if(DebugMode){printf("Flashing BACKLIGHT_DEVICE Not Configured Correctly\x0a");} + else{ + if(DebugMode) printf("Flashing BACKLIGHT_DEVICE Not Configured Correctly\x0a"); + } + } + else{ + if(DebugMode) printf("Trying to Flash OFF BackLight ???\x0a"); } - else if(DebugMode) printf("Trying to Flash OFF BackLight ???\x0a"); } //FUNCTIONS: Flashing Throttle BackLight int flashing_T_BL(int ms = 0){ //Throttle BackLight - if(flagHover_T_BL > 0){GameOutput(&Throttle, OUT_ID_LED_BACKLIGHT, 2);DeferCall(ms, &flashing_T_BL, ms); //Falshing Throttle BackLight - } + if(flagHover_T_BL > 0){GameOutput(&Throttle, OUT_ID_LED_BACKLIGHT, 2); DeferCall(ms, &flashing_T_BL, ms);} //Falshing Throttle BackLight else{ - if(vThrottleLightBackup != 0)GameOutput(&Throttle, OUT_ID_LED_BACKLIGHT, 1); //Throttle BackLight was ON - else GameOutput(&Throttle, OUT_ID_LED_BACKLIGHT, 0); //Throttle BackLight wasOFF + if(vThrottleLightBackup != 0) GameOutput(&Throttle, OUT_ID_LED_BACKLIGHT, 1); //Throttle BackLight was ON + else GameOutput(&Throttle, OUT_ID_LED_BACKLIGHT, 0); //Throttle BackLight wasOFF } } //FUNCTIONS: Flashing MFD BackLight int flashing_RMFD_BL(int ms = 0){ //RMFD BackLight - if(flagHover_RMFD_BL > 0){GameOutput(&RMFD, OUT_ID_LED_BACKLIGHT, 2);DeferCall(ms, &flashing_RMFD_BL, ms); //Falshing RMFD BackLight - } + if(flagHover_RMFD_BL > 0){GameOutput(&RMFD, OUT_ID_LED_BACKLIGHT, 2); DeferCall(ms, &flashing_RMFD_BL, ms);} //Falshing RMFD BackLight else{ - if(vRMFDLightBackup != 0)GameOutput(&RMFD, OUT_ID_LED_BACKLIGHT, 1); //RMFD BackLight was ON - else GameOutput(&RMFD, OUT_ID_LED_BACKLIGHT, 0); //RMFD BackLight was OFF + if(vRMFDLightBackup != 0) GameOutput(&RMFD, OUT_ID_LED_BACKLIGHT, 1); //RMFD BackLight was ON + else GameOutput(&RMFD, OUT_ID_LED_BACKLIGHT, 0); //RMFD BackLight was OFF } } int flashing_LMFD_BL(int ms = 0){ //LMFD BackLight - if(flagHover_LMFD_BL > 0){GameOutput(&LMFD, OUT_ID_LED_BACKLIGHT, 2);DeferCall(ms, &flashing_LMFD_BL, ms); //Falshing LMFD BackLight - } + if(flagHover_LMFD_BL > 0){GameOutput(&LMFD, OUT_ID_LED_BACKLIGHT, 2); DeferCall(ms, &flashing_LMFD_BL, ms);} //Falshing LMFD BackLight else{ - if(vLMFDLightBackup != 0)GameOutput(&LMFD, OUT_ID_LED_BACKLIGHT, 1); //LMFD BackLight was ON - else GameOutput(&LMFD, OUT_ID_LED_BACKLIGHT, 0); //LMFD BackLight was OFF + if(vLMFDLightBackup != 0) GameOutput(&LMFD, OUT_ID_LED_BACKLIGHT, 1); //LMFD BackLight was ON + else GameOutput(&LMFD, OUT_ID_LED_BACKLIGHT, 0); //LMFD BackLight was OFF } } @@ -266,10 +295,10 @@ //Joystick Curve Initialising int initJoystickCurves(){ - float Zsc; //Zoom Scale Curve Correction - if(CenterJoystickMount){Zsc = ZoomScale(JoystickAngle);} //Center Joystick mount : check the Joystick angle - else{Zsc = 0;} //else angle should be 0 + + if(CenterJoystickMount) Zsc = ZoomScale(JoystickAngle); //Center Joystick mount : check the Joystick angle + else Zsc = 0; //else angle should be 0 SetSCurve(&Joystick, JOYX, 0, JS_DEADZONE, 0, JS_CURVE[vJoystickCurveProfile], JS_ZOOM[vJoystickCurveProfile]+Zsc); SetSCurve(&Joystick, JOYY, 0, JS_DEADZONE, 0, JS_CURVE[vJoystickCurveProfile], JS_ZOOM[vJoystickCurveProfile]+Zsc); @@ -308,15 +337,15 @@ int initSetThrottleCurves(){ vThrottleCurveProfile=!vThrottleCurveProfile; if(vThrottleCurveProfile){ - if(!AfterburnerDetent)SetJCurve(&Throttle, THR_RIGHT, 50, 50); //Without Warthog Physical Afterburner Detent - else SetJCurve(&Throttle, THR_RIGHT, 65, 95); //Or With Detent. At 65% of the physical controller’s axis travel, the DirectX axis must have reached 95% of the axis value. + if(!AfterburnerDetent) SetJCurve(&Throttle, THR_RIGHT, 50, 50); //Without Warthog Physical Afterburner Detent + else SetJCurve(&Throttle, THR_RIGHT, 65, 95); //Or With Detent. At 65% of the physical controller’s axis travel, the DirectX axis must have reached 95% of the axis value. } else{ - if(ThrottleAxisRange)SetSCurve(&Throttle, THR_RIGHT, 0, 0, 0, 2, -3); //Full Range Precision - else SetSCurve(&Throttle, THR_RIGHT, 0, 0, 0, 3, -3); //Forward only Precision + if(ThrottleAxisRange) SetSCurve(&Throttle, THR_RIGHT, 0, 0, 0, 2, -3); //Full Range Precision + else SetSCurve(&Throttle, THR_RIGHT, 0, 0, 0, 3, -3); //Forward only Precision } DXAxis(DX_Z_AXIS, -AxisVal(Throttle[THR_RIGHT], &axdata)); - if(DebugMode)printf("Set Throttle Curve Profile [%d]\x0a", vThrottleCurveProfile); + if(DebugMode) printf("Set Throttle Curve Profile [%d]\x0a", vThrottleCurveProfile); } //--------------------------------------------------------------------------------------------------------------------------------------------------------------// diff --git a/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_TOGGLE.tmh b/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_TOGGLE.tmh index 7df0c56..b8d6372 100644 --- a/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_TOGGLE.tmh +++ b/Thrustmaster Warthog Script/ED+HCS v2.2_Functions_TOGGLE.tmh @@ -1,5 +1,5 @@ // Copyright (C) 2017 Thomas Duployez (CMDR Touille) -// V2.2.03.3b 2017/02 +// V2.2.03.3R 2017/02 // Distributed freely under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -26,9 +26,15 @@ //TOGGLE: Menu and LED OFF on Idle (Check PERSONAL SETTINGS in Settings File) int initToggleIDLEonThrottle(){ if(!Joystick[S3]){ //Reset On The FLY S3 + SWITCH - if(Throttle[IDLELON]){sIDLE = 1; initBACKLIGHT(Throttle_BL, ThrottleLightOnIDLE);} - else {sIDLE = 0; initBACKLIGHT(Throttle_BL, vThrottleLightBackup);} - if(GameMenuOnIDLE)initGameMenu(); //If GameMenu on IDLE Option is 1, Launch Game Menu + if(Throttle[IDLELON]){ + sIDLE = 1; + initBACKLIGHT(Throttle_BL, ThrottleLightOnIDLE); + } + else{ + sIDLE = 0; + initBACKLIGHT(Throttle_BL, vThrottleLightBackup); + } + if(GameMenuOnIDLE) initGameMenu(); //If GameMenu on IDLE Option is 1, Launch Game Menu initLED(IDLEOnThrottle_LED, sIDLE); if(DebugMode | DebugMMode) printf("IDLE On Throttle [%d] [ENABLE:[1] DISABLE:[0]]\x0a", sIDLE); } @@ -82,15 +88,21 @@ //TOGGLE: Supecruise On Throttle Mode int initToggleSuperCruiseMode(){ SupecruiseOnThrottle=!SupecruiseOnThrottle; + //If No Hardware AfetrBurner Detent & SupecruiseOnThrottle is Enable : SuperCruise if Throttle > 99% axis + if (SupecruiseOnThrottle & !AfterburnerDetent) KeyAxis(&Throttle, THR_RIGHT, 0, AXMAP1(LIST(0,99,100), EXEC("initSecureRectract();ActKey(KEYON+PULSE+Supercruise);"), 0)); + //If Hardware AfetrBurner Detent & SupecruiseOnThrottle is Enable : SuperCruise if Throttle > 80% axis + else if(SupecruiseOnThrottle & AfterburnerDetent) KeyAxis(&Throttle, THR_RIGHT, 0, AXMAP1(LIST(0,80,100), EXEC("initSecureRectract();ActKey(KEYON+PULSE+Supercruise);"), 0)); + //If SupecruiseOnThrottle is Disable : Do nothing on axis + else KeyAxis(&Throttle, THR_RIGHT, 0, AXMAP1(LIST(0), 0, 0)); initLED(SupecruiseOnThrottle_LED, SupecruiseOnThrottle); - if(DebugMode | DebugMMode) printf("Supecruise On Throttle [%d] [ON:[1] OFF:[0]]\x0a", SupecruiseOnThrottle); + if(DebugMode | DebugMMode) printf("Supecruise On Throttle [%d] [ENABLE:[1] DISABLE:[0]]\x0a", SupecruiseOnThrottle); } //TOGGLE: Combined Fire int initToggleCombinedFire(){ sCombinedFire=!sCombinedFire; - if(sCombinedFire){MapKey(&Joystick, TG2, CHAIN(PrimaryFire, SecondaryFire));} //Combine Primary & Secondary Fire on TG2 - else {MapKey(&Joystick, TG2, 0);} //Separate Primary & Secondary Fire Press TG2 do Nothing + if(sCombinedFire) MapKey(&Joystick, TG2, CHAIN(PrimaryFire, SecondaryFire)); //Combine Primary & Secondary Fire on TG2 + else MapKey(&Joystick, TG2, 0); //Separate Primary & Secondary Fire Press TG2 do Nothing initLED(CombinedFire_LED, sCombinedFire); if(DebugMode | DebugMMode) printf("Primary & Secondary Fire [%d] [COMBINED:[1] SEPARATE[0]]\x0a", sCombinedFire); } @@ -130,7 +142,7 @@ if(!Joystick[S3]){ if(vSecureEscapeFight){ //If initSecureRectract() initialise This sGears=!sGears; - if(DebugMode | DebugMMode)printf("Landing Gear SecureEscapeFight : Toggle the Switch\x0a"); + if(DebugMode | DebugMMode) printf("Landing Gear SecureEscapeFight : Toggle the Switch\x0a"); } else{ //Or Change the flag status with the switch position if(Throttle[EACON]) sGears = 1; //Switch position is UP : Landing Gear Is Deployed @@ -144,7 +156,9 @@ vLG=!vLG; //Reset On The FLY : Just switch ActKey(KEYON+PULSE+LandingGear); } - else{if(DebugMode | DebugMMode) printf("Landing Gear Reset On The Fly\x0a");} + else{ + if(DebugMode | DebugMMode) printf("Landing Gear Reset On The Fly\x0a"); + } } else{ //Reset The Flag On The FLY S3 + SWITCH vLG=!vLG; @@ -152,7 +166,7 @@ if(DebugMode | DebugMMode) printf("Landing Gear Reset On The Fly with S3\x0a"); } initLED(LandingGear_LED, sGears); - if(DebugMode)printf("Landing Gear [%d] [DEPLOYED:[1] RETRACTED:[0]]\x0a", sGears); + if(DebugMode) printf("Landing Gear [%d] [DEPLOYED:[1] RETRACTED:[0]]\x0a", sGears); } //TOGGLE: Cargo Scoop @@ -160,7 +174,7 @@ if(!Joystick[S3]){ if(vSecureEscapeFight){ //If initSecureRectract() initialise This sCargo=!sCargo; - if(DebugMode | DebugMMode)printf("Cargo Scoop SecureEscapeFight : Toggle the Switch\x0a"); + if(DebugMode | DebugMMode) printf("Cargo Scoop SecureEscapeFight : Toggle the Switch\x0a"); } else{ //Or Change the flag status with the switch position if(Throttle[RDRNRM]) sCargo = 1; //Switch position is UP : Cargo Scoop Is Deployed @@ -174,7 +188,9 @@ vCS=!vCS; //Reset On The FLY : Just switch ActKey(KEYON+PULSE+CargoScoop); } - else{if(DebugMode | DebugMMode) printf("Cargo Scoop Reset On The Fly\x0a");} + else{ + if(DebugMode | DebugMMode) printf("Cargo Scoop Reset On The Fly\x0a"); + } } else{ //Reset The Flag On The FLY S3 + SWITCH vCS=!vCS; @@ -182,7 +198,7 @@ if(DebugMode | DebugMMode) printf("Cargo Scoop Reset On The Fly with S3\x0a"); } initLED(CargoScoop_LED, sCargo); - if(DebugMode)printf("Cargo Scoop [%d] [DEPLOYED:[1] RETRACTED:[0]]\x0a", sCargo); + if(DebugMode) printf("Cargo Scoop [%d] [DEPLOYED:[1] RETRACTED:[0]]\x0a", sCargo); } //TOGGLE: Light @@ -200,7 +216,7 @@ int initToggleHardpoints(){ if(!Joystick[S3]){ if(vSecureEscapeFight){ //If initSecureRectract() initialise This Just Display Msg (Hardpoint is Mapped on Button : No Position) - if(DebugMode | DebugMMode)printf("HardPoints SecureEscapeFight [%d]\x0a", vSecureEscapeFight); + if(DebugMode | DebugMMode) printf("HardPoints SecureEscapeFight [%d]\x0a", vSecureEscapeFight); } sHardPoints=!sHardPoints; ActKey(KEYON+PULSE+DeployHardpoints); @@ -211,9 +227,7 @@ } } else{ - if(OptimalPIPMode & !sExplorerMode){ - initRestorePIPPower(vOptimalPIPHPBackup); //Restore Previous PIP Mode - } + if(OptimalPIPMode & !sExplorerMode) initRestorePIPPower(vOptimalPIPHPBackup); //Restore Previous PIP Mode } } else{ //Reset The Flag On The FLY S3 + SWITCH @@ -229,13 +243,11 @@ if(Joystick[H3D] | Joystick[TG1] | Joystick[S2] | vSLonFire | vSLonEscapeFight | vSLonGameMenu | vSLonCamera){ sSilentRuning=!sSilentRuning; if(SilentRuningGameMode){ //Silent Runing [TOGGLE] Mode Ingame - if(HeatSinkonSilentRuning){ - ActKey(KEYON+PULSE+mHeatSinkonSilentRuning); //Call The Heat Sink on Silent Running Macro - } - else{ActKey(KEYON+PULSE+SilentRunning);} + if(HeatSinkonSilentRuning) ActKey(KEYON+PULSE+mHeatSinkonSilentRuning); //Call The Heat Sink on Silent Running Macro + else ActKey(KEYON+PULSE+SilentRunning); if(DebugMode) printf("Silent Runing [TOGGLE] [%d] [ENABLE:[1] DISABLE:[0]]\x0a", sSilentRuning); } - else{ActKey(KEYON+DOWN+SilentRunning);} //Silent Runing [HOLD] Mode Engage + else ActKey(KEYON+DOWN+SilentRunning); //Silent Runing [HOLD] Mode Engage } else{ if(!SilentRuningGameMode & sSilentRuning){ //Silent Runing [HOLD] Mode DisEngage @@ -306,10 +318,8 @@ int initToggleReverseThrottle(){ if(Throttle[LTB]){ sRT=!sRT; - if(RFlightThrootleGameMode){ //TOGGLE - ActKey(KEYON+PULSE+ReverseThrottle); - } - else{ActKey(KEYON+DOWN+ReverseThrottle);} //HOLD Key Down + if(RFlightThrootleGameMode) ActKey(KEYON+PULSE+ReverseThrottle); //TOGGLE + else ActKey(KEYON+DOWN+ReverseThrottle); //HOLD Key Down } else{ //HOLD Key Up if(!RFlightThrootleGameMode & sRT){ @@ -346,9 +356,7 @@ } else{ //Close The Camera Mode ActKey(KEYON+PULSE+ClassifiedCamera); //Push The Camera Mode Key - if(OptimalPIPMode){ - DeferCall(1000, &ActKey, KEYON+PULSE+EXEC("initRestorePIPPower(vOptimalPIPCCBackup);")); //Restore Previous PIP Mode If vOptimalPIPCCBackup != 4 SYS 2 ENG (3) - } + if(OptimalPIPMode) DeferCall(1000, &ActKey, KEYON+PULSE+EXEC("initRestorePIPPower(vOptimalPIPCCBackup);")); //Restore Previous PIP Mode If vOptimalPIPCCBackup != 4 SYS 2 ENG (3) } initLED(Camera_LED, sCameraMode); if(DebugMode) printf("Classified Camera [%d] [ON:[1] OFF:[0]]\x0a", sCameraMode); @@ -363,7 +371,7 @@ ActKey(KEYON+PULSE+HeadLook); if(DebugMode) printf("Head Look [TOOGLE] [%d] [ON:[1] OFF:[0]]\x0a", sHeadLook); } - else{ActKey(KEYON+DOWN+HeadLook);} //HeadLook [HOLD] Mode Ingame Engage + else ActKey(KEYON+DOWN+HeadLook); //HeadLook [HOLD] Mode Ingame Engage } else{ if(!HeadLookGameMode & sHeadLook){ //HeadLook [HOLD] Mode Ingame DisEngage @@ -392,9 +400,7 @@ ActKey(KEYON+PULSE+SetSpeed0); } else{ //Close The Game Menu - if(OptimalPIPMode){ - DeferCall(6000, &ActKey, KEYON+PULSE+EXEC("initRestorePIPPower(vOptimalPIPGMBackup);")); //Restore Previous PIP Mode If vOptimalPIPGMBackup != 4 SYS 2 ENG (3) - } + if(OptimalPIPMode) DeferCall(6000, &ActKey, KEYON+PULSE+EXEC("initRestorePIPPower(vOptimalPIPGMBackup);")); //Restore Previous PIP Mode If vOptimalPIPGMBackup != 4 SYS 2 ENG (3) } DeferCall(3000, &ActKey, KEYON+PULSE+GameMenu); initLED(GameMenu_LED, sGameMenu); diff --git a/Thrustmaster Warthog Script/ED+HCS v2.2_KeyBindings.ttm b/Thrustmaster Warthog Script/ED+HCS v2.2_KeyBindings.ttm index 03aa055..b329c02 100644 --- a/Thrustmaster Warthog Script/ED+HCS v2.2_KeyBindings.ttm +++ b/Thrustmaster Warthog Script/ED+HCS v2.2_KeyBindings.ttm @@ -1,5 +1,5 @@ // Copyright (C) 2017 Thomas Duployez (CMDR Touille) -// V2.2.03.3b 2017/02 +// V2.2.03.3R 2017/02 // Distributed freely under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/Thrustmaster Warthog Script/ED+HCS v2.2_Macros.tmh b/Thrustmaster Warthog Script/ED+HCS v2.2_Macros.tmh index 709e3ff..b73d04e 100644 --- a/Thrustmaster Warthog Script/ED+HCS v2.2_Macros.tmh +++ b/Thrustmaster Warthog Script/ED+HCS v2.2_Macros.tmh @@ -1,5 +1,5 @@ // Copyright (C) 2017 Thomas Duployez (CMDR Touille) -// V2.2.03.3b 2017/02 +// V2.2.03.3R 2017/02 // Distributed freely under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/Thrustmaster Warthog Script/ED+HCS v2.2_Settings.tmh b/Thrustmaster Warthog Script/ED+HCS v2.2_Settings.tmh index 5438c0a..9564fdc 100644 --- a/Thrustmaster Warthog Script/ED+HCS v2.2_Settings.tmh +++ b/Thrustmaster Warthog Script/ED+HCS v2.2_Settings.tmh @@ -1,5 +1,5 @@ // Copyright (C) 2017 Thomas Duployez (CMDR Touille) -// V2.2.03.3b 2017/02 +// V2.2.03.3R 2017/02 // Distributed freely under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -105,6 +105,7 @@ //--------------------------------------------------------------------------------------------------------------------------------------------------------------// int FAOffCurve = 2 ; //Flight Assist OFF Default Curve : 0 or 1 or 2 -> AXIS CURVES + int Trim_INC = 20 ; //Trim Incrementation : The trim provides 2048 values (+/- 1024) to cover the full axis range. //Set via the FLAP switch (Up is most aggresive, down is least aggressive) diff --git a/Thrustmaster Warthog Script/ED+HCS v2.2_USBKey.ttm b/Thrustmaster Warthog Script/ED+HCS v2.2_USBKey.ttm index 430bc8a..341ff29 100644 --- a/Thrustmaster Warthog Script/ED+HCS v2.2_USBKey.ttm +++ b/Thrustmaster Warthog Script/ED+HCS v2.2_USBKey.ttm @@ -1,5 +1,5 @@ // Copyright (C) 2017 Thomas Duployez (CMDR Touille) -// V2.2.03.3b 2017/02 +// V2.2.03.3R 2017/02 // Distributed freely under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/Thrustmaster Warthog Script/ED+HCS v2.2_Variables.tmh b/Thrustmaster Warthog Script/ED+HCS v2.2_Variables.tmh index 758668c..a548d31 100644 --- a/Thrustmaster Warthog Script/ED+HCS v2.2_Variables.tmh +++ b/Thrustmaster Warthog Script/ED+HCS v2.2_Variables.tmh @@ -1,5 +1,5 @@ // Copyright (C) 2017 Thomas Duployez (CMDR Touille) -// V2.2.03.3b 2017/02 +// V2.2.03.3R 2017/02 // Distributed freely under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy