TARGET - Advanced programming - Page 13 - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 05-14-2019, 04:31 PM   #121
SGT Coyle
Member
 
Join Date: Dec 2011
Posts: 582
Default

Quote:
Originally Posted by Dudikoff View Post
You could simply remap all the pilot / RIO controls whenever a toggle button is pushed (or some 2-position switch is flipped) if you don't want to use the in-built UMD layers.

There's probably some more effective way, though.

Yeah,
I'm thinking of two separate .tmc files, or not.



Really stuck for how to go about it, but one feature I'd like to have is a command that switches between Pilot and RIO, and also switches stick/controller functionality.
__________________
Implement CW and CCW keyboard commands for the encoders!!!!!
For all that is holy and right with the world please!
SGT Coyle is offline   Reply With Quote
Old 05-14-2019, 08:42 PM   #122
Drakoz
Member
 
Join Date: Sep 2014
Location: San Jose, CA
Posts: 160
Default

You can run new map commands anytime you want. Make a function call to map for pilot and one for RIO. Then use a button press or toggle switch to toggle between calling the two functions every time the button is pressed or the switch is flipped (use EXEC() to call the new mapping function). Each function can 100% remap everything as if you just ran a separate .TMC file.

Of course, for those mappings that are the same for both pilot and RIO, map those the normal way just once in the main part of your .TMC.
Drakoz is offline   Reply With Quote
Old 05-15-2019, 08:32 PM   #123
SGT Coyle
Member
 
Join Date: Dec 2011
Posts: 582
Default

Quote:
Originally Posted by Drakoz View Post
You can run new map commands anytime you want. Make a function call to map for pilot and one for RIO. Then use a button press or toggle switch to toggle between calling the two functions every time the button is pressed or the switch is flipped (use EXEC() to call the new mapping function). Each function can 100% remap everything as if you just ran a separate .TMC file.
Can you give an example? I'm feeling particularly dense at this time.
__________________
Implement CW and CCW keyboard commands for the encoders!!!!!
For all that is holy and right with the world please!
SGT Coyle is offline   Reply With Quote
Old 05-15-2019, 11:19 PM   #124
Drakoz
Member
 
Join Date: Sep 2014
Location: San Jose, CA
Posts: 160
Default

Here is an example of how to do it. This should work well as a template for your config. It swaps between the Pilot and RIO configs when you press the I shift key (S3 on the Warthog Joystick) and the LTB button on the Warthog Throttle. Of course it is easy to change the button combo to suit your needs. It also uses LEDs to indicate which profile is currently selected.

Reply with any questions.


The .tmc file:
Code:
//******************************************************************

include "target.tmh"
include "_Drakoz_DualConfigExample.ttm"

int main()
{
	if(Init(&EventHandle)) return 1;
	
	//******************************************************************
	// Common config for Pilot and RIO
	//******************************************************************
	// This config will be set up once and never changed.  Settings are for both Pilot and RIO.

	//******************************************************************
	//	Setup some basic settings
	
	SetKBLayout(KB_ENG);									// this file designed for English keyboard.
	SetShiftButton(&Joystick, S3, &Throttle, 0, 0, 0);		// IO Shift and UMD Setup   

	
	//******************************************************************
	//	Map DirectX axis

	// JoyX, JoyY
	MapAxis(&Joystick, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
	MapAxis(&Joystick, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
	
	// Throttle - Left and Right
	MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
	MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
	
	// Slew Control
	MapAxis(&Throttle, SCX, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
	MapAxis(&Throttle, SCY, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);

	// Throttle Friction Control
	MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
	
	//******************************************************************
	//	LED Setup 
	ActKey(PULSE+KEYON+LED(&Throttle, LED_INTENSITY, LEDLevel1));		// set Throttle LED back light intensity
	
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1)); 	// set LED 1 OFF
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED2)); 	// set LED 2 OFF
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED3)); 	// set LED 3 OFF
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED4)); 	// set LED 4 OFF
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED5)); 	// set LED 5 OFF
	
	//******************************************************************
	//	Throttle Controls

	// Coolie Switch (HAT)
	MapKeyIO(&Throttle, CSU, 0, DCS_ZoomInSlow);
	MapKeyIO(&Throttle, CSD, 0, DCS_ZoomOutSlow);	
	MapKeyIO(&Throttle, CSL, 0, DCS_LabelsAll);
	MapKeyIO(&Throttle, CSR, 0, DCS_ZoomNormal);
	
	printf("----------------------------------\xa");

	SetUpPilot();			// Configure Pilot specific mappings.  (Default to Pilot config on startup)

}	// end main()
	

