#4274311 - 06/29/16 12:26 AM
TFRP Rudders - Combined toe brake axis
|
Joined: May 2006
Posts: 123
DarKcyde
Member
|
Member
Joined: May 2006
Posts: 123
|
include "target.tmh"
int main()
{
// Exclude missing devices
Configure(&HCougar, MODE_EXCLUDED);
Configure(&T16000, MODE_EXCLUDED);
Configure(&T16000L, MODE_EXCLUDED);
Configure(&LMFD, MODE_EXCLUDED);
Configure(&RMFD, MODE_EXCLUDED);
Configure(&TWCSThrottle, MODE_EXCLUDED);
Configure(&TFRPRudder, MODE_FILTERED);
if(Init(&EventHandle)) return 1; // declare the event handler, return on error
}
int EventHandle(int type, alias o, int x)
{
int TRPCOMBO;
// Combine rudder toe brakes into new axis, mapped to DX_THROTTLE_AXIS
if (&o == &TFRPRudder & (x == TRPLEFT | x == TRPRIGHT)) {
if (TFRPRudder[TRPLEFT] < TFRPRudder[TRPRIGHT]) TRPCOMBO = TFRPRudder[TRPRIGHT];
else TRPCOMBO = TFRPRudder[TRPLEFT];
DXAxis (DX_THROTTLE_AXIS, -TRPCOMBO);
}
if (&o == &TFRPRudder) { //Map the MODE_FILTERED TFRP through Target, we can Trim, set deadzones, J/Scurves, etc.
GetAxisData(&o, x);
axdata.val = AxisVal(o[x], &axdata);
if(x == TRPLEFT | x == TRPRIGHT) axdata.val = -axdata.val; //Reverse the Toe Brakes, TM why u do dis??
//axdata.locked = 1; //Uncomment to disable pedals but keep TRPCOMBO axis
if(!axdata.locked & !axdata.relative) GameOutput(&o, x, axdata.val);
}
else DefaultMapping(&o, x);
}
This creates a NEW axis, that is pressed only when you press both toe brakes. Because space ship. Gives you 4 axes on the rudders. It's mapped to the extra axis that isn't taken up by a Warthog. It leaves the TFRP out of the TM Combined virtual joystick, because that doesn't have enough axes to put it in there. Should be simple to add to any existing code. Note that its not a differential axis, like when people create a single rudder axis with their gas/brake pedals. This lets you map each toe brake separately, but press both of them together for a new input, while your left/right (usually) cancel each other out. I use it for reverse thrust in Elite. Forward thrust on throttle, up/down thrust on each pedal, and both feet down for backing up. UPDATE: Added some code to run the TFRP through Target, but stay a separate device. Reversed the toe brakes, no idea why TM would have them rest high instead of at 0. This allows you to set curves, deadzones, trim, etc. Uncomment the indicated line if you have trouble with games detecting several axes when trying to map the Combined toe brakes.
Last edited by DarKcyde; 07/18/16 06:43 AM. Reason: updated script
|
|
#4280807 - 07/22/16 03:31 AM
Re: TFRP Rudders - Combined toe brake axis
[Re: DarKcyde]
|
Joined: May 2006
Posts: 123
DarKcyde
Member
|
Member
Joined: May 2006
Posts: 123
|
As requested, some code that does this!
include "target.tmh"
//program startup
int main()
{
Configure(&TFRPRudder, MODE_FILTERED);
if(Init(&EventHandle)) return 1; // declare the event handler, return on error
//add initialization code here
}
//event handler
int EventHandle(int type, alias o, int x)
{
int TRPCOMBO;
if (&o == &TFRPRudder) {
GetAxisData(&o, x);
axdata.val = AxisVal(o[x], &axdata);
if(x == TRPLEFT | x == TRPRIGHT) {
axdata.locked = 1; //disable the toe brakes
TRPCOMBO = -TFRPRudder[TRPRIGHT]/2 + TFRPRudder[TRPLEFT]/2; //Toe brakes rest high, so negate and divide by 2
DXAxis(DX_THROTTLE_AXIS, TRPCOMBO); //Map to extra axis.
}
//axdata.locked = 1; //Uncomment to disable pedals but keep TRPCOMBO axis
if(!axdata.locked & !axdata.relative) GameOutput(&o, x, axdata.val);
}
else DefaultMapping(&o, x);
}
HOWEVER, I read your other post and saw this is for Elite Dangerous! You don't need this at all. Elite has plenty powerful axis mapping. Just map Thrust Up to one pedal, and Thrust down to the other pedal! Elite accepts axes on those, not just buttons. I should have searched your posts first, could've saved half an hour. LOL. Oh well, its there for the next person who needs it, maybe for some old game, or some xbox or unity games with poor joystick support.
|
|
#4296757 - 09/16/16 03:10 PM
Re: TFRP Rudders - Combined toe brake axis
[Re: DarKcyde]
|
Joined: Sep 2016
Posts: 1
Spivak
Junior Member
|
Junior Member
Joined: Sep 2016
Posts: 1
|
HOWEVER, I read your other post and saw this is for Elite Dangerous! You don't need this at all. Elite has plenty powerful axis mapping. Just map Thrust Up to one pedal, and Thrust down to the other pedal! Elite accepts axes on those, not just buttons.
I should have searched your posts first, could've saved half an hour. LOL. Oh well, its there for the next person who needs it, maybe for some old game, or some xbox or unity games with poor joystick support. Just a correction, Elite uses digital inputs for Thrust up, down, right or left; if analogue inputs are wanted to be used must to be assigned an axis. I added my initialization code to yours, and I mapped to XROT instead of THROTTLE, but DX_Z_AXIS goes disabled when I run the script, so I miss the rudder axis. Any idea? Thanks in advance.
include "target.tmh"
int main()
{
Configure(&HCougar, MODE_EXCLUDED);
Configure(&T16000, MODE_EXCLUDED);
Configure(&T16000L, MODE_EXCLUDED);
Configure(&LMFD, MODE_EXCLUDED);
Configure(&RMFD, MODE_EXCLUDED);
Configure(&TWCSThrottle, MODE_EXCLUDED);
Configure(&TFRPRudder, MODE_FILTERED);
if(Init(&EventHandle)) return 1;
SetKBRate(32, 50);
SetKBLayout(KB_ENG);
SetShiftButton(0, 0, 0, 0, 0, 0);
MapAxis(&Joystick, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Joystick, JOYX, 0, 0, 0, 0, 0);
MapAxis(&Joystick, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Joystick, JOYY, 0, 0, 0, 0, 0);
MapAxis(&Throttle, SCX, 0, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, SCX, 0, 0, 0, 0, 0);
MapAxis(&Throttle, SCY, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, SCY, 0, 0, 0, 0, 0);
MapAxis(&Throttle, THR_RIGHT, DX_THROTTLE_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, THR_RIGHT, 0, 0, 0, 0, 0);
MapAxis(&Throttle, THR_LEFT, 0, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, THR_LEFT, 0, 0, 0, 0, 0);
MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, THR_FC, 0, 0, 0, 0, 0);
MapAxis(&TFRPRudder, TRPRIGHT, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&TFRPRudder, TRPRIGHT, 0, 0, 0, 0, 0);
MapAxis(&TFRPRudder, TRUDDER, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&TFRPRudder, TRUDDER, 0, 0, 0, 0, 0);
MapAxis(&TFRPRudder, TRPLEFT, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&TFRPRudder, TRPLEFT, 0, 0, 0, 0, 0);
}
int EventHandle(int type, alias o, int x)
{
int TRPCOMBO;
if (&o == &TFRPRudder) {
GetAxisData(&o, x);
axdata.val = AxisVal(o[x], &axdata);
if(x == TRPLEFT | x == TRPRIGHT) {
axdata.locked = 1;
TRPCOMBO = -TFRPRudder[TRPRIGHT]/2 + TFRPRudder[TRPLEFT]/2;
DXAxis(DX_XROT_AXIS, TRPCOMBO); //Map to extra axis.
}
//axdata.locked = 1;
if(!axdata.locked & !axdata.relative) GameOutput(&o, x, axdata.val);
}
else DefaultMapping(&o, x);
}
Edit:I did not realize the axis is in another independent rudder device. It work flawless, Thanks!
Last edited by Spivak; 09/16/16 03:26 PM.
|
|
#4297608 - 09/20/16 05:07 AM
Re: TFRP Rudders - Combined toe brake axis
[Re: DarKcyde]
|
Joined: May 2006
Posts: 123
DarKcyde
Member
|
Member
Joined: May 2006
Posts: 123
|
Spivak, looks like you figured it out. You don't have to map the rudders at all, that' why we set them to Mode_filtered. That disables them, its that last GameOutput(&o, x, axdata.val); that tells them to perform their original function, assuming we didn't set axdata.locked. Took me hours of staring at Target.tmh to figure out how this stuff works. OK, I was wrong, Elite does only use the axis as a digital On/Off when you map Up and Down separately. Good thing we're doing all this coding. I did some more tinkering. This code maps the left/right toe to a single axis (Differential_Toe = X axis), and maps the Both-brakes-down axis to Y axis. Rudder just passes through to the original Z axis. All of that on the original T-rudder device, so it leaves all the Thrustmaster Combined DX axes for the warthog. No need to use MapAxis() for anything on the rudders, it all runs on its own device. It's a bit easier to see in Device Analyzer than the joystick control panel. Use Configure(&TFRPRudder, MODE_FILTERED); as the other examples. There is a fair bit of crosstalk between the X and Y axes at partial travel, you may have to comment out the GameOutput line of Differential_Toe to get the combo to map in game.
int EventHandle(int type, alias o, int x) {
int TRPCOMBO, Differential_Toe;
if (&o == &TFRPRudder) {
GetAxisData(&o, x);
axdata.val = AxisVal(o[x], &axdata);
if(x == TRPLEFT | x == TRPRIGHT) {
axdata.locked = 1;
Differential_Toe = -TFRPRudder[TRPRIGHT]/2 + TFRPRudder[TRPLEFT]/2;
GameOutput(&o, TRPRIGHT, Differential_Toe);
if (TFRPRudder[TRPLEFT] < TFRPRudder[TRPRIGHT]) TRPCOMBO = TFRPRudder[TRPRIGHT];
else TRPCOMBO = TFRPRudder[TRPLEFT];
GameOutput (&o, TRPLEFT, -TRPCOMBO);
}
if(!axdata.locked & !axdata.relative) GameOutput(&o, x, axdata.val);
}
else DefaultMapping(&o, x);
}
I like this better than my original stuff. Does everything in one place, with no downsides.
|
|
#4298054 - 09/22/16 05:12 AM
Re: TFRP Rudders - Combined toe brake axis
[Re: DarKcyde]
|
Joined: Sep 2016
Posts: 2
Wolfereign
Junior Member
|
Junior Member
Joined: Sep 2016
Posts: 2
|
int EventHandle(int type, alias o, int x) {
int TRPCOMBO, Differential_Toe;
if (&o == &TFRPRudder) {
GetAxisData(&o, x);
axdata.val = AxisVal(o[x], &axdata);
if(x == TRPLEFT | x == TRPRIGHT) {
axdata.locked = 1;
Differential_Toe = -TFRPRudder[TRPRIGHT]/2 + TFRPRudder[TRPLEFT]/2;
GameOutput(&o, TRPRIGHT, Differential_Toe);
if (TFRPRudder[TRPLEFT] < TFRPRudder[TRPRIGHT]) TRPCOMBO = TFRPRudder[TRPRIGHT];
else TRPCOMBO = TFRPRudder[TRPLEFT];
GameOutput (&o, TRPLEFT, -TRPCOMBO);
}
if(!axdata.locked & !axdata.relative) GameOutput(&o, x, axdata.val);
}
else DefaultMapping(&o, x);
}
I like this better than my original stuff. Does everything in one place, with no downsides. Thanks for the hard work however I noticed with this method You cannot set Deadzones/Curves for the Right/Left toe brake axis (X/Y-Axis). The pedal axis (Z) responds to the SetSCurve method fine but the other two do not. Do you know of a work around for this, or another way other than GameOuput since it seams to ignore Deadzones/Curves?
|
|
#4298061 - 09/22/16 06:43 AM
Re: TFRP Rudders - Combined toe brake axis
[Re: DarKcyde]
|
Joined: Sep 2016
Posts: 2
Wolfereign
Junior Member
|
Junior Member
Joined: Sep 2016
Posts: 2
|
Sorry Answered my own question here's updated code that calls the functions to apply the curved/deadzone settings
int main(){
SetSCurve(&TFRPRudder, TRPRIGHT, 0, 20, 0, 0, 0); //Right Toe Brake
SetSCurve(&TFRPRudder, TRPLEFT, 0, 0, 20, 0, 0); //Left Toe Brake
SetSCurve(&TFRPRudder, TRUDDER, 0, 10, 0, 0, 0); //Rudder Pedals
}//end main
int EventHandle(int type, alias o, int x){
//Create needed variables
int TRPCOMBO;
int Differential_Toe;
if (&o == &TFRPRudder) {
GetAxisData(&o, x);
axdata.val = AxisVal(o[x], &axdata);
if(x == TRPLEFT | x == TRPRIGHT) {
axdata.locked = 1;
Differential_Toe = -TFRPRudder[TRPRIGHT]/2 + TFRPRudder[TRPLEFT]/2;
//apply curves/deadzones and output data
Differential_Toe = AxisVal(Differential_Toe, &axdata);
GameOutput(&o, TRPRIGHT, Differential_Toe);
if (TFRPRudder[TRPLEFT] < TFRPRudder[TRPRIGHT])
TRPCOMBO = TFRPRudder[TRPRIGHT];
else
TRPCOMBO = TFRPRudder[TRPLEFT];
//apply curves/deadzones and output data
TRPCOMBO = AxisVal(TRPCOMBO, &axdata);
GameOutput(&o, TRPLEFT, -TRPCOMBO);
}//end inner if
if(!axdata.locked & !axdata.relative)
GameOutput(&o, x, axdata.val);
}//end out if
else DefaultMapping(&o, x);
}//end EventHandler
"AxisVal" has to be used before "GameOutput" in order tailor the output data with the user defined curves/deadzones.
Last edited by Wolfereign; 09/22/16 06:45 AM.
|
|
#4329465 - 01/18/17 08:50 PM
Re: TFRP Rudders - Combined toe brake axis
[Re: DarKcyde]
|
Joined: Jan 2017
Posts: 1
ChoboN00b
Junior Member
|
Junior Member
Joined: Jan 2017
Posts: 1
|
Hi,first post on SimHQ, so sorry if resurrecting this thread is poor form. I've just got the Thrustmaster FCS Flight Pack to use with Elite:Dangerous. I want to combine the toe brake axes of the rudder pedals as discussed in this thread. http://www.thrustmaster.com/en_US/%D0%9F%D1%80%D0%B5%D1%81%D1%81%D0%B0/t16000m-fcs-flight-pack-complete-solution-flight-simulation-fans The TFRP Rudder Pedals in this set up hook up to the throttle via an RJ12 connector, rather than to the PC with a USB/RJ12 adaptor as they would if bought separately. As such, it seems like the Target Software handles them a little differently. The GUI doesn't recognize them as connected in the screen where you chose what controllers to use in a new script you are creating. If you select the Throttle and the Stick, then in the following screen, it recognizes the pedals. I hardly know anything about coding, so I tried to copy some of the work in the above posts, but running a script with it did not combine the axes in my case. Here's what Target gives me as a default script: include "target.tmh"
int main()
{
Configure(&HCougar, MODE_EXCLUDED);
Configure(&Joystick, MODE_EXCLUDED);
Configure(&Throttle, MODE_EXCLUDED);
Configure(&T16000L, MODE_EXCLUDED);
Configure(&LMFD, MODE_EXCLUDED);
Configure(&RMFD, MODE_EXCLUDED);
Configure(&TFRPRudder, MODE_EXCLUDED);
if(Init(&EventHandle)) return 1;
SetKBRate(32, 50);
SetKBLayout(KB_ENG);
SetShiftButton(0, 0, 0, 0, 0, 0);
MapAxis(&T16000, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&T16000, JOYX, 0, 0, 0, 0, 0);
MapAxis(&T16000, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&T16000, JOYY, 0, 0, 0, 0, 0);
MapAxis(&T16000, RUDDER, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&T16000, RUDDER, 0, 0, 0, 0, 0);
MapAxis(&T16000, THR, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&T16000, THR, 0, 0, 0, 0, 0);
MapAxis(&TWCSThrottle, TRDR, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&TWCSThrottle, TRDR, 0, 0, 0, 0, 0);
MapAxis(&TWCSThrottle, TTHR, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&TWCSThrottle, TTHR, 0, 0, 0, 0, 0);
MapAxis(&TWCSThrottle, TANT, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&TWCSThrottle, TANT, 0, 0, 0, 0, 0);
MapAxis(&TWCSThrottle, TMSTX, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&TWCSThrottle, TMSTX, 0, 0, 0, 0, 0);
MapAxis(&TWCSThrottle, TMSTY, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&TWCSThrottle, TMSTY, 0, 0, 0, 0, 0);
MapAxis(&TWCSThrottle, TCSRIGHT, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&TWCSThrottle, TCSRIGHT, 0, 0, 0, 0, 0);
MapAxis(&TWCSThrottle, TCSRUDDER, DX_THROTTLE_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&TWCSThrottle, TCSRUDDER, 0, 0, 0, 0, 0);
MapAxis(&TWCSThrottle, TCSLEFT, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&TWCSThrottle, TCSLEFT, 0, 0, 0, 0, 0);
}
int EventHandle(int type, alias o, int x)
{
DefaultMapping(&o, x);
} Any insights that could help get the toe brake axes combined would be greatly appreciated.
|
|
|
|
|
|
|
|
Exodus
by RedOneAlpha. 04/18/24 05:46 PM
|
|
|
|
|
|