<?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 All rights reserved -->
<!-- $Id: Lenz_V41.xml,v 1.2 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="Matthew Harris - matthew.john.harris@gmail.com"
		 version="2.0" lastUpdated="20080818" />
	<version author="Matthew Harris - matthew.john.harris@gmail.com"
		 version="1.0" lastUpdated="20080814" />
	<!-- Version 2.0: Updated various CV's to agree with the document       -->
	<!-- provided by Marc Fournier found at the following link:             -->
	<!-- http://www.lenz.com/products/decoders/currentdecoders/nornalcv.htm -->
	<!-- Version 1.0: Created based on the manual found at:                 -->
	<!-- http://www.lenz.com/manuals/decoders/le103.pdf                     -->

	<!-- These are the version 4.1 decoders -->
	<decoder>
		<family name="Lenz version 4.1 decoders" mfg="Lenz" lowVersionID="41" highVersionID="43">
			<model model="LE103" numOuts="2" 
			       nmraWarrant="yes" nmraWarrantStart="199611">
				<output name="1" label="A - White" />
				<output name="2" label="B - Yellow" />
			</model>
		</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="Start voltage" CV="2" item="Vstart"
				  comment="Range 1-15" default="4">
				<decVal min="1" max="15" />
			</variable>

			<variable label="Acceleration momentum" CV="3" item="Accel"
				  comment="Range 1-31" default="1">
				<decVal min="1" max="31"/>
			</variable>

			<variable label="Brake momentum" CV="4" item="Decel"
				  comment="Range 1-31" default="1">
				<decVal min="1" max="31"/>
			</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="99">
				<decVal/>
			</variable>

			<variable label="Manufacturer ID - Reset" CV="8" default="99">
				<decVal/>
			</variable>

			<variable label="Long Address" CV="17" item="Extended Address"
				  comment="4 digit address (Range 0001-9999)" default="0">
				<longAddressVal/>
			</variable>

			<variable label="Consist Address" CV="19" mask="XVVVVVVV"
				  item="Consist Address" default="0">
				<decVal/>
			</variable>

			<variable label="Consist Direction" CV="19" mask="VXXXXXXX">
				<enumVal>
					<enumChoice choice="Normal"/>
					<enumChoice choice="Reversed"/>
				</enumVal>
			</variable>
			
			<variable label="Acceleration Trim" CV="23"
				  item="AccelTrim" default="0">
				<decVal/>
			</variable>

			<variable label="Deceleration Trim" CV="24"
				  item="DecelTrim" default="0">
				<decVal/>
			</variable>

			<variable label="Normal direction of motion" CV="29" mask="XXXXXXXV"
				  item="Locomotive Direction" default="0">
				<enumVal>
					<enumChoice choice="Forward"/>
					<enumChoice choice="Reverse"/>
				</enumVal>
			</variable>

			<variable label="Speed Steps" CV="29" mask="XXXXXXVX"
				  item="Speed Step Mode" default="0">
				<enumVal>
					<enumChoice choice="14"/>
					<enumChoice choice="28 (recommended)"/>
				</enumVal>
			</variable>

			<variable label="Analog conversion mode" CV="29" mask="XXXXXVXX"
				  item="Analog (DC) Operation" default="1">
				<enumVal>
					<enumChoice choice="Off"/>
					<enumChoice choice="On"/>
				</enumVal>
			</variable>

			<variable label="Use Speed Table" CV="29" mask="XXXVXXXX"
				  item="Speed Table Definition" default="0">
				<enumVal>
					<enumChoice choice="Don't use Speed Table"/>
					<enumChoice choice="Use Speed Table"/>
				</enumVal>
			</variable>

			<variable label="Addressing Mode" CV="29" mask="XXVXXXXX"
				  item="Address Format" default="0">
				<enumVal>
					<enumChoice choice="2 digit addressing"/>
					<enumChoice choice="4 digit addressing"/>
				</enumVal>
			</variable>

			<variable label="Accel/Decel Trim" CV="50" mask="XXXXXXVX"
				  item="Accel/Decel Trim" default="0"
				  comment="Switch on/off Acceleration/Deceleration trim">
				<enumVal>
					<enumChoice choice="Trim Off"/>
					<enumChoice choice="Trim On"/>
				</enumVal>
			</variable>

			<variable label="Brake Momentum on DC" CV="50" mask="XXXXXVXX"
				  item="DC Brake Momentum" default="0"
				  comment="Governs how loco acts in DC track block">
				<enumVal>
					<enumChoice choice="Loco runs under DC analog voltage control"/>
					<enumChoice choice="Loco brakes to a stop using momentum set in CV4"/>
				</enumVal>
			</variable>

			<variable label="Headlight Control" CV="51" mask="XXXXXXXV"
				  item="Directional Headlights" default="0">
				<enumVal>
					<enumChoice choice="Directional Lights"/>
					<enumChoice choice="Rule 17 Independent Front/Rear Lights"/>
				</enumVal>
			</variable>

			<variable label="Directional Headlight Dimming" CV="51" mask="XXXXXXVX"
				  item="Global lighting option 1" default="0"
				  comment="Only relevant for 'Directional Lights'">
				<enumVal>
					<enumChoice choice="Disabled"/>
					<enumChoice choice="F1 dims headlight"/>
				</enumVal>
			</variable>

			<variable label="Rule 17 Front Light Dimming" CV="51" mask="XXXXXVXX"
				  item="Global lighting option 2" default="0"
				  comment="Only relevant for 'Rule 17 Independent Front/Rear Lights'">
				<enumVal>
					<enumChoice choice="Disabled"/>
					<enumChoice choice="F4 dims Front Light"/>
				</enumVal>
			</variable>

			<variable label="Rule 17 Rear Light Dimming" CV="51" mask="XXXXVXXX"
				  item="Global lighting option 3" default="0"
				  comment="Only relevant for 'Rule 17 Independent Front/Rear Lights'">
				<enumVal>
					<enumChoice choice="Disabled"/>
					<enumChoice choice="F4 dims Rear Light"/>
				</enumVal>
			</variable>

			<variable label="Dimming Value" CV="52"
				  item="Global lighting option 4" default="0">
				<decVal/>
			</variable>

			<variable label="Speed Table" CV="67">
				<speedTableVal/>
			</variable>

			<variable label="User Private ID #1" CV="105"
				  item="User Id #1">
				<decVal/>
			</variable>

			<variable label="User Private ID #2" CV="106"
				  item="User Id #2">
				<decVal/>
			</variable>

			<!-- Define the fixed Function-Output mapping -->
			<constant label="FL(f) controls output 1" minOut="1" default="1" /> 
			<constant label="FL(r) controls output 2" minOut="2" default="1" /> 

		</variables>

	</decoder>
	
	<pane name="Lenz">
		<column>
			<display item="Accel/Decel Trim"/>
			<display item="AccelTrim"/>
			<display item="DecelTrim"/>
		</column>
	</pane>

</decoder-config>