int SetUpPilot()
{
	printf("Setting up config for Pilot...\xa");

	// LED1 on to indicate Pilot mode (LED2 off)
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT+LED1)); 	// set LED 1 ON
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED2)); 	// set LED 2 OFF

	// Swap to RIO config when shifted Left Throttle Button pressed
	MapKeyIO(&Throttle, LTB, EXEC("SetUpRIO();"), 0);
	
	// Place all Pilot specific configs here
	// This can include all normal config commands like MapKey, MapAxis, etc
	//  ...
	
}

int SetUpRIO()
{
	printf("Setting up config for RIO...\xa");

	// LED2 on to indicate RIO mode (LED1 off)
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT+LED2)); 	// set LED 2 ON
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1)); 	// set LED 1 OFF

	// Swap to Pilot config when shifted Left Throttle Button pressed
	MapKeyIO(&Throttle, LTB, EXEC("SetUpPilot();"), 0);
	
	// Place all RIO specific configs here
	// This can include all normal config commands like MapKey, MapAxis, etc
	//  ...
	
}


//******************************************************************
int EventHandle(int type, alias o, int x)
{
	DefaultMapping(&o, x);
}
//******************************************************************

The .ttm file:
Code:
// Search for all TODO and resolve

//******************************************************************
//
//	(Generic Blank Script File)	-  T.A.R.G.E.T. Macro File   
//
//******************************************************************
//	Notes about using this configuration
//	- See .tmc file for notes
//	
//
//
//******************************************************************
//
//	History
//	MM/DD/YYYY Created - Michael Lohmeyer			// TODO:  Add date here
//
//******************************************************************

//******************************************************************
//  TrackIR 
define		TIR_Center				R_CTL+APPS			// Center TrackIR
define		TIR_Pause				R_CTL+R_SHIFT+APPS	// Pause TrackIR
define		TIR_Precision			R_ALT+APPS			// TrackIR Precision Mode
define		TIR_ProfileSmooth		L_CTL+L_SHIFT+F1	// Select Smooth TrackIR Profie
define		TIR_ProfileFlatYawPitch	L_CTL+L_SHIFT+F2	// Select FlatYawPitch TrackIR Profile

//******************************************************************
//	Warthog Throttle LED Settings
define		LEDLevelOff		0				// LED intensity off
define		LEDLevel1		50				// LED intensity level 1
define		LEDLevel2		100				// LED intensity level 2
define		LEDLevel3		150				// LED intensity level 3
define		LEDLevel4		200				// LED intensity level 4
define		LEDLevel5		255				// LED intensity level 5

//******************************************************************
//  Standard DCS Functions
define		DCS_LabelsAll			L_SHIFT+F10			// Toggle Labels all aircraft

define		DCS_ZoomInSlow			USB[0x54]			// Zoom in slow - Num*
define		DCS_ZoomOutSlow			USB[0x55]			// Zoom out slow - Num/
define		DCS_ZoomNormal			KPENT				// Zoom set to normal


//******************************************************************
//
Drakoz is offline   Reply With Quote
Old 05-16-2019, 10:39 AM   #125
SGT Coyle
Member
 
Join Date: Dec 2011
Posts: 582
Default

Thanks,
I'll look at this tonight.


Drakos,

Working on my Macro .ttm's. Eliminated most of the duplicate commands. I intend to use 2 macro files. Pilot(default) and RIO. All the pilot and duplicated commands go in Pilot.ttm, and only RIO specific commands go in RIO.ttm.


