Created
November 9, 2015 03:58
-
-
Save k4kfh/0f2b688bad9a57e017b5 to your computer and use it in GitHub Desktop.
example-decoder-constructor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emd567:function(address, trainPosition) { | |
//ESU LokSound Select V4 | |
//decoder object for ESU official EMD 567 Sound project | |
//By Hampton Morgan - k4kfh@github - May 2015 | |
//evilgeniustech.com | |
train[trainPosition].throttle = new jmri.throttle(address, trainPosition) //we use the train position as the throttle name for future lookup purposes | |
//FUNCTIONS | |
this.f = new Object(); | |
//bell | |
this.f.bell = new Object(); | |
this.f.bell.set = function(state) { | |
train[trainPosition].throttle.f.set(1, state) | |
train[trainPosition].dcc.f.bell.state = state; | |
} | |
this.f.bell.state = false; | |
//horn | |
this.f.horn = new Object(); | |
this.f.horn.set = function(state) { | |
train[trainPosition].throttle.f.set(2, state) | |
train[trainPosition].dcc.f.horn.state = state; | |
} | |
this.f.horn.state = false; | |
//compressor | |
this.f.compressor = new Object(); | |
this.f.compressor.set = function(state) { | |
train[trainPosition].throttle.f.set(20, state) | |
train[trainPosition].dcc.f.compressor.state = state; | |
} | |
this.f.compressor.state = false; | |
//air release | |
this.f.airdump = new Object(); | |
this.f.airdump.set = function(state) { | |
} | |
this.f.airdump.state = false; | |
//dyn brake fans | |
this.f.dynbrakes = new Object(); | |
this.f.dynbrakes.set = function(state) { | |
} | |
this.f.dynbrakes.state = false; | |
//engine on/off | |
this.f.engine = new Object(); | |
this.f.engine.set = function(state) { | |
train[trainPosition].throttle.f.set(8, state) | |
train[trainPosition].dcc.f.engine.state = state; | |
} | |
this.f.engine.state = false; | |
//notch up | |
this.f.notchup = new Object(); | |
this.f.notchup.set = function(state) { | |
} | |
this.f.notchup.state = false; | |
//notch down | |
this.f.notchdown = new Object(); | |
this.f.notchdown.set = function(state) { | |
} | |
this.f.notchdown.state = false; | |
//SPEED SETTING | |
this.speed = new Object(); | |
this.speed.state = 0; | |
this.speed.set = function(speed) { | |
train[trainPosition].throttle.speed.set(speed) | |
train[trainPosition].dcc.speed.state = speed; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment