From e95240551e3c34d2fb21e99c358fa5922a2060c9 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 13 Dec 2009 16:51:04 +0000 Subject: [PATCH] Support dual-address locomotives with extra functions on the second address --- locos.dat | 2 +- source/libmarklin/locomotive.cpp | 13 +++++++++++++ source/libmarklin/locotype.cpp | 7 +++++++ source/libmarklin/locotype.h | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/locos.dat b/locos.dat index 211daf4..f923d45 100644 --- a/locos.dat +++ b/locos.dat @@ -7,7 +7,7 @@ locomotive 37844 function 1 "smke"; function 2 "tlx"; function 3 "sfx"; - //function 5 "whst"; + function 5 "whst"; }; locomotive 33961 diff --git a/source/libmarklin/locomotive.cpp b/source/libmarklin/locomotive.cpp index 2df46a0..5fe5ca5 100644 --- a/source/libmarklin/locomotive.cpp +++ b/source/libmarklin/locomotive.cpp @@ -11,6 +11,7 @@ Distributed under the GPL #include "constants.h" #include "control.h" #include "locomotive.h" +#include "locotype.h" #include "reply.h" using namespace std; @@ -105,6 +106,18 @@ void Locomotive::send_command(bool setf) data[3] |= (1<4) + { + if(!++data[0]) + ++data[1]; + data[2] = 0; + data[3] = 0xA0; + for(unsigned i=0; i<4; ++i) + if((funcs>>i)&32) + data[3] |= (1<first; +} + LocoType::Loader::Loader(LocoType <): Msp::DataFile::BasicLoader(lt) diff --git a/source/libmarklin/locotype.h b/source/libmarklin/locotype.h index 7509eca..5fd34d8 100644 --- a/source/libmarklin/locotype.h +++ b/source/libmarklin/locotype.h @@ -32,6 +32,7 @@ public: LocoType(unsigned); unsigned get_article_number() const { return art_nr; } const std::string &get_name() const { return name; } + unsigned get_max_function() const; const std::map &get_functions() const { return funcs; } }; -- 2.43.0