Once that's done I can build my Mapping.
I play mostly in VR so the printf and LED commands, in the example you gave me, are pretty much useless. I'm going to make those audio files for the pilot and RIO switch.



That example is most definitely appreciated.
Thanks.
__________________
Implement CW and CCW keyboard commands for the encoders!!!!!
For all that is holy and right with the world please!

Last edited by SGT Coyle; 05-16-2019 at 09:55 PM.
SGT Coyle is offline   Reply With Quote
Old 05-17-2019, 05:14 AM   #126
Drakoz
Member
 
Join Date: Sep 2014
Location: San Jose, CA
Posts: 160
Default

Glad it is working for you. The example is a simplified version of my template which I use for new files, so I left stuff in like the LEDs and such in case it was useful. I do VR now too so LEDs and printf statements are mostly for debug now.

Yes good point that the Pilot function can have 100% of all commands and call it first as the default, and the RIO function just has the changes specific to the RIO. You were talking about .ttm files which it is OK to break them up as well. You just have to include both .ttm files. But include files are universal, just be aware. You can't include a .ttm file and have it only be active for only one function.

Anyway, as I was saying, you can also make the Pilot and RIO functions complete by themselves, or just make the RIO function add on or modify commands from the pilot function but call the pilot function to set the base config, which makes it easier to manage them or make them separate .tmc files one day if desired. You get the idea and the rest is just personal preference how you want to do it.
Drakoz is offline   Reply With Quote
Old 05-17-2019, 07:36 AM   #127
SGT Coyle
Member
 
Join Date: Dec 2011
Posts: 582
Default

So I made my 2 macro files, but I get a compile error when I try to use a marco in the function.
Code:
Compile Error:Define stack full in F14B_Unified_Cockpit.tmc at line 94
It works fine if I put a direct key command in like:
Code:
MapKey(&Joystick,S1, "5");
But the second I use a macro I get the error.
Code:
MapKey(&Joystick,S1, Recenter_VR_Headset);
Edit:
Further testing revealed that errors are reported when I use both the pilot and RIO .ttm's. If I use one or the other , but not both, the .tmc works fine.
Looks like I'm just gonna have to go through them line by line.
Any thoughts on what I should be looking for?


Got it working just fine.
It's just a matter of making sure there are no duplicate Macro defines.
__________________
Implement CW and CCW keyboard commands for the encoders!!!!!
For all that is holy and right with the world please!

Last edited by SGT Coyle; 05-19-2019 at 06:44 PM. Reason: Further Testing
SGT Coyle is offline   Reply With Quote
Old 05-20-2019, 07:58 AM   #128
Drakoz
Member
 
Join Date: Sep 2014
Location: San Jose, CA
Posts: 160
Default

OK, I was just going to ask that (if you were doing duplicate define names in the two different .ttm files).

BTW, an include (.ttm file called with an include statement or other files like target.tmh) should be treated as if the text of that file is inserted into your main .tmc file exactly where the include statement is. And in fact that is exactly what happens during compiling.

As you discovered, you can't define the same name twice in a single .ttm file or anywhere in the entire compiled set of files for that matter, "included" or otherwise..

But there is another way to do it using variables instead of defines. For example I might define the following in a .ttm file: (SGT_Coyle, I just saw you have done variables before but hopefully this will enhance your understanding - if not sorry for the redundancy)

Code:
define		WipersIncrease	'v'			// Window Wiper - increase speed
define		WipersDecrease	L_SHIFT+'v'	// Window Wiper - decrease speed
But I can do a similar thing with integer variables as follows:

Code:
int wipersIncrease = 'v';
int wipersDecrease = L_SHIFT+'v';
'v' is a variable of type char but a char is just an 8 bit integer. Hence why I use an int variable (int wipersIncrease for example). It can be used just like a define, but a define is a constant - can't change it. A variable can be changed. And it also means you can create variables just like defines with SHIFT, ALT, CTRL, etc. as I did with wipersDecrease.

