<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="../XSLT/decoder.xsl"?>
<!DOCTYPE decoder-config SYSTEM "../DTD/decoder-config.dtd">

<!-- Copyright (C) JMRI 2003, 2004, 2005, 2007 All rights reserved -->
<!-- $Id: Digitrax_TF4.xml,v 1.7 2010/01/28 02:34:22 jacobsen Exp $ -->
<!--                                                                        -->
<!-- JMRI is free software; you can redistribute it and/or modify it under  -->
<!-- the terms of version 2 of the GNU General Public License as published  -->
<!-- by the Free Software Foundation. See the "COPYING" file for a copy     -->
<!-- of this license.                                                       -->
<!--                                                                        -->
<!-- JMRI is distributed in the hope that it will be useful, but WITHOUT    -->
<!-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or  -->
<!-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License  -->
<!-- for more details.                                                      -->

<decoder-config>
	<version author="Howard G. Penny" 
		 version="1" lastUpdated="20051108"/>
	<version author="Walter Thompson wsthompson@earthlink.net" 
		 version="2" lastUpdated="20080412"/>
	<version author="Matt Harris - matthew.john.harris@gmail.com"
		 version="3" lastUpdated="20080724"/>
	<version author="Matt Harris - matthew.john.harris@gmail.com"
		 version="3.1" lastUpdated="20080728"/>
	
	<!-- Version 3.1                                                    -->
	<!-- Modified CV29 by removing mask settings which had been causing -->
	<!-- problems. Initial tests using constant values did not work.    -->
	<!-- Version 3:                                                     -->
	<!-- Based on input from Bob Grosh:                                 -->
	<!--  * Modified CV masking on function outputs                     -->
	<!--  * Corrected CV29 definition                                   -->
	<!--  * Added Decoder Lock pane                                     -->

	<decoder>
		<family name="Function Only, with transponding" mfg="Digitrax">
			<!-- <model model="TL1" numOuts="1" lowVersionID="250"/> -->
			<!-- <model model="TF2" numOuts="2" lowVersionID="251"/> -->
			<model model="TF4" numOuts="4" lowVersionID="254"/>
		</family>
		
		<programming direct="byteOnly" paged="yes" register="yes" ops="no"/>

		<variables>
			<variable label="Primary Address" CV="1" comment="Short address"
				  item="Short Address" default="03">
				<shortAddressVal/>
			</variable>
			
			<variable label="Version ID" CV="7" readOnly="yes"
				  item="Decoder Version">
				<decVal/>
			</variable>
			
			<variable label="Manufacturer ID" CV="8" readOnly="yes" 
				  item="Manufacturer" default="129">
				<decVal/>
			</variable>
			
			<variable label="Decoder Lock Type" CV="16" item="Decoder Lock Type" default="0">
				<enumVal>
					<enumChoice choice="0 - Unlocked"/>
					<enumChoice choice="1 - Motor"/>
					<enumChoice choice="2 - Sound"/>
					<enumChoice choice="3 - Function (1)"/>
					<enumChoice choice="4 - Function (2)"/>
					<enumChoice choice="5 - Function (3)"/>
					<enumChoice choice="6 - User Defined"/>
					<enumChoice choice="7 - User Defined"/>
				</enumVal>
			</variable>
			
			<variable label="Long Address" CV="17" item="Extended Address">
				<longAddressVal/>
			</variable>
			<variable label="Addressing Mode" CV="29" item="Address Format">
				<enumVal>
					<enumChoice choice="2 digit addressing" value="6"/>
					<enumChoice choice="4 digit addressing" value="38"/>
				</enumVal>
			</variable>
			<variable label="Effect Generated for White Lead" CV="49" mask="XXXXXVVV"
				  item="Effect Generated W">
				<enumVal>
					<enumChoice choice="Normal on/off"/>
					<enumChoice choice="Simulated FRED"/>
					<enumChoice choice="Simulated Mars light"/>
					<enumChoice choice="Slow Strobe"/>
					<enumChoice choice="Single pulse"/>
					<enumChoice choice="Double pulse"/>
					<enumChoice choice="Medium pulse"/>
					<enumChoice choice="Mostly on blinking off"/>
				</enumVal>
			</variable>
			
			<variable label="Effect Generated for Yellow Lead" CV="50" mask="XXXXXVVV"
				  item="Effect Generated Y" minOut="2">
				<enumVal>
					<enumChoice choice="Normal on/off"/>
					<enumChoice choice="Simulated FRED"/>
					<enumChoice choice="Simulated Mars light"/>
					<enumChoice choice="Slow Strobe"/>
					<enumChoice choice="Single pulse"/>
					<enumChoice choice="Double pulse"/>
					<enumChoice choice="Medium pulse"/>
					<enumChoice choice="Mostly on blinking off"/>
				</enumVal>
			</variable>
			
			<variable label="Decoder Lock" CV="54" mask="XVXXXXXX"
				  item="Decoder Lock" default="1">
				<enumVal>
					<enumChoice choice="Enabled"/>
					<enumChoice choice="Disabled"/>
				</enumVal>
			</variable>
			
			<variable label="CV 61" CV="61" mask="XXXXXXVV"
				  item="CV61" default="2">
				<decVal max="3"/>
			</variable>
			
			<variable label="Digitrax Transponding" CV="61" mask="XXXXXXVX"
				  item="Transponding" default="1">
				<enumVal>
					<enumChoice choice="Off"/>
					<enumChoice choice="On"/>
				</enumVal>
			</variable>
			
			<variable label="Use F0 for White Function Control" CV="61" mask="XXXXXXXV"
				  item="F0 use" inOptions="numOuts=2">
				<enumVal>
					<enumChoice choice="Off"/>
					<enumChoice choice="On"/>
				</enumVal>
			</variable>
			
			<variable label="Effect Rate White Lead" CV="62" mask="XXXXXVVV"
				  item="Effect Rate W">
				<enumVal>
					<enumChoice choice="0 fastest"/>
					<enumChoice choice="1"/>
					<enumChoice choice="2"/>
					<enumChoice choice="3"/>
					<enumChoice choice="4"/>
					<enumChoice choice="5"/>
					<enumChoice choice="6"/>
					<enumChoice choice="7 slowest"/>
				</enumVal>
			</variable>
			
			<variable label="Effect Rate Yellow Lead" CV="63" mask="XXXXXVVV"
				  item="Effect Rate Y" minOut="2">
				<enumVal>
					<enumChoice choice="0 fastest"/>
					<enumChoice choice="1"/>
					<enumChoice choice="2"/>
					<enumChoice choice="3"/>
					<enumChoice choice="4"/>
					<enumChoice choice="5"/>
					<enumChoice choice="6"/>
					<enumChoice choice="7 slowest"/>
				</enumVal>
			</variable>
			
			<variable label="Function Controlling White Output" CV="64" mask="XXXXXXVV"
				  item="ControlFn" minOut="2">
				<enumVal>
					<enumChoice choice="F0 or F1"/>
					<enumChoice choice="F3"/>
					<enumChoice choice="F5"/>
					<enumChoice choice="F9"/>
				</enumVal>
			</variable>
			
			<variable label="CV 64" CV="64" mask="XXXXXXVV"
				  item="CV64">
				<decVal max="3"/>
			</variable>

		</variables>
		<resets>
			<factReset label="Reset All CVs" CV="8" default="8"/>
			<factReset label="Reset All CVs except speed table" CV="8" default="9"/>
		</resets>
	</decoder>

	<pane name="Function Output">
		<column>
			<label label="Use the matrix below to determine the values for CV 61 and 64"/>
			<label label=" "/>
			<row>
				<column>
					<row>
						<label label="CV64"/>
					</row>
					<row>
						<label label="0"/>
					</row>
					<row>
						<label label="0"/>
					</row>
					<row>
						<label label="0"/>
					</row>
					<row>
						<label label="0"/>
					</row>
					<row>
						<label label="1"/>
					</row>
					<row>
						<label label="2"/>
					</row>
					<row>
						<label label="3"/>
					</row>
					<row>
						<label label="1"/>
					</row>
					<row>
						<label label="2"/>
					</row>
					<row>
						<label label="3"/>
					</row>
				</column>
				<label label="   "/>
				<column>
					<row>
						<label label="CV61"/>
					</row>
					<row>
						<label label="0"/>
					</row>
					<row>
						<label label="1"/>
					</row>
					<row>
						<label label="2"/>
					</row>
					<row>
						<label label="3"/>
					</row>
					<row>
						<label label="2"/>
					</row>
					<row>
						<label label="2"/>
					</row>
					<row>
						<label label="2"/>
					</row>
					<row>
						<label label="0"/>
					</row>
					<row>
						<label label="0"/>
					</row>
					<row>
						<label label="0"/>
					</row>
				</column>
				<label label="   "/>
				<column>
					<row>
						<label label="White"/>
					</row>
					<row>
						<label label="F1"/>
					</row>
					<row>
						<label label="F0"/>
					</row>
					<row>
						<label label="F1"/>
					</row>
					<row>
						<label label="F0"/>
					</row>
					<row>
						<label label="F3"/>
					</row>
					<row>
						<label label="F5"/>
					</row>
					<row>
						<label label="F9"/>
					</row>
					<row>
						<label label="F3"/>
					</row>
					<row>
						<label label="F5"/>
					</row>
					<row>
						<label label="F9"/>
					</row>
				</column>
				<label label="   "/>
				<column>
					<row>
						<label label="Yellow"/>
					</row>
					<row>
						<label label="F2"/>
					</row>
					<row>
						<label label="F1"/>
					</row>
					<row>
						<label label="F2"/>
					</row>
					<row>
						<label label="F1"/>
					</row>
					<row>
						<label label="F4"/>
					</row>
					<row>
						<label label="F6"/>
					</row>
					<row>
						<label label="F10"/>
					</row>
					<row>
						<label label="F4"/>
					</row>
					<row>
						<label label="F6"/>
					</row>
					<row>
						<label label="F10"/>
					</row>
				</column>
				<label label="   "/>
				<column>
					<row>
						<label label="Green (TF4)"/>
					</row>
					<row>
						<label label="F3"/>
					</row>
					<row>
						<label label="F2"/>
					</row>
					<row>
						<label label="F3"/>
					</row>
					<row>
						<label label="F2"/>
					</row>
					<row>
						<label label="F5"/>
					</row>
					<row>
						<label label="F7"/>
					</row>
					<row>
						<label label="F11"/>
					</row>
					<row>
						<label label="F5"/>
					</row>
					<row>
						<label label="F7"/>
					</row>
					<row>
						<label label="F11"/>
					</row>
				</column>
				<label label="   "/>
				<column>
					<row>
						<label label="Violet (TF4)"/>
					</row>
					<row>
						<label label="F4"/>
					</row>
					<row>
						<label label="F3"/>
					</row>
					<row>
						<label label="F4"/>
					</row>
					<row>
						<label label="F3"/>
					</row>
					<row>
						<label label="F6"/>
					</row>
					<row>
						<label label="F8"/>
					</row>
					<row>
						<label label="F12"/>
					</row>
					<row>
						<label label="F6"/>
					</row>
					<row>
						<label label="F8"/>
					</row>
					<row>
						<label label="F12"/>
					</row>
				</column>
				<label label="   "/>
				<column>
					<row>
						<label label="Transponding"/>
					</row>
					<row>
						<label label="OFF"/>
					</row>
					<row>
						<label label="OFF"/>
					</row>
					<row>
						<label label="ON"/>
					</row>
					<row>
						<label label="ON"/>
					</row>
					<row>
						<label label="ON"/>
					</row>
					<row>
						<label label="ON"/>
					</row>
					<row>
						<label label="ON"/>
					</row>
					<row>
						<label label="OFF"/>
					</row>
					<row>
						<label label="OFF"/>
					</row>
					<row>
						<label label="OFF"/>
					</row>
				</column>
			</row>
			<label label=" "/>
			<row>
				<column>
					<row>
						<display item="CV64" />
					</row>
				</column>
				<label label="   "/>
				<column>
					<row>
						<display item="CV61" />
					</row>
				</column>
			</row>
			<label label=" "/>
			<display item="Transponding" format="radiobuttons"/>
			<label label=" "/>
			<display item="ControlFn"/>
			<display item="F0 use" format="checkbox" tooltip="Do not check this box if 'F0 or F1' is not selected above"/>
			<label label=" "/>
			<display item="Effect Generated W" />
			<display item="Effect Rate W" />
			<label label=" "/>
			<display item="Effect Generated Y" />
			<display item="Effect Rate Y" />
		</column>
	</pane>
	<pane name="Decoder Lock">
		<column>
			<display item="Decoder Lock" format="radiobuttons"/>
			<display item="Decoder Lock Type"/>
		</column>
	</pane>
</decoder-config>
