Skip to content
Permalink
Browse files

Roco LokMaus II, Lenz LH200, Lenz Compact and Atlas Commander only su…

…pport 2 digit addresses.
  • Loading branch information...
pabender committed Oct 25, 2018
1 parent 9fe7119 commit 121982a5feaf0ee39c4b6b97249fc4923032136d
@@ -421,10 +421,10 @@ public void stealThrottleRequest(LocoAddress address, ThrottleListener l,boolean
* notification message back to the requestor with a string reason as to why
* the request has failed.
*
* @param address The DCC Loco Address that the request failed on.
* @param address The Loco Address that the request failed on.
* @param reason A text string passed by the ThrottleManae as to why
*/
public void failedThrottleRequest(DccLocoAddress address, String reason) {
public void failedThrottleRequest(LocoAddress address, String reason) {
ArrayList<WaitingThrottle> a = throttleListeners.get(address);
if (a == null) {
log.warn("failedThrottleRequest with zero-length listeners: " + address);
@@ -337,3 +337,6 @@ HandleBoth = Both

#Error message displayed on start if internal connection has all defaults.
ManagerDefaultSelector.AllInternal = All defaults are assigned to an internal connection.

#Failed Throttle Request reason strings.
ThrottleErrorCSTwoDigit = {0} only supports two digit addresses.
@@ -19,6 +19,7 @@ CSTypeLH200 = LH200
CSTypeCompact = Compact or Other
CSTypeMultiMaus = multiMaus
CSTypeZ21 = Z21
CSTypeLokMaus = LocoMouse II
# Strings for hardware interface types
InterfaceLabel = Interface:
IFTypeLI100 = LI100
@@ -212,3 +213,4 @@ enter as number from 1 to 1024 (inclusive).
AddInputEntryToolTip = 3 (Feedback module 1, input 3)<br>\
99:3 (Feedback module 99, input 3)<br>\
enter as number from 1 to 1024 (inclusive).

@@ -89,6 +89,7 @@
public final static int CS_TYPE_LZ100 = 0x00; // Lenz LZ100/LZV100
public final static int CS_TYPE_LH200 = 0x01; // Lenz LH200
public final static int CS_TYPE_COMPACT = 0x02; // Lenz Compact/Atlas Commander
public final static int CS_TYPE_LOKMAUSII = 0x04; // Roco LokMaus II
public final static int CS_TYPE_MULTIMAUS = 0x10; // Roco multiMAUS
public final static int CS_TYPE_Z21 = 0x12; // Roco z21

@@ -42,6 +42,15 @@ public void requestThrottleSetup(LocoAddress address, boolean control) {
if (log.isDebugEnabled()) {
log.debug("Requesting Throttle: " + address);
}
// range check for LH200 and Compact/Commander
if (tc.getCommandStation().getCommandStationType() == 0x01 ||
tc.getCommandStation().getCommandStationType() == 0x02 ) {
if(address.getNumber()>=100) {
String typeString = Bundle.getMessage(tc.getCommandStation().getCommandStationType() == 0x01?"CSTypeLH200":"CSTypeCompact");
failedThrottleRequest(address,Bundle.getMessage("ThrottleErrorCSTwoDigit",typeString));
return;
}
}
if (throttles.containsKey(address)) {
notifyThrottleKnown(throttles.get(address), address);
} else {
@@ -224,6 +224,8 @@ private void setCSVersionDisplay() {
CSType.setText(Bundle.getMessage("CSTypeMultiMaus"));
} else if (cs_type == jmri.jmrix.lenz.XNetConstants.CS_TYPE_Z21) {
CSType.setText(Bundle.getMessage("CSTypeZ21"));
} else if (cs_type == jmri.jmrix.lenz.XNetConstants.CS_TYPE_LOKMAUSII) {
CSType.setText(Bundle.getMessage("CSTypeLokMaus"));
} else {
CSType.setText(Bundle.getMessage("StateUnknown")); // use shared key
}
@@ -423,7 +423,7 @@ public void releaseThrottle(DccThrottle t, ThrottleListener l) {
* @param reason for the failure
*/
@Override
public void failedThrottleRequest(DccLocoAddress address, String reason) {
public void failedThrottleRequest(LocoAddress address, String reason) {
super.failedThrottleRequest(address, reason);
log.debug("failedThrottleRequest - address {}, reason {}", address, reason);
//now end and remove any waiting thread
@@ -95,7 +95,7 @@ public void notifyChangedSlot(LocoNetSlot s) {
}

@Override
public void failedThrottleRequest(DccLocoAddress address, String reason) {
public void failedThrottleRequest(LocoAddress address, String reason) {
if (waitingForNotification.containsKey(address.getNumber())) {
waitingForNotification.get(address.getNumber()).interrupt();
waitingForNotification.remove(address.getNumber());
@@ -1,4 +1,6 @@
# RocoBundle.properties
#
# Default properties for the jmri.jmrix.roco package
CSTypeZ21 = Z21
CSTypeLokMaus = LocoMouse II

@@ -26,6 +26,14 @@ public RocoXNetThrottleManager(XNetSystemConnectionMemo memo) {
*/
@Override
public void requestThrottleSetup(LocoAddress address, boolean control) {
// range check for LocoMaus II
if (tc.getCommandStation().getCommandStationType() == 0x04 ) {
if(address.getNumber()>=100) {
String typeString = Bundle.getMessage("CSTypeLokMaus");
failedThrottleRequest(address,Bundle.getMessage("ThrottleErrorCSTwoDigit",typeString));
return;
}
}
RocoXNetThrottle throttle;
if (log.isDebugEnabled()) {
log.debug("Requesting Throttle: " + address);

0 comments on commit 121982a

Please sign in to comment.
You can’t perform that action at this time.