BTW, I tend to start defines with a capital letter but variables with lower case. It helps me remember which is a define vs. a variable.

Then you can use this variable just like you would a define macro. For example:

Code:
int wpersIncrease = 'v';
int wipersDecrease = L_SHIFT+'v';

// EAC Switch
MapKeyIO(&Throttle, EACON, 0, PULSE+wipersIncrease);
MapKeyIO(&Throttle, EACOFF, 0, PULSE+wipersDecrease);
Here I added a PULSE command to the two wiper variables. It all works just like a define.


It is important to think about where you define the variables, though. Variables created before main() will be global which will include any variables you create in a .ttm file which is included before main(). All functions will see them, and anywhere you change the variable, it changes it globally. But if you create the variable inside a function the variable is only visible in that function. And its value will bw lost when you leave that function. This is all just standard C programming.

Here is a complex example which uses both global int variables and local int variables. This is just a small subset of a Target program I wrote for Train Sim World which allows changing the config profile for 7 different locomotive engines. It uses the same concept of a common config function (see CommonConfig()) as well as custom configuration functions for each different engine.

Don't worry about all the details in my example. I stripped this down to just to show the examples of how I handled windshield wipers and engine headlights differently for several engines. In some cases I used defines in the .ttm and in others I used int variables. In some I used variables with defines to build complex chains.

Look for the following variables in the code. These three are global for controlling the windshield wipers:
wiperCHAINUP
wiperCHAINDN
wiperCHAINUPCount;

But these are defined only inside specific functions and are visible only inside those functions:
headlightFrontFwd
headlightFrontBkd
headlightRearFwd
headlightRearBkd

Note, this example will not compile and run. I stripped it down too much. If you want to see the full script, you can see it here:
https://forums.dovetailgames.com/thr...-profile.3634/

Or just download the script here (with documentation):
http://akhara.com/drop/TrainSimWorld...rakoz_v2_1.zip

Here is the .tmc:
Code:
include "target.tmh"
include "Drakoz_TrainSimWorld.ttm"

// Default Engine Profile 
//	This script is designed to have different control setups for different engines.  
//	This is mainly to control the difference of separate throttle and brake levers (e.g. SD40-2, GP38)
//  vs. combined throttle/brake levers (e.g. AC4400CW). 
//	Choices:
//	  pro_ProfileSelection = 
//			pro_SD40GP38		- EMD SD40-2, GP38-2, GP40-2	(LED 00001 = 1)
//			pro_AC4400CW		- GE AC4400CW					(LED 00010 = 2)
//			pro_BR43			- British Rail Class 43 HST		(LED 00011 = 3)
//			pro_BR166			- British Rail Class 166		(LED 00100 = 4)
//			pro_BR66			- British Rail Class 66			(LED 00101 = 5)
//			pro_DBBR422			- DB BR 442 Talent 2 EMU		(LED 00110 = 6)
//			pro_ACS64			- Amtrak ACS-64					(LED 00111 = 7)
//int pro_ProfileSelection = pro_SD40GP38;
int pro_ProfileSelection = pro_ACS64;

int wiperCHAINUP, wiperCHAINDN, wiperCHAINUPCount;		// global vars used for window wiper switch up/down commands

int main()
{
    // ...
    
	// Call functions to make custom configuration for each profile
	//	Allows creating MapKey() and other configurations specific to each engine type.
	//	Configurations in pro_CallCustomConfigs() will override any previous MapKey(), KeyAxis(), etc. commands.  
	pro_CallCustomConfigs();
	
}	// end main()

