<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../XSLT/decoder.xsl"?>
<!-- Copyright (C) JMRI 2022, 2023 All rights reserved                      -->
<!--                                                                        -->
<!-- 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 xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://jmri.org/xml/schema/decoder-4-15-2.xsd">
    <version author="Ulrich Gerlach" version="1" lastUpdated="2025-12-06"/>
    <!-- Version 1 - For Piko SmartDecoder XP5.1-G Sound FW 1.17.0+ -->
    <!-- copy from Piko_SmartDecoder_XP5.1_Sound_noSUSI_v1.8.xml -->
    <version author="Ulrich Gerlach" version="2" lastUpdated="2026-04-04"/>
    <!-- Version 23- Support for the product ID and replacementModels -->
    <decoder>
        <family name="PIKO SmartDecoder XP5.1 (version 1.17+)" mfg="PIKO" lowVersionID="17" highVersionID="20" comment="Decoders not sorted (necessarily) in numerical order">
            <model model="PIKO36505-G XP5.1 V1.17" numOuts="14" numFns="68" maxMotorCurrent="5A" formFactor="G" connector="DropIn" productID="PIKO36505-G" comment="Piko SmartDecoder XP5.1-G Sound allgemein (FW 1.17.0+)">
                <output name="1" label="F0(f)" connection="plug" maxcurrent="800 mA"/>
                <output name="2" label="F0(r)" connection="plug" maxcurrent="800 mA"/>
                <output name="3" label=". A1 ." connection="plug" maxcurrent="800 mA"/>
                <output name="4" label=". A2 ." connection="plug" maxcurrent="800 mA"/>
                <output name="5" label=". A3 ." connection="plug" maxcurrent="800 mA"/>
                <output name="6" label=". A4 ." connection="plug" maxcurrent="800 mA"/>
                <output name="7" label=". A5 ." connection="plug" maxcurrent="800 mA"/>
                <output name="8" label=". A6 ." connection="plug" maxcurrent="800 mA"/>
                <output name="9" label=". A7 ." connection="plug" maxcurrent="800 mA"/>
                <output name="10" label=". A8 ." connection="plug" maxcurrent="800 mA"/>
                <output name="11" label=". A9 ." connection="plug" maxcurrent="800 mA"/>
                <output name="12" label=". A10." connection="plug" maxcurrent="800 mA"/>
                <output name="13" label=". A11." connection="plug" maxcurrent="800 mA"/>
                <output name="14" label=". A12." connection="plug" maxcurrent="800 mA"/>
                <size length="60" width="25" height="10" units="mm"/>
            </model>
            <model model="PIKO36537 BR80-G V1.17" numOuts="14" numFns="68" maxMotorCurrent="5A" formFactor="G" connector="DropIn" productID="36537" comment="Piko SmartDecoder XP5.1-G Sound BR 80 G (FW 1.17.0+)">
                <output name="1" label="F0(f)" connection="plug" maxcurrent="800 mA"/>
                <output name="2" label="F0(r)" connection="plug" maxcurrent="800 mA"/>
                <output name="3" label=". A1 ." connection="plug" maxcurrent="800 mA"/>
                <output name="4" label=". A2 ." connection="plug" maxcurrent="800 mA"/>
                <output name="5" label=". A3 ." connection="plug" maxcurrent="800 mA"/>
                <output name="6" label=". A4 ." connection="plug" maxcurrent="800 mA"/>
                <output name="7" label=". A5 ." connection="plug" maxcurrent="800 mA"/>
                <output name="8" label=". A6 ." connection="plug" maxcurrent="800 mA"/>
                <output name="9" label=". A7 ." connection="plug" maxcurrent="800 mA"/>
                <output name="10" label=". A8 ." connection="plug" maxcurrent="800 mA"/>
                <output name="11" label=". A9 ." connection="plug" maxcurrent="800 mA"/>
                <output name="12" label=". A10." connection="plug" maxcurrent="800 mA"/>
                <output name="13" label=". A11." connection="plug" maxcurrent="800 mA"/>
                <output name="14" label=". A12." connection="plug" maxcurrent="800 mA"/>
                <size length="60" width="25" height="10" units="mm"/>
            </model>
        </family>
        <programming direct="yes" paged="no" register="no" ops="yes">
            <capability>
                <name>Indexed CV access</name>
                <parameter name="PI">31</parameter>
                <!-- for Banks -->
                <parameter name="SI">32</parameter>
                <!-- Not used, but need to be declared for cvFirst to be read -->
                <parameter name="cvFirst">true</parameter>
            </capability>
        </programming>
        <variables>
            <!-- CVs 1, 17, 29 bit 5 -->
            <xi:include href="http://jmri.org/xml/decoders/nmra/shortAndLongAddress.xml"/>
            <!-- CVs 2 - 6 -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv2-6_v5.1.xml"/>
            <!-- CVs 7 - 8 -->
            <xi:include href="http://jmri.org/xml/decoders/nmra/mfgVersionId.xml"/>
            <!-- CV 11 -->
            <variable item="Time Digitalprotocol" CV="11" default="0">
                <decVal/>
                <label>Time without digital protocol</label>
                <label xml:lang="de">Zeit ohne Digitalprotokoll</label>
            </variable>
            <!-- CV 12 -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv12_v5.1.xml"/>
            <!-- CVs 13 - 14 - Analog Mode Functions F0 - F12 -->
            <xi:include href="http://jmri.org/xml/decoders/nmra/analogModeFunction_F12.xml"/>
            <!-- CVs 15 - 16 -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv15.16.xml"/>
            <!-- CVs 17 - 18 - already in place with CV 1-->
            <!-- CV 19 Consisting Information -->
            <xi:include href="http://jmri.org/xml/decoders/nmra/consistAddrDirection.xml"/>
            <!-- CVs 21 - 22 - Consisting Functions -->
            <xi:include href="http://jmri.org/xml/decoders/nmra/cv21.22_F12.xml"/>
            <!-- CV 27 - ABC stop configuration -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv27.xml"/>
            <!-- CV 28 - RailCom configuration -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv28.xml"/>
            <!-- CV 29 - DCC configuration -->
            <xi:include href="http://jmri.org/xml/decoders/nmra/cv29direction.xml"/>
            <xi:include href="http://jmri.org/xml/decoders/nmra/cv29speedSteps.xml"/>
            <xi:include href="http://jmri.org/xml/decoders/nmra/cv29analog.xml"/>
            <xi:include href="http://jmri.org/xml/decoders/nmra/cv29table3-28.xml"/>
            <xi:include href="http://jmri.org/xml/decoders/nmra/cv29RailCom.xml"/>
            <!-- CV 30 - Fault memory -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv30error.xml"/>
            <!-- CVs 31 - 32 - Banks are on CV 257.512_v5.1.xml include -->
            <!-- CVs 33 - 46 - nrma function mapping -->
            <xi:include href="http://jmri.org/xml/decoders/nmra/functionmap.xml"/>
            <!-- CV 47 - SUSI configuration, CVs 115 - 120 - SUSI Sendeoptionen 1 und 3 to SUSI -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv47.115-120_v5.1.xml"/>
            <!-- CVs 48 - 52 - ABC special configuration -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv48-52_v5.1.xml"/>
            <!-- CV 53 - ABV Anfahrrampe -->
            <variable item="Anfahrrampe CV53" CV="53" default="40">
                <decVal max="255"/>
                <label>Soft start and braking ramp (CV 53)</label>
                <label xml:lang="de">Sanftanfahr- und Bremsrampe (CV 53)</label>
                <tooltip>takes effect before the start-up delay or after braking delay (255 = Off)</tooltip>
                <tooltip xml:lang="de">greift vor bzw. nach ABV (255 = Aus)</tooltip>
            </variable>
            <!-- CVs 54 - 56,62 Motor control -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv54-56_v5.1.xml"/>
            <!-- CV 61 - Motorola -->
            <variable item="Motorola Config" CV="61" default="0">
                <decVal max="3"/>
                <label>Motorola Config (CV 61)</label>
                <label xml:lang="de">Motorola Konfiguration (CV 61)</label>
                <tooltip>Number of additional Motorola addresses for F5 - F16</tooltip>
                <tooltip xml:lang="de">Anzahl der zusätzlichen Motorolaadressen für F5 - F16</tooltip>
            </variable>
            <!-- CV 63 - Volume / Lautstärke -->
            <variable item="Globale Lautstärke" CV="63" readOnly="yes" default="200">
                <decVal max="255"/>
                <label>Global volume for mfx control centers (CV 63)</label>
                <label xml:lang="de">Globale Lautstärke für mfx-Zentralen (CV 63)</label>
                <tooltip>Auxiliary CV = CV 257 on Bank 16</tooltip>
                <tooltip xml:lang="de">Hilfs-CV = CV 257 von Bank 16</tooltip>
            </variable>
            <!-- CV 66 -->
            <xi:include href="http://jmri.org/xml/decoders/nmra/fwdTrim128.xml"/>
            <!-- CV 95 -->
            <xi:include href="http://jmri.org/xml/decoders/nmra/revTrim128.xml"/>
            <!-- CVs 67 - 94 -->
            <xi:include href="http://jmri.org/xml/decoders/nmra/cv67speedTableBasic.xml"/>
            <variable item="Advanced Function Mapping" CV="96" default="6" include="PIKO SmartDecoder XP5.1 (version 1.17+)">
                <enumVal>
                    <enumChoice choice="1" value="1">
                        <choice>Advanced Function Mapping off</choice>
                        <choice xml:lang="de">Einfaches Funktionsmapping</choice>
                    </enumChoice>
                    <enumChoice choice="2" value="6">
                        <choice>Advanced Function Mapping on</choice>
                        <choice xml:lang="de">Erweitertes Funktionsmapping</choice>
                    </enumChoice>
                </enumVal>
                <label>Use Advanced Function Mapping</label>
                <label xml:lang="de">Art des Funktionsmapping</label>
                <label xml:lang="nl">Uitgebreide Functiemapping actief</label>
                <label xml:lang="cs">Použití mapování pokročilých funkcí</label>
                <tooltip>simple value=1 / extended value=6</tooltip>
                <tooltip xml:lang="de">einfach Wert=1 / erweitert Wert=6</tooltip>
            </variable>
            <!-- CVs 97 - 98 -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv97.98_v5.1.xml"/>
            <!-- CVs 101 - 104 - Analog mode control -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv101-104_v5.1.xml"/>
            <!-- CVs 130 - 135 - Rangiertango -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv130-135_v5.1.xml"/>
            <!-- CVs 140 - 145 - Constant braking distance -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv140-145_v5.1.xml"/>
            <!-- CVs 147 - 149 - Alternativ max. speed -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv146-149_v5.1.xml"/>
            <!-- CVs 150 - 153 - Alternate ABV -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv150-153_v5.1.xml"/>
            <!-- CVs 154 - 157 - Function keys-->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv154-157_v5.1.xml"/>
            <!-- CVs 160 - 163 - Piko steam configuration -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv160-163_v5.1.xml"/>
            <!-- CVs 170 - 179 - Light Effects -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv170-179_v5.1.xml"/>
            <!-- CVs 180 - 188 - Automatisches Abschalten Funktionsausgänge -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv180-190_v5.1.xml"/>
            <!-- CVs 202 - 222 - Servos configuration -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv200-235_v5.1.xml"/>
            <!--            <xi:include href="http://jmri.org/xml/decoders/piko/cv202-222_v5.1.xml"/>
