Forums » Technology » Flight Sim Controllers » T.A.R.G.E.T. (Thrustmaster) » TFRP Rudders - Combined toe brake axis Active Topics You are not logged in. [Log In] [Register User]
Topic Options
Rate This Topic
Hop to:
#4274311 - 06/28/16 08:26 PM TFRP Rudders - Combined toe brake axis
DarKcyde Offline
Member

Registered: 05/12/06
Posts: 116
Loc: Canada
Code:
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.


Edited by DarKcyde (07/18/16 02:43 AM)
Edit Reason: updated script

Top
#4274420 - 06/29/16 06:53 AM Re: TFRP Rudders - Combined toe brake axis [Re: DarKcyde]
Thermal Offline
Junior Member

Registered: 03/07/11
Posts: 11
Y u want me buy new pedals that work with target?

Seriously, this looks really, really cool.

Top
#4274616 - 06/29/16 03:32 PM Re: TFRP Rudders - Combined toe brake axis [Re: DarKcyde]
DarKcyde Offline
Member

Registered: 05/12/06
Posts: 116
Loc: Canada
Haha yep. My pedals were fine, but I really wanted to be able to program everything in one place. Target is just so bloody awesome. First thing I did was figure out how to code this, before even using them. Even if they aren't the highest quality, I'll always have the chip to transplant into any crazy thing I build.

Top
#4279846 - 07/18/16 02:47 AM Re: TFRP Rudders - Combined toe brake axis [Re: DarKcyde]
DarKcyde Offline
Member

Registered: 05/12/06
Posts: 116
Loc: Canada
Added new code, run the Rudders through Target so we can control them, but remain a separate device.

Top
#4280381 - 07/20/16 11:48 AM Re: TFRP Rudders - Combined toe brake axis [Re: DarKcyde]
Splashy Offline
Junior Member

Registered: 07/20/16
Posts: 2
Hey, sorry to bother you, but ive been searching for hours, to find scripts/solutions to combine the Toebrakes of the TFRP ... but i havent found anything... mind helping me out? Thanks biggrin

Top
#4280807 - 07/21/16 11:31 PM Re: TFRP Rudders - Combined toe brake axis [Re: DarKcyde]
DarKcyde Offline
Member

Registered: 05/12/06
Posts: 116
Loc: Canada
As requested, some code that does this!

Code:
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.

Top
Topic Options
Rate This Topic
Hop to:

Moderator:  RacerGT 
 
Quick Search
Recent Articles
Support SimHQ
.
Social


Recent Topics
Aeronautical colleges/universitie
s

by KraziKanuK
Today at 03:24 PM
Trucks hauling Windmill blades up a Mountain
by JimK
Today at 01:55 PM
Knights of Ni....
by Dart
Today at 01:40 PM
Too hot on the landing.
by Desert Eagle
Today at 11:19 AM
What happens when the US Secretary of State wants to ride his bicycle in the Alps ?
by kaa
Today at 10:35 AM
Witcher or not?
by Warbirds
Today at 08:17 AM
Question about a system restore.
by Coot
Yesterday at 06:42 PM
Gene Wilder RIP
by PanzerMeyer
Yesterday at 03:24 PM
Ice Road Trucker dies in plane crash
by WangoTango
Yesterday at 01:37 PM
What disabilty, archer without arms
by JimK
Yesterday at 01:15 PM
 

Forum Use Agreement | Privacy Statement
Copyright 1997-2016, SimHQ Inc. All Rights Reserved.