From e2718ab6ea6d86ec6f3ce7c79f7b856dc72206d3 Mon Sep 17 00:00:00 2001 From: Piotr Kilczuk Date: Tue, 12 Jul 2016 18:38:32 +0100 Subject: [PATCH 1/3] Class 92 support --- README.rst | 1 + dsd/machine.py | 1 + dsd/machine_models.py | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/README.rst b/README.rst index 661b379..1997d64 100644 --- a/README.rst +++ b/README.rst @@ -20,6 +20,7 @@ Supported traction * Class 70 * Class 86 * Class 90 (Armstrong Powerhouse and Steam versions) +* Class 92 * Class 142 (Armstrong Powerhouse version) * Class 156 * Class 220 (JustTrains version) diff --git a/dsd/machine.py b/dsd/machine.py index 91e7c01..80b0649 100644 --- a/dsd/machine.py +++ b/dsd/machine.py @@ -42,6 +42,7 @@ 'RSC.Class47Pack01': models.Class43JT_47_DSDModel, 'RSC.Class66Pack02': models.Class66APDSDModel, 'RSC.Class70Pack01': models.GenericDSDModel, + 'RSC.Class92Pack01': models.Class92DSDModel, 'RSC.Class421Pack01': models.GenericDSDModel, 'RSC.Class421Pack02': models.GenericDSDModel, 'RSC.Class422Pack01': models.GenericDSDModel, diff --git a/dsd/machine_models.py b/dsd/machine_models.py index 16ffbc0..ac15e8f 100644 --- a/dsd/machine_models.py +++ b/dsd/machine_models.py @@ -178,6 +178,20 @@ class Class90DSDModel(BuiltinDSDIsolationMixin, BaseDSDModel): ] +class Class92DSDModel(BuiltinDSDIsolationMixin, BaseDSDModel): + + dsd_controller_name = 'DSDEnabled' + dsd_controller_value = 0 + dsd_isolation_delay = 2 + important_controls = [ + 'AWSReset', + 'Horn', + 'Reverser', + 'VirtualBrake', + 'VirtualThrottle' + ] + + class Class142APDSDModel(BaseDSDModel): important_controls = [ From c1c63e6906bf82925edb06bf9c019fa22f1fa835 Mon Sep 17 00:00:00 2001 From: Piotr Kilczuk Date: Tue, 12 Jul 2016 22:36:49 +0100 Subject: [PATCH 2/3] Apparently different Class 92 variants have different controller sets --- dsd/machine_models.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dsd/machine_models.py b/dsd/machine_models.py index ac15e8f..0a49e6f 100644 --- a/dsd/machine_models.py +++ b/dsd/machine_models.py @@ -1,5 +1,6 @@ import datetime import logging +import operator import random import time @@ -185,12 +186,20 @@ class Class92DSDModel(BuiltinDSDIsolationMixin, BaseDSDModel): dsd_isolation_delay = 2 important_controls = [ 'AWSReset', - 'Horn', 'Reverser', 'VirtualBrake', 'VirtualThrottle' ] + def bind_listener(self): + super(Class92DSDModel, self).bind_listener() + + # various variants of Class 92 have different controller sets (sic!) + try: + self.raildriver.set_controller_value('DSDIsolate', 1) + except ValueError: + pass + class Class142APDSDModel(BaseDSDModel): From 3ddb2611bc51031c1fe2293ef8cb3617dc88493b Mon Sep 17 00:00:00 2001 From: Piotr Kilczuk Date: Tue, 12 Jul 2016 22:37:31 +0100 Subject: [PATCH 3/3] operator is not necessary --- dsd/machine_models.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dsd/machine_models.py b/dsd/machine_models.py index 0a49e6f..840b247 100644 --- a/dsd/machine_models.py +++ b/dsd/machine_models.py @@ -1,6 +1,5 @@ import datetime import logging -import operator import random import time