//******************************************************************
// CommonConfig()
//	Configurations (MapKey, KeyAxis, Axis setup, etc.) that is common to all engines should be set up here. 
//  This function will be called every time a profile change occurs before setting any custom configuration for specific engines.  
int CommonConfig()
{

	// Engine Fuel Flow Left/Right Switches	
	MapKeyIO(&Throttle, EFRNORM, 0, CHAIN(LOCK+DOWN+WipersIncrease, D(500), UP+WipersIncrease, LOCK));
	MapKeyIO(&Throttle, EFROVER, 0, CHAIN(LOCK+DOWN+WipersDecrease, D(1100), UP+WipersDecrease, LOCK));

	// Engine Operate Switch - Left
	MapKeyIO (&Throttle, EOLIGN, 0, PULSE+HeadlightsRearFwd);
	MapKeyIO (&Throttle, EOLNORM, 0, 0);
	MapKeyRIO(&Throttle, EOLMOTOR, 0, 0);
	MapKeyIO (&Throttle, EOLMOTOR, 0, PULSE+HeadlightsRearBkd);

	// Engine Operate Switch - Right
	MapKeyIO (&Throttle, EORIGN, 0, PULSE+HeadlightsFwd);
	MapKeyIO (&Throttle, EORNORM, 0, 0);
	MapKeyRIO(&Throttle, EORMOTOR, 0, 0);
	MapKeyIO (&Throttle, EORMOTOR, 0, PULSE+HeadlightsBkd);	

	// Autopilot button and switch
	wiperCHAINUP = CHAIN(LOCK+DOWN+WipersIncrease, D(250), UP+WipersIncrease, D(25), LOCK);
	MapKeyIO(&Throttle, APPAT, 0, 							// Repeat WipersIncrease until APPAT turned off, or count reached
		CHAIN(
			EXEC("wiperCHAINUPCount=5;"), 					// Set to number of time to repeat
			REXEC(REXEC_Wiper, 1000, 						// 1 second delay between repeats
				"ActKey(KEYON+wiperCHAINUP);"				// press wiper key
				"wiperCHAINUPCount=wiperCHAINUPCount-1;"	// decrement count and if = 0, stop the REXEC
				"if (wiperCHAINUPCount <= 0) StopAutoRepeat(REXEC_Wiper);"
			)
		)
	);

	wiperCHAINDN = CHAIN(LOCK+DOWN+WipersDecrease, D(250), UP+WipersDecrease, D(25), LOCK);
	MapKeyIO(&Throttle, APALT, 0,  							// Repeat WipersDecrease until APALT turned off, or count reached
		CHAIN(
			EXEC("wiperCHAINUPCount=5;"), 
			REXEC(REXEC_Wiper, 1000, 
				"ActKey(KEYON+wiperCHAINDN);"
				"wiperCHAINUPCount=wiperCHAINUPCount-1;"
				"if (wiperCHAINUPCount <= 0) StopAutoRepeat(REXEC_Wiper);"
			)
		)
	);

    // ... other configs that are common to all engines
	
}

//******************************************************************
// pro_CallCustomConfigs()
//	Call functions to make custom configuration for each profile
int pro_CallCustomConfigs()
{
	// Do common config shared by all engines first
	CommonConfig();		
	
	// Then do custom config depending on profile.  
	// MapKey(), etc. setup in custom config will overwrite the button/axis configs from the common config.
	if      (pro_ProfileSelection == pro_SD40GP38)	pro_ConfigureSD40GP38();
	else if (pro_ProfileSelection == pro_AC4400CW)	pro_ConfigureAC4400CW();
	else if (pro_ProfileSelection == pro_BR43) 		pro_ConfigureBR43();
	else if (pro_ProfileSelection == pro_BR166) 	pro_ConfigureBR166();
	else if (pro_ProfileSelection == pro_BR66) 		pro_ConfigureBR66();
	else if (pro_ProfileSelection == pro_DBBR422) 	pro_ConfigureDBBR422();
	else if (pro_ProfileSelection == pro_ACS64) 	pro_ConfigureACS64();
}

//******************************************************************
// pro_ConfigureSD40GP38()
//	Custom configuration for SD40-2, GP38-2, GP40-2 and other similar diesel engines
int pro_ConfigureSD40GP38()
{
	printf("Profile %d: pro_SD40GP38\xa", pro_SD40GP38);
	
    // ... custom config here ...
    
}
		
