Skip to content

Commit

Permalink
Nightly Push
Browse files Browse the repository at this point in the history
Added Verbose and Debug.
  • Loading branch information
zeplintwo committed Jul 27, 2021
1 parent 5d54734 commit 5ee6eb0
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 63 deletions.
27 changes: 15 additions & 12 deletions Analog_WASD_Functions.ttm
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ int initLEDController(){
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));
printf("LED's Reset \xa");
if(Verbose) printf("LED's Reset \xa");
}

//---------------------------------------------------------------------------
// Control Setup Functions
//---------------------------------------------------------------------------\
int ControlAxisCurveSetup(){ //exclusion switching for Duals or Warthog HOTAS
printf("\xa");
if(Verbose) printf("\xa");
if (WarthogStick == 1 & T16000Right == 0){ //Selection of Warthog Stick for Right Side
if (T16000Left == 0) {
Configure(&T16000, MODE_EXCLUDED);
Expand All @@ -31,8 +31,8 @@ int ControlAxisCurveSetup(){ //exclusion switching for Duals or Warthog HOTAS
}
else if (T16000Right == 1 & WarthogStick == 0){
Configure(&Joystick, MODE_EXCLUDED);
printf("---T16000.m Right Loading \xa");
JoyT16Set();
if(Verbose) printf("---T16000.m Right Loading \xa");
JoyT16RSet();
}
else{
SettingError('R');
Expand All @@ -42,13 +42,13 @@ int ControlAxisCurveSetup(){ //exclusion switching for Duals or Warthog HOTAS
if (T16000Right == 0) {
Configure(&T16000, MODE_EXCLUDED);
}
printf("---Warthog Throttle Loading \xa");
if(Verbose) printf("---Warthog Throttle Loading \xa");
ThrA10Set();
}
else if (T16000Left==1 & WarthogThrottle == 0){
Configure(&Throttle, MODE_EXCLUDED);
printf("---T16000.m Left Loading \xa");
JoyT16Set();
if(Verbose) printf("---T16000.m Left Loading \xa");
JoyT16LSet();
}
else{
SettingError('L');
Expand All @@ -61,7 +61,7 @@ int JoyA10Set(){
//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]);
printf("---Warthog Joystick Curves Set \xa");
if(Verbose) printf("---Warthog Joystick Curves Set \xa");
WarthogJoyBinds();
}

Expand All @@ -77,11 +77,11 @@ int ThrA10Set(){
SetJCurve(&Throttle, THR_RIGHT, 50, 50);
SetJCurve(&Throttle, THR_LEFT, 50, 50);
SetJCurve(&Throttle, THR_FC, 50, 50);
printf("---Warthog Throttle Curves Set \xa");
if(Verbose) printf("---Warthog Throttle Curves Set \xa");
WarthogThrottleBinds();
}

int JoyT16Set(){ //Dual T16000.m Curves
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);
Expand All @@ -90,9 +90,12 @@ int JoyT16Set(){ //Dual T16000.m Curves
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]);
printf("---T16000.m Left Joystick Curves Set \xa") ;
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);
Expand All @@ -101,7 +104,7 @@ int JoyT16Set(){ //Dual T16000.m Curves
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]);
printf("---T16000.m Right Joystick Curves Set \xa");
if(Verbose) printf("---T16000.m Right Joystick Curves Set \xa");
T16RightBinds();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Analog_WASD_Key_Binds.ttm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ define ThrustRight USB[0x4F] //right arrow translate, strafe,thrust right
define ThrustLeft USB[0x50] //left arrow translate, strafe,thrust left
define Brakes USB[0xE0] //left control/ctrl brakes, stoping thrust, aero brakes, retro thrust, reverse
define ExtVoice USB[0x48] //Pause/Break for external Comms
define IntVoice USB[0x48] //Scroll Lock for internal Comms
define IntVoice USB[0x47] //Scroll Lock for internal Comms

//--------------------------------------------------------------------------------------------------------------------------------------------------------------//
// REFERENCE: USB KEY DEFINITIONS // //
Expand Down
37 changes: 19 additions & 18 deletions Analog_WASD_Key_Defines.ttm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int WarthogJoyBinds(){//Keybindings for the Warthog Joysick key assignments.
MapKeyIOUMD(&Joystick,TG2,0,0,0,0,0,0);
MapKeyIOUMD(&Joystick,S1,0,0,0,0,0,0);
MapKeyIOUMD(&Joystick,S2,0,0,0,0,0,0);
MapKeyIOUMD(&Joystick,S3,0,0,0,0,0,0);
//MapKeyIOUMD(&Joystick,S3,0,0,0,0,0,0);//Reserved for IO activation
MapKeyIOUMD(&Joystick,S4,0,0,0,0,0,0);
MapKeyIOUMD(&Joystick,H1U,0,0,0,0,0,0);
MapKeyIOUMD(&Joystick,H1D,0,0,0,0,0,0);
Expand All @@ -27,20 +27,22 @@ int WarthogJoyBinds(){//Keybindings for the Warthog Joysick key assignments.
MapKeyIOUMD(&Joystick,H4L,0,0,0,0,0,0);
MapKeyIOUMD(&Joystick,H4R,0,0,0,0,0,0);
MapKeyIOUMD(&Joystick,H4P,0,0,0,0,0,0);
printf("---Warthog Joystick Binds Loaded.\xa \xa");
if(Verbose) printf("---Warthog Joystick Binds Loaded.\xa \xa");
}

int WarthogThrottleBinds(){//Keybindings for the Warthog Throttle key assignments.
MapKeyIOUMD(&Throttle, MSP,0,0,0,0,0,0);
int WarthogThrottleBinds(){//Keybindings for the Warthog Throttle key assignments.
SetShiftButton(&Joystick, S3, &Throttle,BSF,BSB);
//MapKeyIOUMD(&Throttle, MSP,0,0,0,0,0,0); //Push to talk reserve
MapKeyIOUMD(&Throttle, MSU,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, MSR,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, MSR,0,0,0,EXEC("mDirBurst(ThrottleDown,ThrottleUp);"),0,0);
MapKeyIOUMD(&Throttle, MSD,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, MSL,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, MSL,0,0,0,EXEC("mDirBurst(ThrottleUp,ThrottleDown);"),0,0);
MapKeyIOUMD(&Throttle, SPDF,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, SPDM,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, SPDB,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, BSF,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, BSB,0,0,0,0,0,0);
//MapKeyIOUMD(&Throttle, BSF,0,0,0,0,0,0); //UMD activation reserve
//MapKeyIOUMD(&Throttle, BSM,0,0,0,0,0,0); //UMD activation reserve
//MapKeyIOUMD(&Throttle, BSB,0,0,0,0,0,0); //UMD activation reserve
MapKeyIOUMD(&Throttle, CHF,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, CHB,0,0,0,0,0,0);
MapKey(&Throttle,PSF,EXEC("ExtComms();"));
Expand All @@ -52,6 +54,7 @@ int WarthogThrottleBinds(){//Keybindings for the Warthog Throttle key assignment
MapKeyIOUMD(&Throttle, EOLMOTOR,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, EORMOTOR,0,0,0,0,0,0);
//MapKeyIOUMD(&Throttle, APUON,0,0,0,0,0,0); // Reserved for Analog WASD functaionality
//MapKeyIOUMD(&Throttle, APUOFF,0,0,0,0,0,0); // Reserved for Analog WASD functaionality
MapKeyIOUMD(&Throttle, LDGH,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, FLAPU,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, FLAPD,0,0,0,0,0,0);
Expand All @@ -64,13 +67,12 @@ int WarthogThrottleBinds(){//Keybindings for the Warthog Throttle key assignment
MapKeyIOUMD(&Throttle, IDLELON,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, EOLIGN,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, EORIGN,0,0,0,0,0,0);
MapKey(&Throttle, CSU,ThrustUp);
MapKey(&Throttle, CSR,ThrustRight);
MapKey(&Throttle, CSD,ThrustDown);
MapKey(&Throttle, CSL,ThrustLeft);
MapKeyIOUMD(&Throttle, CSU,0,ThrustUp,0,ThrustUp,0,ThrustUp);
MapKeyIOUMD(&Throttle, CSD,0,ThrustDown,0,ThrustDown,0,ThrustDown);
MapKeyIOUMD(&Throttle, CSL,0,ThrustLeft,0,ThrustLeft,0,ThrustLeft);
MapKeyIOUMD(&Throttle, CSR,0,ThrustRight,0,ThrustRight,0,ThrustRight);
MapKeyIOUMD(&Throttle, EFLOVER,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, EFROVER,0,0,0,0,0,0);
//MapKeyIOUMD(&Throttle, APUOFF,0,0,0,0,0,0); // Reserved for Analog WASD functaionality
MapKeyIOUMD(&Throttle, EACOFF,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, RDRDIS,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, APDIS,0,0,0,0,0,0);
Expand All @@ -79,10 +81,9 @@ int WarthogThrottleBinds(){//Keybindings for the Warthog Throttle key assignment
MapKeyIOUMD(&Throttle, EOLNORM,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, EORNORM,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, FLAPM,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, BSM,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, CHM,0,0,0,0,0,0);
MapKeyIOUMD(&Throttle, APAH,0,0,0,0,0,0);
printf("---Warthog Throttle Binds Loaded.\xa \xa");
if(Verbose) printf("---Warthog Throttle Binds Loaded.\xa \xa");
}

int T16LeftBinds(){
Expand All @@ -96,7 +97,7 @@ int T16LeftBinds(){
MapKey(&T16000L, B8,0);
MapKey(&T16000L, B9,0);
MapKey(&T16000L, B10,0);
//MapKey(&T16000L, B11,0); // Reserved for Analog WASD functaionality
MapKey(&T16000L, B11,0);
MapKey(&T16000L, B12,0);
MapKey(&T16000L, B13,0);
MapKey(&T16000L, B14,0);
Expand All @@ -106,7 +107,7 @@ int T16LeftBinds(){
MapKey(&T16000L, H1R,0);
MapKey(&T16000L, H1D,0);
MapKey(&T16000L, H1L,0);
printf("---T16000.m Left Binds Loaded.\xa \xa");
if(Verbose) printf("---T16000.m Left Binds Loaded.\xa \xa");
}

int T16RightBinds(){
Expand All @@ -130,5 +131,5 @@ MapKey(&T16000L, TS1,0);
MapKey(&T16000, H1R,0);
MapKey(&T16000, H1D,0);
MapKey(&T16000, H1L,0);
printf("---T16000.m Right Binds Loaded.\xa \xa");
if(Verbose) printf("---T16000.m Right Binds Loaded.\xa \xa");
}
43 changes: 16 additions & 27 deletions Analog_WASD_Pre-Axis_Macros.ttm
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ int MainPWMStart(){
MapKey(&Throttle,APUON,CHAIN(REXEC(0,100,"PWMLogic();"),PULSE+LED(&Throttle, LED_ONOFF, LED_CURRENT+LED1))); // 100ms calls for the devices and turn on LED 1 for visual cue of activity
MapKey(&Throttle,APUOFF,CHAIN(EXEC("StopAutoRepeat(0);"),PULSE+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1))); // kills 100ms calls to devices and turns off LED 1
}
if (T16000Left == 1){
if (CCount < 1) {
CCount=0;
printf("Loading Axis-to-Key Binds \xa");
MapKey(&T16000L, B16,CHAIN(REXEC(0,100,"PWMLogic();"),printf("PWM Logic Loaded\xa")));
}
else{
CCount=1;
printf("Unloading Axis-to-Key Binds \xa");
MapKey(&T16000L, B16,EXEC("StopAutoRepeat(0);"));
}
}
}

int AxisToKeySet(){
Expand Down Expand Up @@ -95,10 +83,10 @@ int AxisToKeySet(){
RightDev.ZValue = T16000[RUDDER]; // Yaw
RightDev.HalfRangeY = T16000HalfRange;
RightDev.HalfRangeX = T16000HalfRange;
RightDev.HalfRangeZ = T16000HalfRange;
RightDev.MinRangeY = T16000AxisRange*DeadZoneCalPerc;
RightDev.MinRangeY = T16000AxisRange*DeadZoneCalPerc;
RightDev.MinRangeY = T16000AxisRange*DeadZoneCalPerc;
RightDev.HalfRangeZ = T16000RotHalfRange;
RightDev.MinRangeY = T16000AxisRange*DeadZoneCalPerc1;
RightDev.MinRangeX = T16000AxisRange*DeadZoneCalPerc1;
RightDev.MinRangeZ = T16000RotAxisRange*DeadZoneCalPerc1;
RightDev.KeyNegY = PitchUp;
RightDev.KeyPosY = PitchDown;
RightDev.KeyNegX = RollRight;
Expand All @@ -113,10 +101,10 @@ int AxisToKeySet(){
LeftDev.ZValue = T16000L[RUDDER];
LeftDev.HalfRangeY = T16000HalfRange;
LeftDev.HalfRangeX = T16000HalfRange;
LeftDev.HalfRangeZ = T16000HalfRange;
LeftDev.HalfRangeZ = T16000RotHalfRange;
LeftDev.MinRangeY = T16000AxisRange*DeadZoneCalPerc1;
LeftDev.MinRangeX = T16000AxisRange*DeadZoneCalPerc1;
LeftDev.MinRangeZ = T16000AxisRange*DeadZoneCalPerc1;
LeftDev.MinRangeZ = T16000RotAxisRange*DeadZoneCalPerc1;
LeftDev.KeyNegY = ThrottleUp;
LeftDev.KeyPosY = ThrottleDown;
LeftDev.KeyNegX = ThrustRight;
Expand All @@ -129,7 +117,7 @@ int AxisToKeySet(){
int AxisToKey(int DC,short PKey){ // Application of Dutycycle call to keypress
ActKey(LOCK+KEYON+PKey);
DeferCall((DC+TouchDelay),&ActKey,PKey);
//printf("Duty Cycle : %i ,%c \xa",DC,PKey);
if(Debug) printf("Duty Cycle : %i ,%c \xa",DC,PKey);
DeferCall(PWMTimeLenght,&ActKey,LOCK);
}

Expand All @@ -138,6 +126,7 @@ int AxisToKey(int DC,short PKey){ // Application of Dutycycle call to keypress
//---------------------------------------------------------------------------

int PWMLogic(){
//printf("tick \xa");
AxisToKeySet();
if (RightDev.YValue < (-RightDev.MinRangeY) | RightDev.YValue > RightDev.MinRangeY){ //Joystick Y axis
PulseFormer(RightDev.YValue,RightDev.HalfRangeY,RightDev.LastNegY,RightDev.LastPosY,RightDev.KeyNegY,RightDev.KeyPosY);
Expand Down Expand Up @@ -181,11 +170,11 @@ int PulseFormer(int axis_value,int range,int pos1,int pos2,word key1,word key2){
int onDutyTime = PWMPress(axis_value,range,pos1,pos2);
if (axis_value > 0){
AxisToKey (onDutyTime, key1);
printf("Point 1+ > %i, %i, %x \xa",axis_value,onDutyTime,key1);
if(Debug) printf("Point 1+ > %i, %i, %x \xa",axis_value,onDutyTime,key1);
}
if (axis_value < 0){
AxisToKey (abs(onDutyTime), key2);
printf("Point 1- > %i, %i, %x \xa",axis_value,abs(onDutyTime),key2);
if(Debug) printf("Point 1- > %i, %i, %x \xa",axis_value,abs(onDutyTime),key2);
}
}

Expand All @@ -195,37 +184,37 @@ int PWMPress (int mag,int range,int pos1,int pos2){ // Math to convert Joystick
fduty = (abs(mag)/range)*PWMTimeLenght;
duty = fduty-fduty%1;
if (mag > 0){
//printf("PW Mag Cal Axis+: %i, %i \xa",mag,duty);
if(Debug) printf("PW Mag Cal Axis+: %i, %i \xa",mag,duty);
return(DutyGreater(duty,pos1));
}
if (mag < 0){
//printf("PW Mag Cal Axis-: %i, %i \xa",mag,duty);
if(Debug) printf("PW Mag Cal Axis-: %i, %i \xa",mag,duty);
return(DutyLess(duty,pos2));
}
}

int DutyLess (int duty,int pos){ // Math to dampen return to zero values
if (pos <= duty){
pos = duty;
//printf("Duty Less Ret: %i \xa",duty);
if(Debug) printf("Duty Less Ret: %i \xa",duty);
return duty;
}
else {
pos = duty;
//printf("Duty Less Disc: %i \xa",duty);
if(Debug) printf("Duty Less Disc: %i \xa",duty);
return 0;
}
}

int DutyGreater (int duty,int pos){ // Math to dampen return to zero values
if (pos >= duty){
pos = duty;
//printf("Duty Greater Ret: %i \xa",duty);
if(Debug) printf("Duty Greater Ret: %i \xa",duty);
return duty;
}
else{
pos = duty;
//printf("Duty Greater Disc: %i \xa",duty);
if(Debug) printf("Duty Greater Disc: %i \xa",duty);
return 0;
}
}
2 changes: 1 addition & 1 deletion Analog_WASD_Profile.tmc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
//---------------------------------------------------------------------------
include "target_zeplin_dx128-v0.1.tmh" //modded target.tmh file so that it looks diffrent from stock
include "Analog_WASD_User_Settings.ttm" //User editable setting for the script
include "Analog_WASD_Key_Defines.ttm" //Keymaps for TARGET scripting where an USB Hex is assigned a name. includes the 128 DX Buttons for future usage
include "Analog_WASD_Key_Binds.ttm" //Keybinds setup for all supported devices where you have the assigment to a button
include "Analog_WASD_Key_Defines.ttm" //Keymaps for TARGET scripting where an USB Hex is assigned a name. includes the 128 DX Buttons for future usage
include "Analog_WASD_Macros.ttm" //macros for the script to work properly
include "Analog_WASD_Pre-Axis_Macros.ttm" //macros for the Axis to Key with a dutycycle logic
include "Analog_WASD_Functions.ttm" //Functions for the higher confgurations of the script but do not directly work with the PWM macros
Expand Down
16 changes: 12 additions & 4 deletions Analog_WASD_User_Settings.ttm
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,38 @@ short JSZoom[] = {0,0,-2}; //{Progresive,Flat,Percision
//
// You must have WarthogStick or T16000Stick in the On (1) postion and the other Off (0).

int WarthogStick = 0; //Default 1
int WarthogThrottle = 0; //Default 1
int WarthogStick = 1; //Default 1
int WarthogThrottle = 1; //Default 1

// T16000.M Thrustmaster as right stick
//
// set T16000Stick to 1 for dual T16000.m and 0 to turn this off.
//
// You must have WarthogStick or T16000Stick in the On (1) postion and the other Off (0).

int T16000Right = 1; //Default 0
int T16000Left = 1; //Default 0
int T16000Right = 0; //Default 0
int T16000Left = 0; //Default 0

// Keyboard emulation of control azis
//
// set AnalogWASD_Pre_axis to 1 for map to keys or 0 for traditonal curves. This is a future profing function

int AnalogWASD_Pre_axis = 1; //Default 1


// Verbose and Debug output for check text

int Verbose = 1; //Default 1
int Debug = 0; //Default 0

//---------------------------------------------------------------------------
// Settings Storage for Axis->Key Values
//---------------------------------------------------------------------------

int T16000AxisRange = 16383; //full sweep values for joystick axis (default is 16383)
int T16000HalfRange = 8191; //half of the above full sweep value (default is 8191)
int T16000RotAxisRange = 255;
int T16000RotHalfRange = 128;
int TouchDelay = 25; //Release timer for the dutycycle system in milliseconds (1000 ms is one second)if keys are not beeing relased increase this time(default is 25)
int PWMTimeLenght = 100; //timing for full pulse to occure the total lenght of time for it duty in milliseconds (default is 100)
int A10JoyAxisRange = 65535; //full sweep values for joystick axis (default is 65535)
Expand Down
Binary file modified docs/img/Beginners-Map.pdf
Binary file not shown.
Binary file modified docs/img/Beginners-Map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/Beginners-Map.xcf
Binary file not shown.

0 comments on commit 5ee6eb0

Please sign in to comment.