-->
            <!-- CVs 240 - 250 - Motor control / Motorregelung -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv240-250_v5.1.xml"/>
            <!-- CVs 251 - 256 & 236 - Sonderfunktionen -->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv251-256_v5.1.xml"/>
            <!--extended function mapping Piko Smartdecoder (Sound) 5.1, includes CV 31-32 bank switches-->
            <xi:include href="http://jmri.org/xml/decoders/piko/cv257-512_bank16_v5.1.xml"/>
            <xi:include href="http://jmri.org/xml/decoders/piko/cv257-512_bank17_v5.1.xml"/>
            <xi:include href="http://jmri.org/xml/decoders/piko/cv257-512_bank18.0_v5.1.xml"/>
            <xi:include href="http://jmri.org/xml/decoders/piko/cv257-512_bank18.1_v5.1.xml"/>
            <!-- Kein Interner Lichtdecoder CV897 - 1024 -->
            <!--<xi:include href="http://jmri.org/xml/decoders/piko/cv897-1024_v5.1.xml"/>-->
            <xi:include href="http://jmri.org/xml/decoders/piko/decoderInfoCVs.xml"/>
            <xi:include href="http://jmri.org/xml/decoders/piko/projectInfoCVs.xml"/>
        </variables>
        <xi:include href="http://jmri.org/xml/decoders/piko/cv8factReset_v5.1.xml"/>
    </decoder>
    <!-- special panes -->
    <xi:include href="http://jmri.org/xml/decoders/piko/PanePikoRailcom.xml"/>
    <xi:include href="http://jmri.org/xml/decoders/piko/PanePikoAccelDecel.xml"/>
    <xi:include href="http://jmri.org/xml/decoders/piko/PanePiko1.xml"/>
    <xi:include href="http://jmri.org/xml/decoders/piko/PanePiko2_v5.1.xml"/>
    <xi:include href="http://jmri.org/xml/decoders/piko/PanePikoMotor.xml"/>
    <!-- Kein Interner Lichtdecoder CV897 - 1024 -->
    <!--<xi:include href="http://jmri.org/xml/decoders/piko/PanePikoLichtDecoder_v5.1.xml"/>-->
    <xi:include href="http://jmri.org/xml/decoders/piko/PanePikoSound_v5.1.xml"/>
    <xi:include href="http://jmri.org/xml/decoders/piko/PanePikoExtendedFmap_v5.1.xml"/>
    <xi:include href="http://jmri.org/xml/decoders/piko/PanePikoConfigOutput1_v5.1.xml"/>
    <xi:include href="http://jmri.org/xml/decoders/piko/PanePikoConfigOutput2_v5.1.xml"/>
    <xi:include href="http://jmri.org/xml/decoders/piko/PanePikoAIO.xml"/>
    <xi:include href="http://jmri.org/xml/decoders/piko/PanePikoInfo.xml"/>
</decoder-config>