//******************************************************************
// pro_ConfigureAC4400CW()
//	Custom configuration for AC4400CW. 
int pro_ConfigureAC4400CW()
{
	printf("Profile %d: pro_AC4400CW\xa", pro_AC4400CW);
	
	// Headlight Switch - different delays needed vs. other engines. 
	// Following complicated CHAIN commands needed to overcome issues with SHIFT & CTL not being received properly by TSW (bug with TSW?)
	int headlightFrontFwd = CHAIN(LOCK+DOWN+'h', D(250), UP+'h', D(50), LOCK);
	int headlightFrontBkd = CHAIN(LOCK+DOWN+L_SHIFT, D(50), DOWN+'h', D(250), UP+'h', D(50), UP+L_SHIFT, D(50), LOCK);
	int headlightRearFwd = CHAIN(LOCK+DOWN+L_CTL, D(50), DOWN+'h', D(300), UP+'h', D(50), UP+L_CTL, D(50), LOCK);
	int headlightRearBkd = CHAIN(LOCK+DOWN+L_SHIFT, D(50), DOWN+L_CTL, D(50), DOWN+'h', D(300), UP+'h', D(50), UP+L_CTL, D(50), UP+L_SHIFT, D(50), LOCK);
	// Engine Operate Switch - Right
	MapKeyIO (&Throttle, EORIGN, 0, headlightFrontFwd);
	MapKeyIO (&Throttle, EORNORM, 0, 0);
	MapKeyRIO(&Throttle, EORMOTOR, 0, 0);
	MapKeyIO (&Throttle, EORMOTOR, 0, headlightFrontBkd);	
	// Engine Operate Switch - Left
	MapKeyIO (&Throttle, EOLIGN, 0, headlightRearFwd);
	MapKeyIO (&Throttle, EOLNORM, 0, 0);
	MapKeyRIO(&Throttle, EOLMOTOR, 0, 0);
	MapKeyIO (&Throttle, EOLMOTOR, 0, headlightRearBkd);	
	
    // ... other custom config here ...
    
}

//******************************************************************
// pro_ConfigureBR43()
//	Custom configuration for British Rail Class 43 HST
int pro_ConfigureBR43()
{
	printf("Profile %d: pro_BR43\xa", pro_BR43);
	
    // ... custom config here ...

}

//******************************************************************
// pro_ConfigureBR166()
//	Custom configuration for British Rail Class 166
int pro_ConfigureBR166()
{
	printf("Profile %d: pro_BR166\xa", pro_BR166);
	
	// Headlight Switch - different delays needed vs. other engines. 
	// Following complicated CHAIN commands needed to overcome issues with SHIFT & CTL not being received properly by TSW (bug with TSW?)
	int headlightFrontFwd = CHAIN(LOCK+DOWN+'h', D(400), UP+'h', D(50), LOCK);
	int headlightFrontBkd = CHAIN(LOCK+DOWN+L_SHIFT, D(50), DOWN+'h', D(400), UP+'h', D(50), UP+L_SHIFT, D(50), LOCK);
	// Engine Operate Switch - Right
	MapKeyIO (&Throttle, EORIGN, 0, headlightFrontFwd);
	MapKeyIO (&Throttle, EORNORM, 0, 0);
	MapKeyRIO(&Throttle, EORMOTOR, 0, 0);
	MapKeyIO (&Throttle, EORMOTOR, 0, headlightFrontBkd);
	
    // ... other custom config here ...
    	
}

//******************************************************************
// pro_ConfigureBR66()
//	Custom configuration for British Rail Class 66
int pro_ConfigureBR66()
{
	printf("Profile %d: pro_BR66\xa", pro_BR66);

	// Engine Operate Switch - Left
	//   Map HeadlightsRearFwd for EOLIGN and EOLMOTOR because HeadlightsRearBkd does nothing for this engine
	MapKeyIO (&Throttle, EOLIGN, 0, HeadlightsRearFwd);
	MapKeyIO (&Throttle, EOLNORM, 0, 0);
	MapKeyRIO(&Throttle, EOLMOTOR, 0, 0);
	MapKeyIO (&Throttle, EOLMOTOR, 0, HeadlightsRearFwd);	
	
    // ... other custom config here ...
    	
}

//******************************************************************
// pro_ConfigureDBBR422()
//	Custom configuration for DB BR 442 Talent 2 EMU
int pro_ConfigureDBBR422()
{
	printf("Profile %d: pro_DBBR422   --  currently unsupported\xa", pro_DBBR422);
	
    // ... custom config here ...
	
}

//******************************************************************
// pro_ConfigureACS64()
//	Custom configuration for Amtrak ACS-64
int pro_ConfigureACS64()
{
	printf("Profile %d: pro_ACS64\xa", pro_ACS64);

    // ... custom config here ...
	
}

//******************************************************************
int EventHandle(int type, alias o, int x)
{	
	DefaultMapping(&o, x);
}
//******************************************************************
And the .ttm:
Code:
//******************************************************************
//	Profile Selection Labels (used for the variable pro_ProfileSelection)
//	Do not define any profile at 0, only 1 through 31 allowed.  
define		pro_SD40GP38		1		// EMD SD40-2, GP38-2, GP40-2	(LED 00001 = 1)
define		pro_AC4400CW		2		// GE AC4400CW					(LED 00010 = 2)
define		pro_BR43			3		// British Rail Class 43 HST	(LED 00011 = 3)
define		pro_BR166			4		// British Rail Class 166		(LED 00100 = 4)
define		pro_BR66			5		// British Rail Class 66		(LED 00101 = 5)
define		pro_DBBR422			6		// DB BR 442 Talent 2 EMU		(LED 00110 = 6)
define		pro_ACS64			7		// Amtrak ACS-64				(LED 00111 = 7)

define		pro_NumOfProfiles	7		// Set to the number of profiles listed  (31 max allowed)


//******************************************************************
//  REXEC() Handles
//	Place any handles for REXEC() here so we know which handle numbers we have used (0 to 99 allowed)
define		REXEC_Wiper				1			// Used for a repeating window wiper REXEC() function


define		WipersIncrease			'v'					// Window Wiper - increase speed
define		WipersDecrease			L_SHIFT+'v'			// Window Wiper - decrease speed

// Following complicated CHAIN commands needed to overcome issues with SHIFT & CTL not being received properly by TSW (bug with TSW?)
//define	HeadlightsFwd			'h'					// Front Headlight - Move to next Switch Position
define		HeadlightsFwd			CHAIN(LOCK+DOWN+'h', D(250), UP+'h', D(50), LOCK)
//define	HeadlightsBkd			L_SHIFT+'h'			// Front Headlight - Move to previous Switch Position
define		HeadlightsBkd			CHAIN(LOCK+DOWN+L_SHIFT, D(50), DOWN+'h', D(250), UP+'h', D(50), UP+L_SHIFT, D(50), LOCK)
//define	HeadlightsRearFwd		L_CTL+'h'			// Rear Headlight - Move to next Switch Position
define		HeadlightsRearFwd		CHAIN(LOCK+DOWN+L_CTL, D(50), DOWN+'h', D(250), UP+'h', D(50), UP+L_CTL, D(50), LOCK)
//define	HeadlightsRearBkd		L_SHIFT+L_CTL+'h'	// Rear Headlight - Move to previous Switch Position
define		HeadlightsRearBkd		CHAIN(LOCK+DOWN+L_SHIFT, D(50), DOWN+L_CTL, D(50), DOWN+'h', D(250), UP+'h', D(50), UP+L_CTL, D(50), UP+L_SHIFT, D(50), LOCK)

Last edited by Drakoz; 05-20-2019 at 08:03 AM.
Drakoz is offline   Reply With Quote
Old 05-20-2019, 12:12 PM   #129
SGT Coyle
Member
 
Join Date: Dec 2011
Posts: 582
Default

Very Interesting. I'll have to give this a long look.
Thanks for all your help.
__________________
Implement CW and CCW keyboard commands for the encoders!!!!!
For all that is holy and right with the world please!
SGT Coyle is offline   Reply With Quote
Reply

Tags
hotas, script, target, thrustmaster

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 05:48 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.